Content deleted Content added
m QuimGil moved page Module:Sandbox/QuimGil/Flagicon to Module:Sandbox/QuimGil/Flags without leaving a redirect: Final name |
Supporting localization. Now English/default strings are stored in FlagMaster, while all localization is done in FlagTranslations |
||
Line 1:
local p = {}
-- Converts "Flag of" in a variable in order to accept images that don't follow this name schema▼
flagOf = "Flag_of_"▼
-- Loading the flag translations module --
local translations = mw.loadData("Module:Sandbox/QuimGil/FlagTranslations")
local master = mw.loadData("Module:Sandbox/QuimGil/FlagMaster")
▲-- Converts "Flag of" in a variable in order to accept images that don't follow this name schema
▲ flagOf = "Flag_of_"
-- Assigning the parameter to a flag and a link
function p.flag(territory)
-- Searching in the
-- 2 letter code search
if #territory.args[1] == 2 then
for english,locale in pairs(
if territory.args[1] == locale then
commonsName = english
Line 23 ⟶ 24:
-- 3 letter code search
if #territory.args[1] == 3 then
for english,locale in pairs(
if territory.args[1] == locale then
commonsName = english
Line 31 ⟶ 32:
end
-- Searching in both tables
-- Full name search
for k,v in ipairs(flagTables) do
for english,locale in pairs(v)
commonsName = english
link = locale
end
end
end
-- In the absence of translation for an existing entry, links to the english/original name --
if commonsName ~= nil and link == '' then
|