Skip to content

Commit

Permalink
Localize all ranks except Hero
Browse files Browse the repository at this point in the history
Don't yet have a Hero Rank item to test with.
  • Loading branch information
teelolws committed May 6, 2023
1 parent 4bcf09a commit 5799304
Showing 1 changed file with 58 additions and 11 deletions.
69 changes: 58 additions & 11 deletions item-upgrade.lua
Original file line number Diff line number Diff line change
@@ -1,38 +1,85 @@
local db = {
["Explorer"] = {
explorer = {
enUS = "Explorer",
esMX = "Expedicionario",
ptBR = "Explorador",
frFR = "Explorateur",
deDE = "Forscher",
esES = "Expedicionario",
itIT = "Esploratore",
ruRU = "Исследователь",
koKR = "탐험가",
zhTW = "探險者",
zhCN = "探索者",
lower = 376,
upper = 398,
},
["Adventurer"] = {
adventurer = {
enUS = "Adventurer",
esMX = "Aventurero",
ptBR = "Aventureiro",
frFR = "Aventurier",
deDE = "Abenteurer",
esES = "Aventurero",
itIT = "Avventuriero",
ruRU = "Искатель приключений",
koKR = "모험가",
zhTW = "冒險者",
zhCN = "冒险者",
lower = 389,
upper = 411,
},
["Veteran"] = {
veteran = {
enUS = "Veteran",
esMX = "Veterano",
ptBR = "Veterano",
frFR = "Vétéran",
deDE = "Veteran",
esES = "Veterano",
itIT = "Veterano",
ruRU = "Ветеран",
koKR = "노련가",
zhTW = "精兵",
zhCN = "老兵",
lower = 402,
upper = 424,
},
["Champion"] = {
champion = {
enUS = "Champion",
esMX = "Campeón",
ptBR = "Campeão",
frFR = "Champion",
deDE = "Champion",
esES = "Campeón",
itIT = "Campione",
ruRU = "Защитник",
koKR = "챔피언",
zhTW = "勇士",
zhCN = "勇士",
lower = 415,
upper = 437,
},
["Hero"] = {
hero = {
enUS = "Hero",
lower = 428,
upper = 441,
},
}

local pattern = ITEM_UPGRADE_TOOLTIP_FORMAT_STRING
pattern = pattern:gsub("%%d", "%%s")
pattern = pattern:format("(.+)", "(%d)", "(%d)")
TooltipDataProcessor.AddTooltipPreCall(Enum.TooltipDataType.Item, function(tooltip, data)
for k, v in pairs(data.lines) do
if type(v) == "table" then
local text = v.leftText
local pattern = ITEM_UPGRADE_TOOLTIP_FORMAT_STRING
pattern = pattern:gsub("%%d", "%%s")
pattern = pattern:format("([%s%w]+)", "(%d)", "(%d)")
local match, _, rank, lower, upper = text:find(pattern)
if match then
if db[rank] then
if lower ~= upper then
v.leftText = text.." "..DISABLED_FONT_COLOR:GenerateHexColorMarkup().."("..db[rank].lower.."-"..db[rank].upper..")|r"
for _, data in pairs(db) do
if data[GetLocale()] and (data[GetLocale()] == rank) then
if lower ~= upper then
v.leftText = text.." "..DISABLED_FONT_COLOR:GenerateHexColorMarkup().."("..data.lower.."-"..data.upper..")|r"
end
end
end
end
Expand Down

0 comments on commit 5799304

Please sign in to comment.