Rework localization in deathreporter
This commit is contained in:
@@ -79,9 +79,10 @@ function shared.DeathReporter.Init()
|
|||||||
ModuleName, source, destination, spellName))
|
ModuleName, source, destination, spellName))
|
||||||
end
|
end
|
||||||
|
|
||||||
local location = Heimdall_Data.config.deathReporter.zoneOverride
|
local zone, subzone = GetZoneText() or "Unknown", GetSubZoneText() or "Unknown"
|
||||||
if not location or location == "" then
|
if Heimdall_Data.config.spotter.zoneOverride then
|
||||||
location = string.format("%s (%s)", GetZoneText(), GetSubZoneText())
|
zone = Heimdall_Data.config.spotter.zoneOverride or ""
|
||||||
|
subzone = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local x, y = GetPlayerMapPosition("player")
|
local x, y = GetPlayerMapPosition("player")
|
||||||
@@ -92,46 +93,26 @@ function shared.DeathReporter.Init()
|
|||||||
SetMapByID(GetCurrentMapAreaID())
|
SetMapByID(GetCurrentMapAreaID())
|
||||||
local zoneId = 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
|
---@type Message
|
||||||
local msg = {
|
local msg = {
|
||||||
channel = "C",
|
channel = "C",
|
||||||
data = Heimdall_Data.config.deathReporter.masterChannel,
|
data = channel,
|
||||||
message = string.format(shared.L.en.killed,
|
message = text
|
||||||
source,
|
|
||||||
destination,
|
|
||||||
spellName,
|
|
||||||
location,
|
|
||||||
zoneId,
|
|
||||||
x * 100, y * 100)
|
|
||||||
}
|
}
|
||||||
if Heimdall_Data.config.deathReporter.debug then
|
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
|
end
|
||||||
table.insert(shared.messenger.queue, msg)
|
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)
|
end)
|
||||||
end
|
end
|
||||||
|
@@ -136,7 +136,6 @@ function shared.Spotter.Init()
|
|||||||
local class = UnitClass(unit)
|
local class = UnitClass(unit)
|
||||||
if not class then return string.format("Could not find class for unit %s", tostring(unit)) end
|
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"
|
local zone, subzone = GetZoneText() or "Unknown", GetSubZoneText() or "Unknown"
|
||||||
if Heimdall_Data.config.spotter.zoneOverride then
|
if Heimdall_Data.config.spotter.zoneOverride then
|
||||||
zone = Heimdall_Data.config.spotter.zoneOverride or ""
|
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",
|
whoerNew = "%s %s c:%s r:%s (%s) g:%s - %s",
|
||||||
whoerMoved = "%s c:%s (%s - %s) g:%s moved to %s",
|
whoerMoved = "%s c:%s (%s - %s) g:%s moved to %s",
|
||||||
whoerGone = "%s c:%s g:%s left %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",
|
hostile = "hostile",
|
||||||
friendly = "friendly",
|
friendly = "friendly",
|
||||||
unknown = "unknown",
|
unknown = "unknown",
|
||||||
@@ -100,7 +100,7 @@ shared._Locale = {
|
|||||||
"%s %s класса %s, расы %s (%s) гильдии %s в %s",
|
"%s %s класса %s, расы %s (%s) гильдии %s в %s",
|
||||||
whoerMoved = "%s класса %s (%s - %s) и гильдии %s переместился в %s",
|
whoerMoved = "%s класса %s (%s - %s) и гильдии %s переместился в %s",
|
||||||
whoerGone = "%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 = "враждебный",
|
hostile = "враждебный",
|
||||||
friendly = "дружественный",
|
friendly = "дружественный",
|
||||||
unknown = "неизвестный",
|
unknown = "неизвестный",
|
||||||
|
Reference in New Issue
Block a user