Rework localization in deathreporter
This commit is contained in:
@@ -79,9 +79,10 @@ function shared.DeathReporter.Init()
|
||||
ModuleName, source, destination, spellName))
|
||||
end
|
||||
|
||||
local location = Heimdall_Data.config.deathReporter.zoneOverride
|
||||
if not location or location == "" then
|
||||
location = string.format("%s (%s)", GetZoneText(), GetSubZoneText())
|
||||
local zone, subzone = GetZoneText() or "Unknown", GetSubZoneText() or "Unknown"
|
||||
if Heimdall_Data.config.spotter.zoneOverride then
|
||||
zone = Heimdall_Data.config.spotter.zoneOverride or ""
|
||||
subzone = ""
|
||||
end
|
||||
|
||||
local x, y = GetPlayerMapPosition("player")
|
||||
@@ -92,46 +93,26 @@ function shared.DeathReporter.Init()
|
||||
SetMapByID(GetCurrentMapAreaID())
|
||||
local zoneId = GetCurrentMapAreaID()
|
||||
|
||||
for _, channel in pairs(Heimdall_Data.config.deathReporter.channels) do
|
||||
local locale = shared.GetLocaleForChannel(channel)
|
||||
local text = string.format(shared._L("killed", locale),
|
||||
source,
|
||||
destination,
|
||||
shared._L(spellName, locale),
|
||||
shared._L(zone, locale), shared._L(subzone, locale),
|
||||
zoneId,
|
||||
x * 100, y * 100)
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.deathReporter.masterChannel,
|
||||
message = string.format(shared.L.en.killed,
|
||||
source,
|
||||
destination,
|
||||
spellName,
|
||||
location,
|
||||
zoneId,
|
||||
x * 100, y * 100)
|
||||
data = channel,
|
||||
message = text
|
||||
}
|
||||
if Heimdall_Data.config.deathReporter.debug then
|
||||
print(string.format("[%s] Adding message to queue: %s", ModuleName, msg.message))
|
||||
print(string.format("[%s] Queuing death report message", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
end
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
local zone, subZone = GetZoneText(), GetSubZoneText()
|
||||
if not shared.L.ru.zones[zone] then
|
||||
print(string.format("[%s] Zone %s not found in ru.zones", ModuleName, zone))
|
||||
end
|
||||
zone = shared.L.ru.zones[zone] or zone
|
||||
if not shared.L.ru.zones[subZone] then
|
||||
print(string.format("[%s] Subzone %s not found in ru.zones", ModuleName, subZone))
|
||||
end
|
||||
subZone = shared.L.ru.zones[subZone] or subZone
|
||||
|
||||
if Heimdall_Data.config.echoToRussian then
|
||||
-- Russian message
|
||||
local ruMsg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.deathReporter.masterChannel .. "ru",
|
||||
message = string.format(shared.L.ru.killed,
|
||||
source,
|
||||
destination,
|
||||
spellName,
|
||||
string.format("%s (%s)", zone, subZone),
|
||||
zoneId,
|
||||
x * 100, y * 100)
|
||||
}
|
||||
table.insert(shared.messenger.queue, ruMsg)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -136,7 +136,6 @@ function shared.Spotter.Init()
|
||||
local class = UnitClass(unit)
|
||||
if not class then return string.format("Could not find class for unit %s", tostring(unit)) end
|
||||
|
||||
---@type string, string
|
||||
local zone, subzone = GetZoneText() or "Unknown", GetSubZoneText() or "Unknown"
|
||||
if Heimdall_Data.config.spotter.zoneOverride then
|
||||
zone = Heimdall_Data.config.spotter.zoneOverride or ""
|
||||
|
||||
4
_L.lua
4
_L.lua
@@ -16,7 +16,7 @@ shared._Locale = {
|
||||
whoerNew = "%s %s c:%s r:%s (%s) g:%s - %s",
|
||||
whoerMoved = "%s c:%s (%s - %s) g:%s moved to %s",
|
||||
whoerGone = "%s c:%s g:%s left %s",
|
||||
killed = "%s killed %s with %s in %s at [%s](%2.2f, %2.2f)",
|
||||
killed = "%s killed %s with %s in %s (%s) at [%s](%2.2f, %2.2f)",
|
||||
hostile = "hostile",
|
||||
friendly = "friendly",
|
||||
unknown = "unknown",
|
||||
@@ -100,7 +100,7 @@ shared._Locale = {
|
||||
"%s %s класса %s, расы %s (%s) гильдии %s в %s",
|
||||
whoerMoved = "%s класса %s (%s - %s) и гильдии %s переместился в %s",
|
||||
whoerGone = "%s класса %s и гильдии %s покинул %s",
|
||||
killed = "%s убил %s с %s в %s на [%s](%2.2f, %2.2f)",
|
||||
killed = "%s убил %s с %s в %s (%s) на [%s](%2.2f, %2.2f)",
|
||||
hostile = "враждебный",
|
||||
friendly = "дружественный",
|
||||
unknown = "неизвестный",
|
||||
|
||||
Reference in New Issue
Block a user