Module:Infobox multi-lingual name
Appearance
![]() | This module depends on the following other modules: |
Implements {{Infobox Chinese}} and some related templates.
--[[
TODO:
all non-English text wrapped in {{lang}}?
distingush various scripts? Kanji is ja-Hani ...
every child infobox should have a literal meaning parameter
revise parameter names to be IETF language code or obvious derivations thereof
]]
require('Module:No globals');
local data = mw.loadData ('Module:Sandbox/trappist the monk/Ibox zh/data');
local lang_mod = require ('Module:Lang/sandbox'); -- for various functions and templates provided my Module:Lang
local getArgs = require ('Module:Arguments').getArgs;
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.
]]
local function is_set( var )
return not (var == nil or var == '');
end
--[[--------------------------< A N Y _ S E T >----------------------------------------------------------------
Returns true if any member of the table is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.
]]
local function any_set (t)
for _, v in pairs (t) do
if is_set (v) then
return true;
end
end
return false;
end
--[[--------------------------< S H O W F L A G >--------------------------------------------------------------
This function handles the |showflags= parameter from the template {{Infobox Chinese}}. That template passes the
value to {{Infobox Chinese/Chinese}} which {{#invoke:}}s this module/function. This function does not take any
frame parameters. All parameters used by this function come from the {{Infobox Chinese/Chinese}} template parent
frame.
This function returns a child infobox or an empty string
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|showflag}}
]]
local function showflag (frame)
local pframe = frame:getParent(); -- there are no frame arguments for this function; all arguments must come from the parent (the template)
local show_flag = pframe.args.showflag;
if not is_set (show_flag) then
return ''; -- |showflag= not set so nothing to do; return empty string
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
infobox_args['child'] = 'yes'; -- showflag infoboen are always children
infobox_args['labelstyle'] = 'font-weight:normal'; -- and always have this label style
if data.transl_map[show_flag] then
local i=1;
while (1) do
local labeln = 'label' .. i; -- make label index that matches |labeln= parameter
local datan = 'data' .. i; -- make data index that matches |datan= parameter
if not data.transl_map[show_flag][labeln] then
break; -- not found then done
end
infobox_args[labeln] = data.label_map[data.transl_map[show_flag][labeln]]; -- add |labeln=<label text / wikilink>
infobox_args[datan] = pframe.args[data.transl_map[show_flag][datan]]; -- add |datan={{{data}}}
i = i + 1; -- bump to next label / data pair
end
else
return ''; -- |showflag= value invlaid; TODO: return error message?
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[--------------------------< A D D _ L A B E L _ D A T A _ P A I R >----------------------------------------
Adds a label parameter and matching data parameter to infobox arguments table; bumps the enumerator on return
]]
local function add_label_data_pair (infobox_args, label, data, i)
if is_set (data) then
infobox_args['label' .. i] = label; -- make an enumerated label parameter
infobox_args['data' .. i] = data; -- make an enumerated data parameter
return i + 1; -- return bumped enumerator
end
return i; -- if here, no data so no need to add label or bump enumerator
end
--[[--------------------------< A D D _ T R A N S C R I P T I O N >--------------------------------------------
This function does that repetative work when assembling the parameter list for {{Infobox}} template
inputs are:
infobox_args - table of infobox parameters
args - args table from the {{#invoke:}} frame
idx - index into xscript table
show - pseudo-boolean (true or nil) header display flag; when true display the header
i - enumerator for {{infobox}} parameters |headern=, |labeln=, |datan=; in this application i continually
increments; there are no gaps as there are in the original template
lang - language code used by {{tlansl}} - must be valid IETF code
returns i for the next time this function is called
]]
local function add_transcription (infobox_args, args, idx, show, i, lang)
infobox_args['header' .. i] = show and data.xscript[idx].header; -- if headers are displayed
i = i + 1; -- bump the enumerator
for _, v in ipairs (data.xscript[idx].t) do -- each label / data pair in the xscript subtable
i = add_label_data_pair (infobox_args, v[1], is_set (args[v[2]]) and lang_mod._transl ({lang, args[v[2]], italic = 'no'}), i); -- enumerator is bumped here
end
return i; -- and done
end
--[[--------------------------< T R A N S C R I P T I O N S _ Z H >--------------------------------------------
transcriptions support for {{Infobox Chinese/Chinese}}. This function adds headers and label data pairs to
infobox_arg table according to which parameters are set
returns the enumerator in case it is needed
]]
local function transcriptions_zh (infobox_args, args, show, i)
if any_set ({args.p, args.bpmf, args.gr, args.w, args.tp, args.myr, args.mps, args.mi}) then
i = add_transcription (infobox_args, args, 'standard mandarin', show, i, 'zh');
end
if any_set ({args.xej, args['zh-dungan'], args.sic}) then
i = add_transcription (infobox_args, args, 'other mandarin', show, i, 'zh');
end
if any_set ({args.wuu, args.lmz, args.ouji, args.suz}) then -- ???? ouji was not included here in original template; why?
i = add_transcription (infobox_args, args, 'wu', show, i, 'wuu');
end
if is_set (args.gan) then
i = add_transcription (infobox_args, args, 'gan', show, i, 'gan');
end
if is_set (args.hsn) then
i = add_transcription (infobox_args, args, 'xiang', show, i, 'hsn');
end
if any_set ({args.h, args.phfs}) then
i = add_transcription (infobox_args, args, 'hakka', show, i, 'hak');
end
if any_set ({args.y, args.ci, args.j, args.sl, args.gd, args.hk, args.mo}) then -- ???? sl, hk, mo not here in original; why?
i = add_transcription (infobox_args, args, 'yue cantonese', show, i, 'yue');
end
if is_set (args.toi) then
i = add_transcription (infobox_args, args, 'other yue', show, i, 'yue');
end
if any_set ({args.poj, args.tl, args.bp, args.teo, args.hain, args.lizu}) then -- ???? bp not here in original; why?
i = add_transcription (infobox_args, args, 'southern min', show, i, 'nan');
end
if is_set (args.buc) then
i = add_transcription (infobox_args, args, 'eastern min', show, i, 'cdo');
end
if is_set (args.hhbuc) then
i = add_transcription (infobox_args, args, 'pu-xian min', show, i, 'cpx');
end
if is_set (args.mblmc) then
i = add_transcription (infobox_args, args, 'northern min', show, i, 'mnp');
end
if is_set (args['phagspa-latin']) then -- phagspa is a script
i = add_transcription (infobox_args, args, 'old mandarin', show, i, 'zh');
end
if any_set ({args.mc, args.emc, args.lmc}) then
i = add_transcription (infobox_args, args, 'middle chinese', show, i, 'ltc');
end
if any_set ({args['oc-b92'], args['oc-bs'], args['oc-zz']}) then
i = add_transcription (infobox_args, args, 'old chinese', show, i, 'och');
end
return i; -- return current state of the enumerator
end
--[[--------------------------< T R A N S C R I P T I O N S >--------------------------------------------------
This function handles the transcription infobox called by various {{Infobox Chinese/xxx}}. Creates header and
label / data pairs according to the presence of certain parameters provided to {{Infobox Chinese}}
]]
local function transcriptions (frame, args, lang)
if not args then
args = frame.args;
end
-- local args = frame.args;
local show = 'no' ~= args.hide or nil; -- make boolean-ish for controlling display of headers; |hide=no means show transcriptions without collapsed header
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
local i = 1; -- enumerator used with {{infobox}} |headern=, |labeln=, and |datan= parameters
if show then
infobox_args['subbox'] = 'yes';
infobox_args['above'] = 'Transcriptions';
else
infobox_args['child'] = 'yes';
end
infobox_args['bodyclass'] = 'collapsible collapsed';
infobox_args['abovestyle'] = 'font-size: 100%; text-align: left; background-color: #f9ffbc;'; -- TODO: #define various colors in a common config location; and function?
infobox_args['headerstyle'] = 'background-color: #dcffc9;'; -- TODO: #define various colors in a common config location; and function?
infobox_args['labelstyle'] = 'font-weight:normal;';
if 'zh' == lang then
transcriptions_zh (infobox_args, args, show, i); -- special case because there are various headers etc
else
add_transcription (infobox_args, args, data.keys[lang], show, i, lang);
end
return frame:expandTemplate ({title='Infobox', args = infobox_args}); -- render the infobox and done
end
--[[--------------------------< I B O X _ B O I L E R P L A T E >----------------------------------------------
boilerplate style settings for the various child infoboxen (not for transcription infoboxen) beause they are
mostly the same child-infobox to child-infobox ({{Infobox Chinese/Korean}} and {{Infobox Chinese/Vietnamese}} excepted)
TODO: |headercolor= is set to its default color in {{Infobox Chinese}}. Better here than there isn't it? less
maintenence headache when a default value is set in only one place; override in the highest level appropriate
but leave the default here. in the higher-level template(s) remove |headercolor= default values
]]
local function ibox_boilerplate (infobox_args, args)
infobox_args['child'] = 'yes';
local h_color;
if is_set (args.headercolor) then
h_color = args.headercolor;
else
h_color = '#b0c4de' -- TODO: #define various colors in a common config location; and function?
end
infobox_args['headerstyle'] = 'background-color: ' .. h_color .. ';';
if is_set (args.fontstyle) then -- ???? |fontstyle= not a documented parameter; supported by {{Infobox Chinese/Korean}} and {{Infobox Chinese/Vietnamese}}
infobox_args['labelstyle'] = 'font-weight:' .. fontstyle .. ';';
else
infobox_args['labelstyle'] = 'font-weight:normal;';
end
end
--[[--------------------------< I B O X _ Z H _ Z H >----------------------------------------------------------
bypasses {{Infobox Chinese/Chinese}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_zh}}
]]
local function ibox_zh_zh (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args)
if 'none' ~= args.header and 'none' ~= args.chinese_header then
infobox_args['header1'] = args.header or args.chinese_header or 'Chinese name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Chinese language|Chinese]]', is_set (args.c) and lang_mod._lang ({'zh-Hani', args.c, size = '1rem'}), i)
if 'st' == args.order then
i = add_label_data_pair (infobox_args, '[[Simplified Chinese characters|Simplified Chinese]]', is_set (args.s) and lang_mod._lang ({'zh-Hans', args.s, size = '1rem'}), i)
i = add_label_data_pair (infobox_args, '[[Traditional Chinese characters|Traditional Chinese]]', is_set (args.t) and lang_mod._lang ({'zh-Hant', args.t, size = '1rem'}), i)
else
i = add_label_data_pair (infobox_args, '[[Traditional Chinese characters|Traditional Chinese]]', is_set (args.t) and lang_mod._lang ({'zh-Hant', args.t, size = '1rem'}), i)
i = add_label_data_pair (infobox_args, '[[Simplified Chinese characters|Simplified Chinese]]', is_set (args.s) and lang_mod._lang ({'zh-Hans', args.s, size = '1rem'}), i)
end
if is_set (args.phagspa) then -- ???? this parameter isn't passed from {{Infobox Chinese}} to {{infobox Chinese/Chinese}}
i = add_label_data_pair (infobox_args, '[[\'Phags-pa script]]', frame:expandTemplate ({title='Phagspa', args = {'h', args.phagspa, args['phagspa-latin'], size = 12}}), i)
end
infobox_args['data' .. i] = showflag (frame); -- needs frame so that it can frame:expandTemplate()
i = i + 1;
-- ???? why is this transliteration here and not part of the transcription list?
i = add_label_data_pair (infobox_args, '[[Chinese postal romanization|Postal]]', is_set (args.psp) and args.psp or nil, i)
i = add_label_data_pair (infobox_args, 'Literal meaning', is_set (args.l) and args.l or nil, i)
if 'no' == args.hide then
infobox_args['rowstyle' .. i] = 'display:none;';
infobox_args['rowcellstyle' .. i] = 'display:none;';
end
if any_set ({args.c, args.t, args.p, args.s, args.phagspa}) then -- ???? phagspa not passed into {{infobox Chinese/Chinese}} Why?
infobox_args['data' .. i] = transcriptions (frame, args, 'zh'); -- needs frame so that it can frame:expandTemplate()
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ A R >----------------------------------------------------------
implements {{Infobox Chinese/Arabic}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_ar}}
Template:Infobox_Arabic_term/testcases
TODO: standardize on lowercase parameter names for transcriptions
]]
local function ibox_zh_ar (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.arabic_header then
infobox_args['header1'] = args.header or args.arabic_header or 'Arabic name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Arabic]]', is_set (args.arabic) and args.arabic or nil, i)
i = add_label_data_pair (infobox_args, '[[Romanization of Arabic|Romanization]]', is_set (args.arabic_rom) and args.arabic_rom or nil, i)
i = add_label_data_pair (infobox_args, '[[Help:IPA for Arabic|IPA]]', is_set (args.arabic_ipa) and args.arabic_ipa or nil, i)
i = add_label_data_pair (infobox_args, 'Literal meaning', is_set (args.arabic_lit) and args.arabic_lit or nil, i)
if any_set ({args.chat, args.Chat, args['ala-lc'], args['ALA-LC'], args.iso, args.ISO, args.din, args.DIN}) then
infobox_args['data' .. i] = transcriptions (frame, args, 'ar'); -- needs frame so that it can frame:expandTemplate()
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ B L A N K >-----------------------------------------------------
implements {{Infobox Chinese/Blank}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_blank}}
TODO: support transl somehow? to accommodate stuff like:
|msa=تيمور جاوء <br/> Timur Jauh
which is bad
]]
local function ibox_zh_blank (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
local ietf_code = lang_mod._is_ietf_code (args.lang);
local name_from_code = ietf_code and lang_mod._name_from_code ({args.lang}) or nil;
if 'none' ~= args.header and 'none' ~= args.blank_header then
if is_set (args.header) or is_set (args.blank_header) then -- if either of these
infobox_args['header1'] = args.header or args.blank_header; -- make a header from them
elseif ietf_code then
infobox_args['header1'] = name_from_code .. ' name'; -- make a header from the language name
else
infobox_args['header1'] = args.lang .. ' name'; -- not a code so use whatever text is in {{{lang}}}
end
end
local i = 2;
local label;
local data;
if name_from_code then
if is_set (args.lang_article) then
label = table.concat ({ -- make a linked label from provided article name
'[[',
args.lang_article,
'|',
name_from_code,
']]'
});
else
label = lang_mod._name_from_code ({args.lang, ['link'] = 'yes'}) -- let lang module make the correct linked label
end
data = lang_mod._lang ({args.lang, args.lang_content});
else
label = args.lang; -- fall back
data = args.lang_content;
end
i = add_label_data_pair (infobox_args, label, data, i)
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ B O >----------------------------------------------------------
implements {{Infobox Chinese/Tibetan}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_bo}}
]]
local function ibox_zh_bo (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.tibetan_header then
infobox_args['header1'] = args.header or args.tibetan_header or 'Tibetan name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Tibetan alphabet|Tibetan]]', is_set (args.tib) and frame:expandTemplate ({title='Bo-textonly', args = {lang = 'bo', args.tib}}) or nil, i)
i = add_label_data_pair (infobox_args, 'Literal meaning', is_set (args.literal_tibetan) and args.literal_tibetan or nil, i)
if any_set ({args.wylie, args.thdl, args.zwpy, args.lhasa}) then
infobox_args['data' .. i] = transcriptions (frame, args, 'bo'); -- needs frame so that it can frame:expandTemplate()
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ D N G >---------------------------------------------------------
implements {{Infobox Chinese/Dunganese}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_dng}}
]]
local function ibox_zh_dng (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.dunganese_header then
infobox_args['header1'] = args.header or args.dunganese_header or 'Dunganese name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Dungan language|Dungan]]', is_set (args.dungan) and args.dungan or nil, i)
i = add_label_data_pair (infobox_args, '[[Xiao\'erjing]]', is_set (args['dungan-xej']) and args['dungan-xej'] or nil, i)
i = add_label_data_pair (infobox_args, '[[Romanization]]', is_set (args['dungan-latin']) and args['dungan-latin'] or nil, i)
i = add_label_data_pair (infobox_args, '[[Hanzi]]', is_set (args['dungan-han']) and args['dungan-han'] or nil, i)
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ H O K K I E N >-------------------------------------------------
implements {{Infobox Chinese/Hokkien}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_hokkien}}
Template:Infobox Hokkien name/testcases
]]
local function ibox_zh_hokkien (frame, args)
if not args then
args = frame.args;
end
local show = 'no' ~= args.hide or nil; -- make boolean-ish for controlling display of headers; |hide=no means show transcriptions without collapsed header
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.hokkien_header then
infobox_args['header1'] = args.header or args.hokkien_header or 'Hokkien name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Hàn-jī]]', is_set (args.hanji) and lang_mod._lang ({'nan', args.hanji, size = '115%'}) or nil, i);
i = add_label_data_pair (infobox_args, '[[Pe̍h-ōe-jī]]', is_set (args.poj) and lang_mod._lang ({'nan', args.poj, size = '115%'}) or nil, i);
i = add_label_data_pair (infobox_args, '[[Hàn-lô]]', is_set (args.hanlo) and lang_mod._lang ({'nan', args.hanlo, size = '115%'}) or nil, i);
i = add_label_data_pair (infobox_args, 'Literal meaning', is_set (args.lm) and args.lm or nil, i)
if show then
if any_set ({args.romaji, args.revhep, args.tradhep, args.kunrei, args.nihon}) then
infobox_args['data' .. i] = transcriptions (frame, args, 'hokkien'); -- needs frame so that it can frame:expandTemplate()
end
else
i = add_label_data_pair (infobox_args, '[[Taiwanese Romanization System|Tâi-lô]]', is_set (args.tl) and args.tl or nil, i)
i = add_label_data_pair (infobox_args, '[[Bbánlám pìngyīm|Bbánpìng]]', is_set (args.bp) and args.bp or nil, i)
i = add_label_data_pair (infobox_args, '[[Help:IPA for Hokkien|IPA]]', is_set (args.hokkienipa) and args.hokkienipa or nil, i)
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ J A >----------------------------------------------------------
implements {{Infobox Chinese/Japanese}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_ja}}
]]
local function ibox_zh_ja (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.japanese_header then
infobox_args['header1'] = args.header or args.japanese_header or 'Japanese name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Kanji]]', is_set (args.kanji) and lang_mod._lang ({'ja', args.kanji}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Kana]]', is_set (args.kana) and lang_mod._lang ({'ja', args.kana}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Hiragana]]', is_set (args.hiragana) and lang_mod._lang ({'ja', args.hiragana}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Katakana]]', is_set (args.katakana) and lang_mod._lang ({'ja', args.katakana}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Kyūjitai]]', is_set (args.kyujitai) and lang_mod._lang ({'ja', args.kyujitai}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Shinjitai]]', is_set (args.shinjitai) and lang_mod._lang ({'ja', args.shinjitai}) or nil, i)
if any_set ({args.romaji, args.revhep, args.tradhep, args.kunrei, args.nihon}) then
infobox_args['data' .. i] = transcriptions (frame, args, 'ja'); -- needs frame so that it can frame:expandTemplate()
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ K O >----------------------------------------------------------
implements {{Infobox Chinese/Korean}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_ko}}
]]
local function ibox_zh_ko (frame, args)
if not args then
args = frame.args;
end
local show = 'no' ~= args.hide or nil; -- make boolean-ish for controlling display of headers; |hide=no means show transcriptions without collapsed header
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.korean_header then
infobox_args['header1'] = args.header or args.korean_header or 'Korean name';
end
local i = 2;
if 'yes' == args.northkorea then
i = add_label_data_pair (infobox_args, '[[Hangul|Chosŏn\'gŭl]]', is_set (args.hangul) and lang_mod._lang ({'ko', args.hangul, size = '1rem'}) or nil, i)
elseif 'old' == args.northkorea then
i = add_label_data_pair (infobox_args, '[[Hunminjeongeum]]', is_set (args.hangul) and lang_mod._lang ({'ko', args.hangul, size = '1rem'}) or nil, i)
else
i = add_label_data_pair (infobox_args, '[[Hangul]]', is_set (args.hangul) and lang_mod._lang ({'ko', args.hangul, size = '1rem'}) or nil, i)
end
if 'yes' == args.northkorea then
i = add_label_data_pair (infobox_args, '[[Hanja|Hancha]]', is_set (args.hanja) and lang_mod._lang ({'ko', args.hanja, size = '1rem'}) or nil, i)
else
i = add_label_data_pair (infobox_args, '[[Hanja]]', is_set (args.hanja) and lang_mod._lang ({'ko', args.hanja, size = '1rem'}) or nil, i)
end
i = add_label_data_pair (infobox_args, 'Literal meaning', is_set (args.lk) and args.lk or nil, i)
if show then
if any_set ({args.mr, args.rr}) then
infobox_args['data' .. i] = transcriptions (frame, args, 'ko'); -- needs frame so that it can frame:expandTemplate()
end
else
i = add_label_data_pair (infobox_args, '[[Revised Romanization of Korean|Revised Romanization]]', is_set (args.rr) and lang_mod._transl ({'ko', 'rr', args.rr}) or nil, i)
i = add_label_data_pair (infobox_args, '[[McCune–Reischauer]]', is_set (args.mr) and lang_mod._transl ({'ko', 'mr', args.mr}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Help:IPA/Korean|IPA]]', is_set (args.koreanipa) and args.koreanipa or nil, i)
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ M N >----------------------------------------------------------
implements {{Infobox Chinese/Mongolian}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_mn}}
]]
local function ibox_zh_mn (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.mongolian_header then
infobox_args['header1'] = args.header or args.mongolian_header or 'Mongolian name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Mongolian Cyrillic script|Mongolian Cyrillic]]',
is_set (args.mon) and lang_mod._lang ({'mn', args.mon}) or nil, i)
-- i = add_label_data_pair (infobox_args, '[[Mongolian language|Mongolian]]', -- TODO: weird construct in original template; is this one required?
-- is_set (args.mong) and lang_mod._lang ({'mn', frame:expandTemplate ({title='MongolUnicode', args = {args.mong}}) }) or nil, i)
i = add_label_data_pair (infobox_args, '[[Mongolian script]]',
is_set (args.mong) and lang_mod._lang ({'mn', frame:expandTemplate ({title='MongolUnicode', args = {args.mong}}) }) or nil, i)
if is_set (args.monr) then
infobox_args['data' .. i] = transcriptions (frame, args, 'mn'); -- needs frame so that it can frame:expandTemplate()
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ M N C >---------------------------------------------------------
implements {{Infobox Chinese/Manchu}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_mnc}}
]]
local function ibox_zh_mnc (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.manchu_header then
infobox_args['header1'] = args.header or args.manchu_header or 'Manchu name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Manchu alphabet|Manchu script]]', is_set (args.mnc) and frame:expandTemplate ({title='ManchuSibeUnicode', args = {lang='mnc', args.mnc}}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Transliterations of Manchu|Romanization]]', is_set (args.mnc_rom) and args.mnc_rom or nil, i)
i = add_label_data_pair (infobox_args, '[[Transliterations of Manchu|Abkai]]', is_set (args.mnc_a) and args.mnc_a or nil, i)
i = add_label_data_pair (infobox_args, '[[Transliterations of Manchu|Möllendorff]]', is_set (args.mnc_v) and args.mnc_v or nil, i)
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ M Y >----------------------------------------------------------
implements {{Infobox Chinese/Burmese}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_my}}
]]
local function ibox_zh_my (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.burmese_header then
infobox_args['header1'] = args.header or args.burmese_header or 'Burmese name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Burmese language|Burmese]]', is_set (args.my) and args.my or nil, i)
i = add_label_data_pair (infobox_args, '[[Wikipedia:IPA_for_Burmese|IPA]]', is_set (args.bi) and args.bi or nil, i)
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ R U >----------------------------------------------------------
implements {{Infobox Chinese/Russian}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_ru}}
]]
local function ibox_zh_ru (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.russian_header then
infobox_args['header1'] = args.header or args.russian_header or 'Russian name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Russian language|Russian]]', is_set (args.rus) and lang_mod._lang ({'ru', args.rus}) or nil, i);
i = add_label_data_pair (infobox_args, '[[Romanization of Russian|Romanization]]', is_set (args.rusr) and lang_mod._lang ({'ru-Latn', args.rusr}) or nil, i); --TODO: use transl instead?
i = add_label_data_pair (infobox_args, '[[Wikipedia:IPA for Russian|IPA]]', is_set (args.rusipa) and args.rusipa or nil, i);
i = add_label_data_pair (infobox_args, 'Literal meaning', is_set (args.ruslit) and args.ruslit or nil, i);
if any_set ({args.scientific, args.Scientific, args.iso, args.ISO, args.gost, args.GOST, args['bgn/pcgn'], args['BGN/PCGN']}) then
infobox_args['data' .. i] = transcriptions (frame, args, 'ru'); -- needs frame so that it can frame:expandTemplate()
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ T H >----------------------------------------------------------
implements {{Infobox Chinese/Thai}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_th}}
]]
local function ibox_zh_th (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.thai_header then
infobox_args['header1'] = args.header or args.thai_header or 'Thai name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Thai language|Thai]]', is_set (args.tha) and lang_mod._lang ({'th', args.tha}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Royal Thai General System of Transcription|RTGS]]', is_set (args.rtgs) and lang_mod._transl ({'th', 'rtgs', args.rtgs}) or nil, i)
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ U G >----------------------------------------------------------
implements {{Infobox Chinese/Uyghur}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_ug}}
]]
local function ibox_zh_ug (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.uyghur_header then
infobox_args['header1'] = args.header or args.uyghur_header or 'Uyghur name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Uyghur language|Uyghur]]', is_set (args.uig) and frame:expandTemplate ({title='ug-textonly', args = {args.uig}}) or nil, i)
i = add_label_data_pair (infobox_args, 'Literal meaning', is_set (args.lu) and args.lu or nil, i)
if any_set ({args.uly, args.uyy, args.sgs, args.usy, args.uipa}) then
infobox_args['data' .. i] = transcriptions (frame, args, 'ug'); -- needs frame so that it can frame:expandTemplate()
end
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ V I >----------------------------------------------------------
implements {{Infobox Chinese/Vietnamese}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_vi}}
]]
local function ibox_zh_vi (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.vietnamese_header then
infobox_args['header1'] = args.header or args.vietnamese_header or 'Vietnamese name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Vietnamese language|Vietnamese]]', is_set (args.vie) and lang_mod._lang ({'vi', args.vie}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Vietnamese alphabet]]', is_set (args.qn) and lang_mod._lang ({'vi', args.qn}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Hán-Nôm]]', is_set (args.hn) and lang_mod._lang ({'vi-Hani', args.hn}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Chữ Hán]]', is_set (args.chuhan) and lang_mod._lang ({'vi-Hani', args.chuhan}) or nil, i)
i = add_label_data_pair (infobox_args, '[[Chữ Nôm]]', is_set (args.chunom) and lang_mod._lang ({'vi-Hani', args.chunom}) or nil, i)
i = add_label_data_pair (infobox_args, 'Literal meaning', is_set (args.lqn) and args.lqn or nil, i)
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ Z A >-----------------------------------------------------------
implements {{Infobox Chinese/Zhuang}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_za}}
]]
local function ibox_zh_za (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
ibox_boilerplate (infobox_args, args);
if 'none' ~= args.header and 'none' ~= args.zhuang_header then
infobox_args['header1'] = args.header or args.zhuang_header or 'Zhuang name';
end
local i = 2;
i = add_label_data_pair (infobox_args, '[[Zhuang language|Zhuang]]', is_set (args.zha) and ('<span style="font-family: Arial Unicode MS, sans-serif;">' .. args.zha .. '</span>') or nil, i)
i = add_label_data_pair (infobox_args, '[[Zhuang language|1957 orthography]]', is_set (args.zha57) and args.zha57 or nil, i)
i = add_label_data_pair (infobox_args, '[[Sawndip]]', is_set (args.sd) and args.sd or nil, i)
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ H E A D E R >---------------------------------------------------
bypasses {{Infobox Chinese/Header}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_header}}
]]
local function ibox_zh_header (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
infobox_args['decat'] = 'yes';
infobox_args['child'] = is_set (args.child) and args.child or 'yes';
infobox_args['bodystyle'] = is_set (args.float) and 'float: left; clear: left; margin: 0 1em 1em 0;' or nil;
infobox_args['bodyclass'] = is_set (args.collapse) and ('collapsible' .. ('yes' == args.collapse and ' collapsed' or '')) or nil;
local h_color;
if is_set (args.headercolor) then
h_color = args.headercolor;
else
h_color = '#b0c4de' -- TODO: #define various colors in a common config location; and function?
end
infobox_args['subheaderstyle'] = 'font-size: 125%; background-color:' .. h_color .. ';';
infobox_args['subheader'] = is_set (args.title) and args.title or mw.title.getCurrentTitle().text;
infobox_args['image'] = frame:callParserFunction ({name = '#invoke:InfoboxImage',
args =
{
'InfoboxImage',
image = args.pic,
sizedefault = 'frameless',
size = args.picsize,
upright = args.picupright,
alt = args.picalt or args.pictooltip
}
});
infobox_args['caption'] = is_set (args.piccap) and args.piccap or nil;
infobox_args['image2'] = frame:callParserFunction ({name = '#invoke:InfoboxImage',
args =
{
'InfoboxImage',
image = args.pic2,
sizedefault = 'frameless',
size = args.picsize2,
upright = args.picupright2,
alt = args.picalt2 or args.pictooltip2
}
});
infobox_args['caption2'] = is_set (args.piccap2) and args.piccap2 or nil;
infobox_args['headerstyle'] = 'background-color:' .. h_color;
infobox_args['headerstyle'] = 'width: 50%; white-space: nowrap';
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H _ F O O T E R >---------------------------------------------------
bypasses {{Infobox Chinese/Footer}}
Module entry point
{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_footer}}
]]
local function ibox_zh_footer (frame, args)
if not args then
args = frame.args;
end
local infobox_args = {}; -- table to hold arguments for frame:expandTemplate()
infobox_args['decat'] = 'yes';
infobox_args['child'] = is_set (args.child) and args.child or 'yes';
infobox_args['bodystyle'] = ''; -- present in wikisource template but not assigned a value there
infobox_args['below'] = args.footnote;
return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--[[-------------------------< I B O X _ Z H Z H _ E N U M _ P A R A M S _ G E T >----------------------------
]]
local function ibox_zhzh_enum_params_get (args, i)
local ibox_args = {};
local count = 0; -- counts how many args got added to ibox_args {}
for _, v in ipairs (data.ibox_zhzh_enum_params) do -- add enumerated parameters
if args[v .. i] then -- only when there is an assigned value
ibox_args[v] = args[v .. i]; -- add
count = count + 1; -- and tally
end
end
return 0 ~= count and ibox_args or nil; -- if table is empty return nil as a flag
end
--[[-------------------------< I B O X _ Z H >----------------------------------------------------------------
implements {{Infobox Chinese}}
]]
local function ibox_zh (frame)
local args = getArgs(frame); -- also gets parent fram params (there are no frame params for this function)
local infobox_args = {}; -- table to hold arguments for ibox_zh frame:expandTemplate()
local children = {}; -- table of returned infoboxen text
----------< H E A D E R >----------
infobox_args['child'] = args.child;
infobox_args['rowstyle1'] = 'display:none;';
if 'yes' ~= args.child then
local hdr_args = {
['title'] = args.title or mw.title.getCurrentTitle().text:gsub ('%s+%b()$', ''); -- mimic {{PAGENAMEBASE}} (template not magic word)
['headercolor'] = args.headercolor,
['float'] = args.float,
['collapse'] = args.collapse,
['pic'] = args.pic,
['picsize'] = args.picsize,
['picupright'] = args.picupright,
['picalt'] = args.picalt,
['pictooltip'] = args.pictooltip,
['piccap'] = args.piccap,
['pic2'] = args.pic2,
['picsize2'] = args.picsize2,
['picupright2'] = args.picupright2,
['picalt2'] = args.picalt2,
['pictooltip2'] = args.pictooltip2,
['piccap2'] = args.piccap2,
}
table.insert (children, ibox_zh_header (frame, hdr_args));
end
----------< C H I N E S E >----------
if any_set ({args.c, args.t, args.p, args.s}) then -- first infobox zh/zh
local ibox_args = ibox_zhzh_enum_params_get (args, ''); -- get the enumerated parameters (here enumerator is empty string)
if ibox_args then
ibox_args['headercolor'] = args.headercolor; -- set non enumerated parameters
ibox_args['hide'] = args.hide;
ibox_args['showflag'] = args.showflag;
ibox_args['order'] = args.order;
ibox_args['p'] = args.p or args.hp; -- add special case parameters
ibox_args['xej'] = args.xej and frame:expandTemplate ({title='lang', args = {'zh-Arab', args.xej}});
if 'yes' == args.child then
ibox_args['chinese_header'] = args.name1;
elseif any_set ({ -- parameters not used in first ibox_zh_zh; why?
args.hangul, args.hanja, args.kana, args.kanji, args.hiragana,
args.katakana, args.kyujitai, args.shinjitai, args.tam, args.hin,
args.san, args.pli, args.tgl, args.msa, args.mnc, args.mon, args.mong,
args.por, args.rus, args.tha, args.tib, args.qn, args.uig, args.vie,
args.chuhan, args.chunom, args.hn, args.zha, args['dungan-xej'],
args.dungan, args.lao, args.khm, args.tet, args.lang1, args.lang2,
args.lang3, args.lang4, args.lang5, args.lang6, args.lang7, args.lang8,
args.lang9, args.lang10, args.lang11,
}) then
if any_set ({args.c, args.t, args.p, args.s}) then
ibox_args['chinese_header'] = args.name1;
end
else
ibox_args['chinese_header'] = 'none'; -- TODO: this isn't how the template accomplishes no-header when only zh params
end
table.insert (children, ibox_zh_zh (frame, ibox_args));
end
end
for i=2, 6 do
if any_set ({args['c'..i], args['t'..i], args['p'..i], args['s'..i]}) then
local ibox_args = ibox_zhzh_enum_params_get (args, i); -- get the enumerated parameters
if ibox_args then
ibox_args['headercolor'] = args.headercolor; -- set non enumerated parameters
ibox_args['hide'] = args.hide;
ibox_args['showflag'] = args.showflag;
ibox_args['order'] = args.order;
ibox_args['p'] = args['p'..i] or args['hp'..i]; -- add special case parameters
ibox_args['xej'] = args['xej'..i] and frame:expandTemplate ({title='lang', args = {'zh-Arab', args['xej'..i]}});
if args[data.zh_hdr_names[i][1]] then
ibox_args['chinese_header'] = args[data.zh_hdr_names[i][1]]; -- use value from parameter
else
ibox_args['chinese_header'] = data.zh_hdr_names[i][2]; -- use the default
end
table.insert (children, ibox_zh_zh (frame, ibox_args));
end
end
end
----------< N O N - C H I N E S E L A N G U A G E S >----------
----< B U R M E S E >----
if args.my then
local ibox_args = {
['burmese_header'] = 'Burmese name', -- redundant; TODO: support |burmese_header=
['headercolor'] = args.headercolor,
['my'] = args.my,
['bi'] = args.bi,
}
table.insert (children, ibox_zh_my (frame, ibox_args));
end
----< T I B E T A N >----
if any_set ({args.tib, args.wylie, args.thdl, args.zwpy, args.lhasa}) then
local ibox_args = {
['tibetan_header'] = args.tib and 'Tibetan name', -- redundant; TODO: support |burmese_header=
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['tib'] = args.tib,
['wylie'] = args.wylie,
['thdl'] = args.thdl,
['zwpy'] = args.zwpy,
['lhasa'] = args.lhasa,
}
table.insert (children, ibox_zh_bo (frame, ibox_args));
end
----< D U N G A N E S E >----
if any_set ({args.dungan, args['dungan-xej'], args['dungan-han']}) then
local ibox_args = {
['dunganese_header'] = 'Dunganese name', -- redundant; TODO: support |burmese_header=
['headercolor'] = args.headercolor,
['dungan'] = args.dungan,
['dungan-xej'] = args['dungan-xej'],
['dungan-han'] = args['dungan-han'],
['dungan-latin'] = args['dungan-latin'],
}
table.insert (children, ibox_zh_dng (frame, ibox_args));
end
----< V I E T N A M E S E >----
if any_set ({args.qn, args.vie, args.chuhan}) then
local ibox_args = {
['vietnamese_header'] = 'Vietnamese name', -- redundant; TODO: support |vietnamese_header=
['headercolor'] = args.headercolor,
['vie'] = args.vie,
['qn'] = args.qn,
['hn'] = args.hn,
['chuhan'] = args.chuhan,
['chunom'] = args.chunom,
['lqn'] = args.lqn,
}
table.insert (children, ibox_zh_vi (frame, ibox_args));
end
----< T H A I >----
if args.tha then
local ibox_args = {
['thai_header'] = 'Thai name', -- redundant; TODO: support |thai_header=
['headercolor'] = args.headercolor,
['tha'] = args.tha,
['rtgs'] = args.rtgs,
}
table.insert (children, ibox_zh_th (frame, ibox_args));
end
----< Z H U A N G >----
if args.zha then
local ibox_args = {
['zhuang_header_header'] = 'Zhuang name', -- redundant; TODO: support |zhuang_header=
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['zha'] = args.zha,
['zha57'] = args.zha57,
['sd'] = args.sd,
}
table.insert (children, ibox_zh_za (frame, ibox_args));
end
----< K O R E A N (1) >----
if any_set ({args.hanja, args.hangul}) then
local ibox_args = {
['korean_header'] = 'Korean name', -- redundant; TODO: support |korean_header=
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['hangul'] = args.hangul,
['hanja'] = args.hanja,
['rr'] = args.rr,
['mr'] = args.mr,
['northkorea'] = args.northkorea,
['lk'] = args.lk,
}
table.insert (children, ibox_zh_ko (frame, ibox_args));
end
----< K O R E A N (2) >----
if any_set ({args.cnhanja, args.cnhangul}) then
local ibox_args = {
['korean_header'] = '[[Korean language in China|Chinese Korean]] name',
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['hangul'] = args.cnhangul,
['hanja'] = args.cnhanja,
['rr'] = args.cnrr,
['mr'] = args.cnmr,
['northkorea'] = 'yes',
['lk'] = args.cnlk,
}
table.insert (children, ibox_zh_ko (frame, ibox_args));
end
----< K O R E A N (3) >----
if any_set ({args.nkhanja, args.nkhangul}) then
local ibox_args = {
['korean_header'] = 'North Korean name',
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['hangul'] = args.nkhangul,
['hanja'] = args.nkhanja,
['rr'] = args.nkrr,
['mr'] = args.nkmr,
['northkorea'] = 'yes',
['lk'] = args.nklk,
}
table.insert (children, ibox_zh_ko (frame, ibox_args));
end
----< K O R E A N (4) >----
if any_set ({args.skhanja, args.skhangul}) then
local ibox_args = {
['korean_header'] = 'South Korean name',
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['hangul'] = args.skhangul,
['hanja'] = args.skhanja,
['rr'] = args.skrr,
['mr'] = args.skmr,
['northkorea'] = nil,
['lk'] = args.sklk,
}
table.insert (children, ibox_zh_ko (frame, ibox_args));
end
----< M O N G O L I A N >----
if any_set ({args.mong, args.mon}) then
local ibox_args = {
['mongolian_header'] = 'Mongolian name', -- redundant; TODO: support |mongolian_header=
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['mon'] = args.mon,
['mong'] = args.mong,
['monr'] = args.monr,
}
table.insert (children, ibox_zh_mn (frame, ibox_args));
end
----< J A P A N E S E >----
if any_set ({args.kanji, args.kana, args.hiragana, args.katakana, args.kyujitai, args.shinjitai}) then
local ibox_args = {
['japanese_header'] = 'Japanese name', -- redundant; TODO: support |japanese_header=
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['kanji'] = args.kanji,
['kyujitai'] = args.kyujitai,
['shinjitai'] = args.shinjitai,
['kana'] = args.kana,
['hiragana'] = args.hiragana,
['katakana'] = args.katakana,
['romaji'] = args.romaji,
['revhep'] = args.revhep,
['tradhep'] = args.tradhep,
['kunrei'] = args.kunrei,
['nihon'] = args.nihon,
}
table.insert (children, ibox_zh_ja (frame, ibox_args));
end
----< M A L A Y >----
if args.msa then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'ms',
['lang_content'] = args.msa,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< I N D O N E S I A N >----
if args.ind then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'id',
['lang_content'] = args.ind,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< F I L I P I N O >----
if args.tgl then
local ibox_args = {
['blank_header'] = 'Filipino name',
['headercolor'] = args.headercolor,
['lang'] = 'tl',
['lang_content'] = args.tgl,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< U Y G H U R >----
if args.uig then
local ibox_args = {
['uyghur_header_header'] = 'Uyghur name', -- redundant; TODO: support |uyghur_header_header=
['headercolor'] = args.headercolor,
['hide'] = args.hide,
['uig'] = args.uig,
['lu'] = args.lu,
['uly'] = args.uly,
['uyy'] = args.uyy,
['sgs'] = args.sgs,
['usy'] = args.usy,
['uipa'] = args.uipa,
}
table.insert (children, ibox_zh_ug (frame, ibox_args));
end
----< M A N C H U >----
if any_set ({args.mnc_rom, args.mnc}) then
local ibox_args = {
['manchu_header'] = 'Manchu name', -- redundant; TODO: support |manchu_header=
['headercolor'] = args.headercolor,
['mnc'] = args.mnc,
['mnc_rom'] = args.mnc_rom,
['mnc_a'] = args.mnc_a,
['mnc_v'] = args.mnc_v,
}
table.insert (children, ibox_zh_mnc (frame, ibox_args));
end
----< B E N G A L I >----
if args.ben then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'bn',
['lang_content'] = args.ben,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< A S S A M E S E >----
if args.asm then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'as',
['lang_content'] = args.asm,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< N E P A L I >----
if args.nep then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'ne',
['lang_content'] = args.nep,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< P R A K R I T >----
if args.pra then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'pra',
['lang_content'] = args.pra,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< T A M I L >----
if args.tam then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'ta',
['lang_content'] = args.tam,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< H I N D I >----
if args.hin then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'hi',
['lang_content'] = args.hin,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< S A N S K R I T >----
if args.san then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'sa',
['lang_content'] = args.san,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< P A L I >----
if args.pli then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'pi',
['lang_content'] = args.pli,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< P O R T U G U E S E >----
if args.por then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'pt',
['lang_content'] = args.por,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< R U S S I A N >----
if args.rus then
local ibox_args = {
['russian_header'] = ' name', -- redundant; TODO: support |russian_header=
['headercolor'] = args.headercolor,
['rus'] = args.rus,
['rusr'] = args.rusr,
['rusipa'] = args.rusipa,
['ruslit'] = args.ruslit,
['scientific'] = args.scientific,
['iso'] = args.iso,
['gost'] = args.gost,
['bgn/pcgn'] = args['bgn/pcgn'],
}
table.insert (children, ibox_zh_ru (frame, ibox_args));
end
----< L A O >----
if args.lao then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'lo',
['lang_content'] = args.lao,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< K H M E R >----
if args.khm then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'km',
['lang_content'] = args.khm,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< T E T U M >----
if args.tet then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = 'tet',
['lang_content'] = args.tet,
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
----< B L A N K # >----
for i = 1, 11 do -- loop through 11 (why 11?) 'blanks'
local langn = 'lang'..i; -- make lang parameter name
local langn_content = langn ..'_content'; -- make lang content parameter name
if args[langn_content] then
local ibox_args = {
['headercolor'] = args.headercolor,
['lang'] = args[langn],
['lang_content'] = args[langn_content],
}
table.insert (children, ibox_zh_blank (frame, ibox_args));
end
end
----------< F O O T E R >----------
if 'yes' ~= args.child then
table.insert (children, ibox_zh_footer (frame, {['footnote'] = args.footnote}));
end
----------< R E N D E R >----------
return table.concat (children); -- concatenate all of the children together into a ginormous string
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
ibox_zh = ibox_zh, -- {{infobox Chinese}}
ibox_zh_ar = ibox_zh_ar, -- {{infobox Chinese/Arabic}} (used in Template:Infobox Arabic term)
ibox_zh_blank = ibox_zh_blank, -- {{infobox Chinese/Blank}}
ibox_zh_bo = ibox_zh_bo, -- {{infobox Chinese/Tibetan}}
ibox_zh_dng = ibox_zh_dng, -- {{infobox Chinese/Dunganese}}
ibox_zh_footer = ibox_zh_footer, -- {{infobox Chinese/Footer}}
ibox_zh_header = ibox_zh_header, -- {{infobox Chinese/Header}}
ibox_zh_hokkien = ibox_zh_hokkien, -- {{infobox Chinese/Hokkien}} (used in Template:Infobox Hokkien name)
ibox_zh_ja = ibox_zh_ja, -- {{infobox Chinese/Japanese}}
ibox_zh_ko = ibox_zh_ko, -- {{infobox Chinese/Korean}}
ibox_zh_mn = ibox_zh_mn, -- {{infobox Chinese/Mongolian}}
ibox_zh_mnc = ibox_zh_mnc, -- {{infobox Chinese/Manchu}}
ibox_zh_my = ibox_zh_my, -- {{infobox Chinese/Burmese}}
ibox_zh_ru = ibox_zh_ru, -- {{infobox Chinese/Russian}}
ibox_zh_th = ibox_zh_th, -- {{infobox Chinese/Thai}}
ibox_zh_ug = ibox_zh_ug, -- {{infobox Chinese/Uyghur}}
ibox_zh_vi = ibox_zh_vi, -- {{infobox Chinese/Vietnamese}}
ibox_zh_za = ibox_zh_za, -- {{infobox Chinese/Zhuang}}
ibox_zh_zh = ibox_zh_zh, -- {{infobox Chinese/Chinese}}
}