Open main menu
Home
Random
Log in
Settings
About Wikihussain
Disclaimers
Wikihussain
Search
Editing
Module:I18n
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
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
Summary:
Please note that all contributions to Wikihussain are considered to be released under the Creative Commons Attribution 4.0 (see
Wikihussain:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:I18n/doc
(
edit
)