Module:Wikidata: Difference between revisions

Content deleted Content added
mv loadI18n() to Module:i18n, so other modules can reuse it
Why does the content of the imported Module:i18n need to be commented out?
Line 80:
}
 
--[[]
-- Credit to http://stackoverflow.com/a/1283608/2644759
-- cc-by-sa 3.0
local function tableMerge(t1, t2)
for k,v in pairs(t2) do
if type(v) == "table" then
if type(t1[k] or false) == "table" then
tableMerge(t1[k] or {}, t2[k] or {})
else
t1[k] = v
end
else
t1[k] = v
end
end
return t1
end
 
local function loadI18n()
local exist, res = pcall(require, "Module:Wikidata/i18n")
if exist and next(res) ~= nil then
tableMerge(i18n, res.i18n)
end
end
 
loadI18n()
]]
require("Module:i18n").loadI18n("Module:Wikidata/i18n", i18n)