Module:Sandbox/LVL: Difference between revisionsGive feedback
No edit summary |
No edit summary |
||
| Line 12: | Line 12: | ||
if not success then lang_data = {} end | if not success then lang_data = {} end | ||
-- Keys to explicitly ignore (metadata | -- Keys to explicitly ignore (metadata that might have translations but we don't want in search) | ||
local ignore_keys = { | local ignore_keys = { | ||
["Name"] = true, ["Description"] = true, ["Cost"] = true, ["Tier"] = true, | ["Name"] = true, ["Description"] = true, ["Cost"] = true, ["Tier"] = true, | ||
["Activation"] = true, ["Slot"] = true, ["Components"] = true, ["TargetTypes"] = true, | ["Activation"] = true, ["Slot"] = true, ["Components"] = true, ["TargetTypes"] = true, | ||
["ShopFilters"] = true, ["IsDisabled"] = true, ["StreetBrawl"] = true, ["IsImbue"] = true, | ["ShopFilters"] = true, ["IsDisabled"] = true, ["StreetBrawl"] = true, ["IsImbue"] = true, | ||
["ChannelMoveSpeed"] = true -- Keep this ignored since every item has it | |||
["ChannelMoveSpeed"] = true | |||
} | } | ||
| Line 30: | Line 28: | ||
-- Try to get the in-game name from the lang file | -- Try to get the in-game name from the lang file | ||
local term = lang_data[k .. "_label"] or lang_data[k] | local term = lang_data[k .. "_label"] or lang_data[k] | ||
-- ONLY add if a valid translation exists in the lang file! | |||
if term and type(term) == "string" then | if term and type(term) == "string" then | ||
-- Clean up any HTML tags or inline attributes from the localization string | -- Clean up any HTML tags or inline attributes from the localization string | ||
| Line 35: | Line 35: | ||
term = term:gsub("{g:citadel_inline_attribute:'(.-)'}", "%1") | term = term:gsub("{g:citadel_inline_attribute:'(.-)'}", "%1") | ||
table.insert(terms, string.lower(term)) | table.insert(terms, string.lower(term)) | ||
end | end | ||
-- Notice: NO ELSE BLOCK! If it's not in the lang file, we drop it completely. | |||
end | end | ||
if type(v) == "table" then | if type(v) == "table" then | ||
recurse(v) | recurse(v) | ||
end | end | ||
end | end | ||