From abb8540c127ebf331c43ca88a4d3edec6cb68645 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Thu, 9 Jan 2025 20:58:17 +0100 Subject: [PATCH] Add russian locale Poorly... But it'll do for now --- Modules/CombatAlerter.lua | 15 ++++++++++- Modules/DeathReporter.lua | 16 +++++++++++- Modules/Sniffer.lua | 9 ++++++- Modules/Spotter.lua | 27 +++++++++++++++++++- Modules/Whoer.lua | 54 +++++++++++++++++++++++++++++++++++---- _L.lua | 20 +++++++++++++++ 6 files changed, 132 insertions(+), 9 deletions(-) create mode 100644 _L.lua diff --git a/Modules/CombatAlerter.lua b/Modules/CombatAlerter.lua index 727c476..c5743a0 100644 --- a/Modules/CombatAlerter.lua +++ b/Modules/CombatAlerter.lua @@ -73,7 +73,7 @@ function shared.CombatAlerter.Init() local msg = { channel = "CHANNEL", data = Heimdall_Data.config.combatAlerter.masterChannel, - message = string.format("I am in combat with %s at %s (%s) at [%s](%2.2f, %2.2f)", + message = string.format(shared.L.en.combatAlerterInCombat, source, zone, subZone, tostring(GetCurrentMapAreaID()), @@ -85,6 +85,19 @@ function shared.CombatAlerter.Init() print(string.format("[%s] Queuing alert message: '%s'", ModuleName, msg.message)) end table.insert(shared.messenger.queue, msg) + + ---@type Message + msg = { + channel = "CHANNEL", + data = Heimdall_Data.config.combatAlerter.masterChannel .. "ru", + message = string.format(shared.L.ru.combatAlerterInCombat, + source, + zone, subZone, + tostring(GetCurrentMapAreaID()), + x * 100, y * 100 + ), + } + table.insert(shared.messenger.queue, msg) elseif Heimdall_Data.config.combatAlerter.debug then print(string.format("[%s] Source not in stinky list, ignoring: %s", ModuleName, source)) end diff --git a/Modules/DeathReporter.lua b/Modules/DeathReporter.lua index b9580d5..39a5f8f 100644 --- a/Modules/DeathReporter.lua +++ b/Modules/DeathReporter.lua @@ -95,7 +95,7 @@ function shared.DeathReporter.Init() local msg = { channel = "CHANNEL", data = Heimdall_Data.config.deathReporter.masterChannel, - message = string.format("%s killed %s with %s in %s [%s](%2.2f, %2.2f)", + message = string.format(shared.L.en.deathReporterDeath, source, destination, spellName, @@ -107,6 +107,20 @@ function shared.DeathReporter.Init() print(string.format("[%s] Adding message to queue: %s", ModuleName, msg.message)) end table.insert(shared.messenger.queue, msg) + + ---@type Message + msg = { + channel = "CHANNEL", + data = Heimdall_Data.config.deathReporter.masterChannel .. "ru", + message = string.format(shared.L.ru.deathReporterDeath, + source, + destination, + spellName, + location, + tostring(GetCurrentMapAreaID()), + x * 100, y * 100) + } + table.insert(shared.messenger.queue, msg) end) end diff --git a/Modules/Sniffer.lua b/Modules/Sniffer.lua index 3dd5942..92097df 100644 --- a/Modules/Sniffer.lua +++ b/Modules/Sniffer.lua @@ -33,13 +33,20 @@ function shared.Sniffer.Init() local msg = { channel = "CHANNEL", data = Heimdall_Data.config.deathReporter.notifyChannel, - message = string.format("I smell a stinky %s", stinky), + message = string.format(shared.L.en.snifferStinky, stinky), } if Heimdall_Data.config.sniffer.debug then print(string.format("%s: Inserting message into queue", ModuleName)) shared.dumpTable(msg) end table.insert(shared.messenger.queue, msg) + + msg = { + channel = "CHANNEL", + data = Heimdall_Data.config.deathReporter.notifyChannel .. "ru", + message = string.format(shared.L.ru.snifferStinky, stinky), + } + table.insert(shared.messenger.queue, msg) end local cleuFrame = CreateFrame("Frame") diff --git a/Modules/Spotter.lua b/Modules/Spotter.lua index 1ac6a0b..74c0c9f 100644 --- a/Modules/Spotter.lua +++ b/Modules/Spotter.lua @@ -156,7 +156,7 @@ function shared.Spotter.Init() local stinky = Heimdall_Data.config.stinkies[name] or false SetMapToCurrentZone() SetMapByID(GetCurrentMapAreaID()) - local text = string.format("I see (%s) %s/%s %s of race %s (%s) with health %s/%s at %s [%s](%2.2f, %2.2f)", + local text = string.format(shared.L.en.spotterSpotted, hostile and "Hostile" or "Friendly", name, class, @@ -180,6 +180,31 @@ function shared.Spotter.Init() message = text } table.insert(shared.messenger.queue, msg) + + text = string.format(shared.L.ru.spotterSpotted, + hostile and "Hostile" or "Friendly", + name, + class, + stinky and string.format("(%s)", "!!!!") or "", + race, + faction, + FormatHP(hp), + FormatHP(maxHp), + location, + tostring(GetCurrentMapAreaID()), + x * 100, y * 100) + + if Heimdall_Data.config.spotter.debug then + print(string.format("[%s] Sending notification: %s", ModuleName, text)) + end + + ---@type Message + msg = { + channel = "CHANNEL", + data = Heimdall_Data.config.spotter.notifyChannel .. "ru", + message = text + } + table.insert(shared.messenger.queue, msg) end local frame = CreateFrame("Frame") diff --git a/Modules/Whoer.lua b/Modules/Whoer.lua index 879da5a..3aa65d7 100644 --- a/Modules/Whoer.lua +++ b/Modules/Whoer.lua @@ -58,8 +58,22 @@ function shared.Whoer.Init() end, ---@return string NotifyMessage = function(self) - local text = string.format( - "%s %s of class %s, race %s (%s) and guild %s in %s, first seen: %s, last seen: %s, times seen: %d", + local text = string.format(shared.L.en.whoerNew, + self.name, + self.stinky and "(!!!!)" or "", + self.class, + self.race, + tostring(shared.raceMap[self.race]), + self.guild, + self.zone, + self.firstSeen, + self.lastSeen, + self.seenCount) + return text + end, + ---@return string + NotifyRu = function(self) + local text = string.format(shared.L.ru.whoerNew, self.name, self.stinky and "(!!!!)" or "", self.class, @@ -173,7 +187,7 @@ function shared.Whoer.Init() if Heimdall_Data.config.who.doWhisper then if Heimdall_Data.config.who.debug then print(string.format("[%s] Processing whisper notifications for %d recipients", ModuleName, - #Heimdall_Data.config.whisperNotify)) + #Heimdall_Data.config.whisperNotify)) end for _, name in pairs(Heimdall_Data.config.whisperNotify) do ---@type Message @@ -201,7 +215,7 @@ function shared.Whoer.Init() and not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then return string.format("Not notifying for zones %s and %s", tostring(zone), tostring(player.zone)) end - local text = string.format("%s of class %s (%s - %s) and guild %s moved to %s", + local text = string.format(shared.L.en.whoerMoved, player.name, player.class, player.race, @@ -217,6 +231,22 @@ function shared.Whoer.Init() } table.insert(shared.messenger.queue, msg) + text = string.format(shared.L.ru.whoerMoved, + player.name, + player.class, + player.race, + shared.raceMap[player.race] or "Unknown", + player.guild, + zone) + + ---@type Message + msg = { + channel = "CHANNEL", + data = Heimdall_Data.config.who.notifyChannel .. "ru", + message = text + } + table.insert(shared.messenger.queue, msg) + if Heimdall_Data.config.who.doWhisper then for _, name in pairs(Heimdall_Data.config.whisperNotify) do ---@type Message @@ -241,7 +271,7 @@ function shared.Whoer.Init() tostring(player.zone)) end - local text = string.format("%s of class %s and guild %s left %s", + local text = string.format(shared.L.en.whoerGone, player.name, player.class, player.guild, @@ -255,6 +285,20 @@ function shared.Whoer.Init() } table.insert(shared.messenger.queue, msg) + text = string.format(shared.L.ru.whoerGone, + player.name, + player.class, + player.guild, + player.zone) + + ---@type Message + msg = { + channel = "CHANNEL", + data = Heimdall_Data.config.who.notifyChannel .. "ru", + message = text + } + table.insert(shared.messenger.queue, msg) + if Heimdall_Data.config.who.doWhisper then for _, name in pairs(Heimdall_Data.config.whisperNotify) do ---@type Message diff --git a/_L.lua b/_L.lua new file mode 100644 index 0000000..37a72a1 --- /dev/null +++ b/_L.lua @@ -0,0 +1,20 @@ +local _, shared = ... + +shared.L = { + en = { + combatAlerterInCombat = "I am in combat with %s at %s (%s) at [%s](%2.2f, %2.2f)", + snifferStinky = "I smell a stinky %s", + spotterSpotted = "I see (%s) %s/%s %s of race %s (%s) with health %s/%s at %s [%s](%2.2f, %2.2f)", + whoerNew = "%s %s of class %s, race %s (%s) and guild %s in %s, first seen: %s, last seen: %s, times seen: %d", + whoerMoved = "%s of class %s (%s - %s) and guild %s moved to %s", + whoerGone = "%s of class %s and guild %s left %s", + }, + ru = { + combatAlerterInCombat = "Я в бою с %s на %s (%s) на [%s](%2.2f, %2.2f)", + snifferStinky = "Я чувствую запах %s", + spotterSpotted = "Я вижу (%s) %s/%s %s (%s) с %s/%s здоровьем на %s [%s](%2.2f, %2.2f)", + whoerNew = "%s %s класса %s, расы %s (%s) и гильдии %s в %s, первый раз видели: %s, последний раз видели: %s, раз видели: %d", + whoerMoved = "%s класса %s (%s - %s) и гильдии %s переместился в %s", + whoerGone = "%s класса %s и гильдии %s покинул %s", + }, +}