Add russian locale

Poorly... But it'll do for now
This commit is contained in:
2025-01-09 20:58:17 +01:00
parent 12e0c23ea9
commit abb8540c12
6 changed files with 132 additions and 9 deletions

View File

@@ -73,7 +73,7 @@ function shared.CombatAlerter.Init()
local msg = { local msg = {
channel = "CHANNEL", channel = "CHANNEL",
data = Heimdall_Data.config.combatAlerter.masterChannel, 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, source,
zone, subZone, zone, subZone,
tostring(GetCurrentMapAreaID()), tostring(GetCurrentMapAreaID()),
@@ -85,6 +85,19 @@ function shared.CombatAlerter.Init()
print(string.format("[%s] Queuing alert message: '%s'", ModuleName, msg.message)) print(string.format("[%s] Queuing alert message: '%s'", ModuleName, msg.message))
end end
table.insert(shared.messenger.queue, msg) 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 elseif Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Source not in stinky list, ignoring: %s", ModuleName, source)) print(string.format("[%s] Source not in stinky list, ignoring: %s", ModuleName, source))
end end

View File

@@ -95,7 +95,7 @@ function shared.DeathReporter.Init()
local msg = { local msg = {
channel = "CHANNEL", channel = "CHANNEL",
data = Heimdall_Data.config.deathReporter.masterChannel, 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, source,
destination, destination,
spellName, spellName,
@@ -107,6 +107,20 @@ function shared.DeathReporter.Init()
print(string.format("[%s] Adding message to queue: %s", ModuleName, msg.message)) print(string.format("[%s] Adding message to queue: %s", ModuleName, msg.message))
end end
table.insert(shared.messenger.queue, msg) 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)
end end

View File

@@ -33,13 +33,20 @@ function shared.Sniffer.Init()
local msg = { local msg = {
channel = "CHANNEL", channel = "CHANNEL",
data = Heimdall_Data.config.deathReporter.notifyChannel, 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 if Heimdall_Data.config.sniffer.debug then
print(string.format("%s: Inserting message into queue", ModuleName)) print(string.format("%s: Inserting message into queue", ModuleName))
shared.dumpTable(msg) shared.dumpTable(msg)
end end
table.insert(shared.messenger.queue, msg) 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 end
local cleuFrame = CreateFrame("Frame") local cleuFrame = CreateFrame("Frame")

View File

@@ -156,7 +156,7 @@ function shared.Spotter.Init()
local stinky = Heimdall_Data.config.stinkies[name] or false local stinky = Heimdall_Data.config.stinkies[name] or false
SetMapToCurrentZone() SetMapToCurrentZone()
SetMapByID(GetCurrentMapAreaID()) 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", hostile and "Hostile" or "Friendly",
name, name,
class, class,
@@ -180,6 +180,31 @@ function shared.Spotter.Init()
message = text message = text
} }
table.insert(shared.messenger.queue, msg) 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 end
local frame = CreateFrame("Frame") local frame = CreateFrame("Frame")

View File

@@ -58,8 +58,22 @@ function shared.Whoer.Init()
end, end,
---@return string ---@return string
NotifyMessage = function(self) NotifyMessage = function(self)
local text = string.format( local text = string.format(shared.L.en.whoerNew,
"%s %s of class %s, race %s (%s) and guild %s in %s, first seen: %s, last seen: %s, times seen: %d", 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.name,
self.stinky and "(!!!!)" or "", self.stinky and "(!!!!)" or "",
self.class, self.class,
@@ -173,7 +187,7 @@ function shared.Whoer.Init()
if Heimdall_Data.config.who.doWhisper then if Heimdall_Data.config.who.doWhisper then
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Processing whisper notifications for %d recipients", ModuleName, print(string.format("[%s] Processing whisper notifications for %d recipients", ModuleName,
#Heimdall_Data.config.whisperNotify)) #Heimdall_Data.config.whisperNotify))
end end
for _, name in pairs(Heimdall_Data.config.whisperNotify) do for _, name in pairs(Heimdall_Data.config.whisperNotify) do
---@type Message ---@type Message
@@ -201,7 +215,7 @@ function shared.Whoer.Init()
and not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then 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)) return string.format("Not notifying for zones %s and %s", tostring(zone), tostring(player.zone))
end 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.name,
player.class, player.class,
player.race, player.race,
@@ -217,6 +231,22 @@ function shared.Whoer.Init()
} }
table.insert(shared.messenger.queue, msg) 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 if Heimdall_Data.config.who.doWhisper then
for _, name in pairs(Heimdall_Data.config.whisperNotify) do for _, name in pairs(Heimdall_Data.config.whisperNotify) do
---@type Message ---@type Message
@@ -241,7 +271,7 @@ function shared.Whoer.Init()
tostring(player.zone)) tostring(player.zone))
end 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.name,
player.class, player.class,
player.guild, player.guild,
@@ -255,6 +285,20 @@ function shared.Whoer.Init()
} }
table.insert(shared.messenger.queue, msg) 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 if Heimdall_Data.config.who.doWhisper then
for _, name in pairs(Heimdall_Data.config.whisperNotify) do for _, name in pairs(Heimdall_Data.config.whisperNotify) do
---@type Message ---@type Message

20
_L.lua Normal file
View File

@@ -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",
},
}