Go to Page... |
Thread Tools | Display Modes |
02-18-24, 01:04 AM | #21 | |
How do I add localization of Next event is in and until event ends labels to other languages? Code:
enUS = "Next event is in: %s", zhCN = "下一个活动在: %s", deDE = "Nächste Veranstaltung ist in: %s", Code:
enUS = "%s until event ends", zhCN = "%s 直到事件结束", deDE = "bis zum Ende der Veranstaltung", |
||
02-18-24, 01:38 AM | #22 |
Lots of way to go about localisation but probably for something small like this the easiest would be something like:
Lua Code:
Then you can replace "Next event is in: %s" with L.Waiting and "%s until event ends" with L.Running The usual scoping rules apply. Your example didn't have a %s for the German "Until the event ends" so I just stuck one at the end (my German foo is also broken ).
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-18-24 at 01:43 AM. |
|
02-18-24, 01:46 AM | #23 | |
Look, did I do everything right? Code:
local addonName, addon = ... local Backdrop = { bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", } local frame_x = 0 local frame_y = -200 f = CreateFrame("Button", "ZAMROTimer", UIParent, "BackdropTemplate") f:SetWidth(255) f:SetHeight(20) f:SetBackdrop(Backdrop) f.text = f:CreateFontString(nil,"OVERLAY","GameTooltipText") f.text:SetTextHeight(15) f.text:SetPoint("CENTER") f:SetClampedToScreen(true) f:SetPoint("CENTER",UIParent,"CENTER",frame_x,frame_y) f:EnableMouse(true) f:SetMovable(true) f:RegisterForDrag("LeftButton") f:RegisterForClicks("AnyUp") f:Show() f:RegisterEvent("PLAYER_ENTERING_WORLD") f:SetScript("OnDragStart",function(this) this:StartMoving() end) f:SetScript("OnDragStop",function(this) this:StopMovingOrSizing() frame_x,frame_y = this:GetCenter() frame_x = frame_x - GetScreenWidth() / 2 frame_y = frame_y - GetScreenHeight() / 2 this:ClearAllPoints() this:SetPoint("CENTER",UIParent,"CENTER",frame_x,frame_y) end) local Localizations = { enUS = { Waiting = "Next event is in: %s", Running = "%s until event ends", }, zhCN = { Waiting = "下一个活动在: %s", Running = "%s 直到事件结束", }, deDE = { Waiting = "Nächste Veranstaltung ist in: %s", Running = "bis zum Ende der Veranstaltung: %s", }, } local locale = GetLocale() local L = Localizations[locale] or Localizations.enUS -- Default to enUS if locale doesn't exist in the table local function printTime(timetotrun, inevent) local hideSeconds = timetotrun >= 120 local msg = "L.Waiting" if inevent then msg = "L.Running" end f.text:SetText(format(msg, SecondsToTime(timetotrun, hideSeconds))) end regionEventStartTime = { [1] = { -- eu starttime = 1670331660, eventDuration = 900, eventIntervalInSeconds = 5400, enable = true, datablock = {} }, } local inEvent, timeToRun local eventTime = regionEventStartTime[1].eventDuration -- Time the event runs in seconds(15 mins) local waitTime = regionEventStartTime[1].eventIntervalInSeconds -- Time between events in seconds (90 mins) local startTime = regionEventStartTime[1].starttime -- Start time from the table local serverTime = GetServerTime() local timeToEvent = (startTime - serverTime) % waitTime -- Remaining time before next event starts if timeToEvent > (waitTime - eventTime) then -- Is there between 1:15 and 1:30 to go? If so, we're in the event inEvent = true timeToRun = eventTime - (waitTime - timeToEvent) else -- Otherwise, set the ticker timer to time to next event inEvent = false timeToRun = timeToEvent end local ticker = C_Timer.NewTicker(1, function() if timeToRun > 0 then timeToRun = timeToRun - 1 printTime(timeToRun, inEvent) return end if inEvent then -- The event just finished inEvent = false timeToRun = waitTime - eventTime -- Reset ticker timer to 90 minutes wait time minus 15 mins event time else -- Waiting for the next event just expired inEvent = true timeToRun = eventTime -- And the event is running end printTime(timeToRun, inEvent) end) printTime(timeToRun, inEvent) |
||
02-18-24, 01:52 AM | #24 |
Remove the quotes from around "L.Waiting" and "L.Running"
Lua Code:
You can test by using Code:
local locale = "deDE" -- or local locale = "zhCN" Code:
local locale = GetLocale()
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-18-24 at 01:57 AM. |
|
02-18-24, 03:51 AM | #25 | |
In one of the forum topics, I found your advice on how to make a window that can be moved around the screen. And I was able to apply this to my "button" and now it can be moved I am very happy that I found this great forum. |
||
02-18-24, 06:04 AM | #26 |
Looks like another question. How do I add a sound signal about the start of an event that notifies 5 minutes before the start of the event?
Lua Code:
I've written the code here (but it doesn't seem to be quite right) Lua Code:
|
|
02-18-24, 08:17 AM | #27 |
I've modified the message texts to allow for colouring of the time portion.
(my editor seems to have swallowed the chinese characters) Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-18-24 at 08:21 AM. |
|
02-18-24, 10:35 PM | #28 | |
(I copied incorrectly and forgot to copy one character, but now everything is ok) Last edited by Hubb777 : 02-18-24 at 10:42 PM. |
||
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Timer with an interval of 1 hour and 30 minutes |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|