Notice: Firmware Links Under Maintenance We are currently undergoing maintenance on all firmware links. If any links are inaccessible, please email or contact Tech Support for the firmware. We appreciate your patience during the maintenance, thank you for your understanding.
Module:I18n
Revision as of 14:08, 24 January 2019 by Galobtter (talk) (Changed protection level for "Module:I18n": High-risk Lua module: 800000+ transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)))
Documentation for this module may be created at Module:I18n/doc
Script error: Lua error: Internal error: The interpreter exited with status 127.
local p = {} -- Credit to http://stackoverflow.com/a/1283608/2644759 -- cc-by-sa 3.0 local function tableMerge(t1, t2, overwrite) for k,v in pairs(t2) do if type(v) == "table" and type(t1[k]) == "table" then -- since type(t1[k]) == type(v) == "table", so t1[k] and v is true tableMerge(t1[k], v, overwrite) -- t2[k] == v else if overwrite or t1[k] == nil then t1[k] = v end end end return t1 end function p.loadI18n(name, i18n_arg) local exist, res = pcall(require, name) if exist and next(res) ~= nil then if i18n_arg then tableMerge(i18n_arg, res.i18n, true) elseif type(i18n) == "table" then -- merge to global i18n tableMerge(i18n, res.i18n, true) end end end function p.loadI18nFrame(frame, i18n_arg) p.loadI18n(frame:getTitle().."/i18n", i18n_arg) end return p