모듈:연습장/Drhyme/모듈2

--
TODO:
		all non-English text wrapped in ?
		distingush various scripts?  Kanji is ja-Hani ...
		every child infobox should support translit / transcription parameter(s)
		every child infobox should have a literal meaning parameter
		revise parameter names to be IETF language code or obvious derivations thereof
		for error messaging create a separate ibox? else messages are not necessarily visible
require('strict');
local data = mw.loadData ('Module:연습장/Drhyme/모듈3');
local lang_mod = require ('Module:Lang');										-- for various functions and templates provided by Module:Lang
local getArgs = require ('Module:Arguments').getArgs;
----------------------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------------------
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
--showflag= 매개변수를 처리합니다. That template passes the
value to  which calls this function.  This function does not take any frame parameters
but it does require a copy of the frame so that it can expand .  All arguments used by this function
come from the args table in the function call
returns a child infobox or an empty string
local function showflag (frame, args)
	local show_flag = 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 infoboxen are always children
	infobox_args'labelstyle' = 'font-weight:normal';							-- and always have this label style
	if data.transl_mapshow_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_mapshow_flaglabeln then
				break;															-- not found then done
			end
			infobox_argslabeln = data.label_mapdata.transl_mapshow_flaglabeln;	-- add |labeln=
			infobox_argsdatan = argsdata.transl_mapshow_flagdatan;		-- add |datan=
			i = i + 1;															-- bump to next label / data pair
		end
	else
		return ;																-- |showflag= value invalid; TODO: return error message?
	end
	
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
	end
--------------------------------------------------------------------
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
--datan=; in this application i continually
		increments; there are no gaps as there are in the original template
	lang - language code used by  - 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.xscriptidx.header;			-- if headers are displayed
	i = i + 1;																	-- bump the enumerator
	for _, v in ipairs (data.xscriptidx.t) do									-- each label / data pair in the xscript subtable
		i = add_label_data_pair (infobox_args, v1, is_set (argsv2) and lang_mod._transl ({lang, argsv2, italic = 'no'}), i);	-- enumerator is bumped here
	end
	
	return i;																	-- and done
end
------------------------------------------------------------------------
transcriptions support for .  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
------------------------------------------------------------------------------
This function handles the transcription infobox called by various .  Creates header and
label / data pairs according to the presence of certain parameters provided to 
local function transcriptions (frame, args, lang)
	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()
	local i = 1;																-- enumerator used with  
datan= parameters
	if show then
		infobox_args'subbox' = 'yes';
		infobox_args'above' = '발음기호';
	else
		infobox_args'child' = 'yes';
	end
	
	infobox_args'bodyclass' = 'collapsible collapsed';
	infobox_args'bodystyle' = 'display:inline-table; text-align: left;';
	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.keyslang, show, i, lang);			
	end
	return frame:expandTemplate ({title='Infobox', args = infobox_args});		-- render the infobox and done
	end
--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 / or function?
	end
	
	infobox_args'headerstyle' = 'background-color: ' ..  h_color .. ';';
	
	if is_set (args.fontstyle) then												-- ???? |fontstyle= not a documented parameter; supported by  and 
		infobox_args'labelstyle' = 'font-weight:' .. fontstyle .. ';';
	else
		infobox_args'labelstyle' = 'font-weight:normal;';
	end
	
end
------------------------------------------------------------------------------------
bypasses 
Module entry point
local function ibox_mln_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 '중국어';
	end
	local i = 2;
	
	i = add_label_data_pair (infobox_args, '중국어', 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, '간체자', is_set (args.s) and lang_mod._lang ({'zh-Hans', args.s, size = '1rem'}), i)
		i = add_label_data_pair (infobox_args, '정체자', is_set (args.t) and lang_mod._lang ({'zh-Hant', args.t, size = '1rem'}), i)
	else
		i = add_label_data_pair (infobox_args, '정체자', is_set (args.t) and lang_mod._lang ({'zh-Hant', args.t, size = '1rem'}), i)
		i = add_label_data_pair (infobox_args, '간체자', 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  to 
		i = add_label_data_pair (infobox_args, '파스파 문자', frame:expandTemplate ({title='Phagspa', args = {'h', args.phagspa, args'phagspa-latin', size = 12}}), i)
	end
	infobox_args'data' .. i = showflag (frame, args);							-- 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, '우정식 병음', is_set (args.psp) and args.psp or nil, i)
	i = add_label_data_pair (infobox_args, '의미', 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'중국어', args.t, args.p, args.s, args.phagspa}) then			-- ???? phagspa not passed into   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
	
------------------------------------------------------------------------------------
implements 
Module entry point
Template:Infobox_Arabic_term/testcases
TODO: standardize on lowercase parameter names for transcriptions
local function ibox_mln_ar (frame, args)
	if not args then
		args = getArgs (frame);													--, {removeBlanks = false}?
	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 '아랍어';
	end
	
	local i = 2;
	i = add_label_data_pair (infobox_args, '아랍어', is_set (args.arabic) and args.arabic or nil, i)
	i = add_label_data_pair (infobox_args, '로마자', is_set (args.arabic_rom) and args.arabic_rom or nil, i)
	i = add_label_data_pair (infobox_args, 'IPA', is_set (args.arabic_ipa) and args.arabic_ipa or nil, i)
	i = add_label_data_pair (infobox_args, '의미', 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
------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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_tag = lang_mod._is_ietf_tag (args.lang);
	local name_from_tag = ietf_tag and lang_mod._name_from_tag ({args.lang}) or nil;
	if 'none' ~= args.lang_hdr and 'none' ~= args.header and 'none' ~= args.blank_header then
		if is_set (args.lang_hdr) or is_set (args.header) or is_set (args.blank_header) then				-- if one of these
			infobox_args'header1' = args.lang_hdr or args.header or args.blank_header;			-- make a header from it
		elseif ietf_tag then
			infobox_args'header1' = name_from_tag .. ;				-- make a header from the language name
		else
			infobox_args'header1' = args.lang .. ;						-- not a code so use whatever text is in 
		end
	end
	
	local i = 2;
	local label;
	local data;
	
	if name_from_tag then
		if is_set (args.lang_article) then
			label = table.concat ({												-- make a linked label from provided article name
				,
				args.lang_label or name_from_tag,
				
				});
		else
			label = args.lang_label or lang_mod._name_from_tag ({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_label or args.lang;									-- fall back
		data = args.lang_content;
	end
	
	i = add_label_data_pair (infobox_args, label, data, i);
	if is_set (args.lang_rom) and ietf_tag then
		i = add_label_data_pair (infobox_args, args.lang_std or '로마자', lang_mod._transl ({args.lang, args.lang_rom}), i);
	end
	i = add_label_data_pair (infobox_args, 'IPA', args.lang_ipa, i);
	i = add_label_data_pair (infobox_args, '의미', args.lang_lit, i);
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '티베트어';
	end
	
	local i = 2;
	i = add_label_data_pair (infobox_args, '티베트 문자', 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, '의미', 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
----------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '둥간어 이름';
	end
	
	local i = 2;
	i = add_label_data_pair (infobox_args, '둥간어', is_set (args.dungan) and args.dungan or nil, i)
	i = add_label_data_pair (infobox_args, '샤오얼징', is_set (args'dungan-xej') and args'dungan-xej' or nil, i)
	i = add_label_data_pair (infobox_args, '로마자', is_set (args'dungan-latin') and args'dungan-latin' or nil, i)
	i = add_label_data_pair (infobox_args, '한자', is_set (args'dungan-han') and args'dungan-han' or nil, i)
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
--------------------------------------------------------------------------
implements 
Module entry point
Template:Infobox Hokkien name/testcases
local function ibox_mln_hokkien (frame, args)
	if not args then
		args = getArgs (frame);													--, {removeBlanks = false}?
	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 '복건화';
	end
	
	local i = 2;
	
	i = add_label_data_pair (infobox_args, '한자', is_set (args.hanji) and lang_mod._lang ({'nan', args.hanji, size = '115%'}) or nil, i);
	i = add_label_data_pair (infobox_args, '백화자', 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, '의미', is_set (args.lm) and args.lm or nil, i)
	if show then
		if any_set ({args.tl, args.bp, args.hokkienipa}) 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, '대로 병음', is_set (args.tl) and args.tl or nil, i)
		i = add_label_data_pair (infobox_args, '민남 병음', is_set (args.bp) and args.bp or nil, i)
		i = add_label_data_pair (infobox_args, 'IPA', is_set (args.hokkienipa) and args.hokkienipa or nil, i)
	end
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '일본어';
	end
	
	local i = 2;
	
	i = add_label_data_pair (infobox_args, '간지', is_set (args.kanji) and lang_mod._lang ({'ja', args.kanji}) or nil, i)
	i = add_label_data_pair (infobox_args, '가나', is_set (args.kana) and lang_mod._lang ({'ja', args.kana}) or nil, i)
	i = add_label_data_pair (infobox_args, '히라가나', is_set (args.hiragana) and lang_mod._lang ({'ja', args.hiragana}) or nil, i)
	i = add_label_data_pair (infobox_args, '가타카나', is_set (args.katakana) and lang_mod._lang ({'ja', args.katakana}) or nil, i)
	i = add_label_data_pair (infobox_args, '구자체', is_set (args.kyujitai) and lang_mod._lang ({'ja', args.kyujitai}) or nil, i)
	i = add_label_data_pair (infobox_args, '신자체', is_set (args.shinjitai) and lang_mod._lang ({'ja', args.shinjitai}) or nil, i)
	i = add_label_data_pair (infobox_args, '의미', is_set (args.lja) and lang_mod._lang ({'ja', args.lja}) 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
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '한국어';
	end
	
	local i = 2;
	
	if 'yes' == args.northkorea then
		i = add_label_data_pair (infobox_args, '조선글', 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, '훈민정음', is_set (args.hangul) and lang_mod._lang ({'ko', args.hangul, size = '1rem'}) or nil, i)
	else
		i = add_label_data_pair (infobox_args, '한글', 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, '한자', is_set (args.hanja) and lang_mod._lang ({'ko', args.hanja, size = '1rem'}) or nil, i)
	else
		i = add_label_data_pair (infobox_args, '한자', is_set (args.hanja) and lang_mod._lang ({'ko', args.hanja, size = '1rem'}) or nil, i)
	end
	
	i = add_label_data_pair (infobox_args, '의미', 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, '로마자', is_set (args.rr) and lang_mod._transl ({'ko', 'rr', args.rr}) or nil, i)
		i = add_label_data_pair (infobox_args, '매큔-라이샤워', is_set (args.mr) and lang_mod._transl ({'ko', 'mr', args.mr}) or nil, i)
		i = add_label_data_pair (infobox_args, 'IPA', is_set (args.koreanipa) and args.koreanipa or nil, i)
	end
	
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '몽골어';
	end
	
	local i = 2;
	
	i = add_label_data_pair (infobox_args, '몽골식 키릴 문자',
		is_set (args.mon) and lang_mod._lang ({'mn', args.mon}) or nil, i)
--	i = add_label_data_pair (infobox_args, '몽골어',	-- 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, '몽골 문자',
		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
----------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '만주어';
	end
	
	local i = 2;
	
	i = add_label_data_pair (infobox_args, '만주 문자', is_set (args.mnc) and frame:expandTemplate ({title='ManchuSibeUnicode', args = {lang='mnc', args.mnc}}) or nil, i)
	i = add_label_data_pair (infobox_args, '로마자', is_set (args.mnc_rom) and args.mnc_rom or nil, i)
	i = add_label_data_pair (infobox_args, '압카이', is_set (args.mnc_a) and args.mnc_a or nil, i)
	i = add_label_data_pair (infobox_args, '뭴렌도르프', is_set (args.mnc_v) and args.mnc_v or nil, i)
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '버마어';
	end
	
	local i = 2;
	i = add_label_data_pair (infobox_args, '버마어', is_set (args.my) and args.my or nil, i)
	i = add_label_data_pair (infobox_args, 'IPA', is_set (args.bi) and args.bi or nil, i)
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_ru (frame, args)
	if not args then
		args = getArgs (frame);
	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 '러시아어';
	end
	
	local i = 2;
	
	i = add_label_data_pair (infobox_args, '러시아어', is_set (args.rus) and lang_mod._lang ({'ru', args.rus}) or nil, i);
	i = add_label_data_pair (infobox_args, '로마자', 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, 'IPA', is_set (args.rusipa) and args.rusipa or nil, i);
	i = add_label_data_pair (infobox_args, '의미', 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
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '태국어';
	end
	
	local i = 2;
	i = add_label_data_pair (infobox_args, '태국어', (is_set (args.th) or is_set (args.tha)) and lang_mod._lang ({'th', args.th or args.tha}) or nil, i)
	i = add_label_data_pair (infobox_args, 'RTGS', is_set (args.rtgs) and lang_mod._transl ({'th', 'rtgs', args.rtgs}) or nil, i)
	i = add_label_data_pair (infobox_args, '로마자', is_set (args.rom) and lang_mod._transl ({'th', args.rom}) or nil, i)
	i = add_label_data_pair (infobox_args, 'IPA', is_set (args.ipa) and args.ipa, i)
	i = add_label_data_pair (infobox_args, '의미', is_set (args.lit) and args.lit, i)
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '위구르어';
	end
	
	local i = 2;
	
	i = add_label_data_pair (infobox_args, '위구르어', is_set (args.uig) and frame:expandTemplate ({title='ug-textonly', args = {args.uig}}) or nil, i)
	i = add_label_data_pair (infobox_args, '의미', 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
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '베트남어';
	end
	
	local i = 2;
	i = add_label_data_pair (infobox_args, '베트남어', is_set (args.vie) and lang_mod._lang ({'vi', args.vie}) or nil, i)
	i = add_label_data_pair (infobox_args, '쯔 꾸옥 응으', is_set (args.qn) and lang_mod._lang ({'vi', args.qn}) or nil, i)
	i = add_label_data_pair (infobox_args, '한놈', is_set (args.hn) and lang_mod._lang ({'vi-Hani', args.hn}) or nil, i)
	i = add_label_data_pair (infobox_args, '쯔한', is_set (args.chuhan) and lang_mod._lang ({'vi-Hani', args.chuhan}) or nil, i)
	i = add_label_data_pair (infobox_args, '쯔놈', is_set (args.chunom) and lang_mod._lang ({'vi-Hani', args.chunom}) or nil, i)
	i = add_label_data_pair (infobox_args, '의미', is_set (args.lqn) and args.lqn or nil, i)
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
------------------------------------------------------------------------------------
implements 
Module entry point
local function ibox_mln_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 '좡어';
	end
	
	local i = 2;
	i = add_label_data_pair (infobox_args, '좡어', is_set (args.zha) and ( .. args.zha .. ) or nil, i)
	i = add_label_data_pair (infobox_args, '1957 철자법', is_set (args.zha57) and args.zha57 or nil, i)
	i = add_label_data_pair (infobox_args, '방괴장자', is_set (args.sd) and args.sd or nil, i)
	return frame:expandTemplate ({title='Infobox', args = infobox_args});
end
----------------------------------------------------------------------------
bypasses 
Module entry point
local function ibox_mln_header (frame, args)
	if not args then
		args = getArgs (frame);
	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	
----------------------------------------------------------------------------
bypasses 
Module entry point
local function ibox_mln_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
-------------------------------------------------------
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 argsv .. i then													-- only when there is an assigned value
			ibox_argsv = argsv .. 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
------------------------------------------------------------------------------------------------------
--------
local function ar (frame, args)
	if is_set ({args.arabic, args.arabic_rom, args.arabic_ipa, args.arabic_lit}) then
		local ibox_args = {
			'arabic_header' = args'arabic_header' or '아랍어',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'arabic' = args.arabic,
			'arabic_rom' = args.arabic_rom,
			'arabic_ipa' = args.arabic_ipa,
			'arabic_lit' = args.arabic_lit or args'literal meaning',		-- 'literal meaning' is from ; itis param name a good idea?  TODO: unify parameter names
			'chat' = args.chat or args.Chat,									-- TODO: unify parameter names
			'ala-lc' = args'ala-lc' or args'ALA-LC',						-- TODO: unify parameter names
			'iso' = args.iso or args.ISO,										-- TODO: unify parameter names
			'din' = args.din or args.DIN										-- TODO: unify parameter names
			}
			
		return ibox_mln_ar (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function as (frame, args)
	if args.as or args.asm then
		local ibox_args = {
			'lang_hdr' = args'as-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'as',
			'lang_content' = args.as or args.asm,
			'lang_ipa' = args'as-ipa',
			'lang_rom' = args'as-rom',
			'lang_std' = args'as-std',
			'lang_lit' = args'as-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function bn (frame, args)
	if args.bn or args.ben then
		local ibox_args = {
			'lang_hdr' = args'bn-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'bn',
			'lang_content' = args.bn or args.ben,
			'lang_ipa' = args'bn-ipa',
			'lang_rom' = args'bn-rom',
			'lang_std' = args'bn-std',
			'lang_lit' = args'bn-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function bo (frame, args)
	if any_set ({args.tib, args.wylie, args.thdl, args.zwpy, args.lhasa}) then
		local ibox_args = {
			'tibetan_header' = args'tibetan_header' or '티베트어',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'hide' = args.hide,
			'tib' = args.tib,
			'wylie' = args.wylie,
			'thdl' = args.thdl,
			'zwpy' = args.zwpy,
			'lhasa' = args.lhasa,
			}
			
		return ibox_mln_bo (frame, ibox_args);
	end
end
----------------------------------------------------------------------------------------------------
--------
local function dng (frame, args)
	if any_set ({args.dungan, args'dungan-xej', args'dungan-han'}) then
		local ibox_args = {
			'dunganese_header' = args'dunganese_header' or '둥간어',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'dungan' = args.dungan,
			'dungan-xej' = args'dungan-xej',
			'dungan-han' = args'dungan-han',
			'dungan-latin' = args'dungan-latin',
			}
			
		return ibox_mln_dng (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function hi (frame, args)
	if args.hi or args.hin then
		local ibox_args = {
			'lang_hdr' = args'hi-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'hi',
			'lang_content' = args.hi or args.hin,
			'lang_ipa' = args'hi-ipa',
			'lang_rom' = args'hi-rom',
			'lang_std' = args'hi-std',
			'lang_lit' = args'hi-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function id (frame, args)
	if args.id or args.ind then
		local ibox_args = {
			'lang_hdr' = args'id-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'id',
			'lang_content' = args.id or args.ind,
			'lang_ipa' = args'id-ipa',
			'lang_rom' = args'id-rom',
			'lang_std' = args'id-std',
			'lang_lit' = args'id-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function ja (frame, args)
	local children = {};
	if any_set ({args.kanji, args.kana, args.hiragana, args.katakana, args.kyujitai, args.shinjitai, args.lja}) then
		local ibox_args = {
			'japanese_header' = args'japanese_header' or '일본어',
			'headercolor' = args'child-hdr-color' or 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,
			'lja' = args.lja
			}
			
		table.insert (children, ibox_mln_ja (frame, ibox_args));
	end
	for i=2, 6 do
		if any_set ({args'kanji'..i, args'kana'..i, args'hiragana'..i, args'katakana'..i, args'kyujitai'..i, args'shinjitai'..i, args'lja'..i}) then
			local ibox_args = {
				'japanese_header' = args'japanese_header'..i or '대체 일본어',
				'headercolor' = args'child-hdr-color' or args.headercolor,
				'hide' = args.hide,
				'kanji' = args'kanji'..i,
				'kyujitai' = args'kyujitai'..i,
				'shinjitai' = args'shinjitai'..i,
				'kana' = args'kana'..i,
				'hiragana' = args'hiragana'..i,
				'katakana' = args'katakana'..i,
				'romaji' = args'romaji'..i,
				'revhep' = args'revhep'..i,
				'tradhep' = args'tradhep'..i,
				'kunrei' = args'kunrei'..i,
				'nihon' = args'nihon'..i,
				'lja' = args'lja'..i
				}
				
			table.insert (children, ibox_mln_ja (frame, ibox_args));
		end
	end
	return table.concat (children) or ;										-- big string of ja infoboxen or an empty string if nothing was done here
end
------------------------------------------------------------------------------------------------------
--------
local function km (frame, args)
	if args.km or args.khm then
		local ibox_args = {
			'lang_hdr' = args'km-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'km',
			'lang_content' = args.km or args.khm,
			'lang_ipa' = args'km-ipa',
			'lang_rom' = args'km-rom',
			'lang_std' = args'km-std',
			'lang_lit' = args'km-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
----------------------------------------------------------------------------------------------------
TODO: handle ko same way as enumerated zh?
--------
local function ko1 (frame, args)	
	local children = {};
	if any_set ({args.hanja, args.hangul}) then
		local ibox_args = {
			'korean_header' = args'korean_header' or '한국어',									
			'headercolor' = args'child-hdr-color' or 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_mln_ko (frame, ibox_args));
	end
	for i=2, 6 do
		if any_set ({args'hanja'..i, args'hangul'..i}) then
			local ibox_args = {
				'korean_header' = args'korean_header'..i or '대체 한국어',									
				'headercolor' = args'child-hdr-color' or args.headercolor,
				'hide' = args'hide',
				'hangul' = args'hangul'..i,
				'hanja' = args'hanja'..i,
				'rr' = args'rr'..i,
				'mr' = args'mr'..i,
				'northkorea' = args'northkorea'..i,
				'lk' = args'lk'..i,
				}
				
			table.insert (children, ibox_mln_ko (frame, ibox_args));
		end
	end
	return table.concat (children) or ;				
end
----------------------------------------------------------------------------------------------------
TODO: handle ko same way as enumerated zh?
--------
local function ko2 (frame, args)
	local children = {};
	if any_set ({args.cnhanja, args.cnhangul}) then
		local ibox_args = {
			'korean_header' = args'cnkorean_header' or '중국조선말',									
			'headercolor' = args'child-hdr-color' or 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_mln_ko (frame, ibox_args));
	end
	for i=2, 6 do
		if any_set ({args'cnhanja'..i, args'cnhangul'..i}) then
			local ibox_args = {
				'korean_header' = args'cnkorean_header'..i or '대체 중국조선말',									
				'headercolor' = args'child-hdr-color' or args.headercolor,
				'hide' = args'hide',
				'hangul' = args'cnhangul'..i,
				'hanja' = args'cnhanja'..i,
				'rr' = args'cnrr'..i,
				'mr' = args'cnmr'..i,
				'northkorea' = 'yes',
				'lk' = args'cnlk'..i,
				}
				
			table.insert (children, ibox_mln_ko (frame, ibox_args));
		end
	end
	return table.concat (children) or ;		
end
----------------------------------------------------------------------------------------------------
TODO: handle ko same way as enumerated zh?
--------
local function ko3 (frame, args)
	local children = {};
	if any_set ({args.nkhanja, args.nkhangul}) then
		local ibox_args = {
			'korean_header' = args'nkkorean_header' or '북조선말',									
			'headercolor' = args'child-hdr-color' or 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_mln_ko (frame, ibox_args));
	end
	for i=2, 6 do
		if any_set ({args'nkhanja'..i, args'nkhangul'..i}) then
			local ibox_args = {
				'korean_header' = args'nkkorean_header'..i or '대체 북조선말',									
				'headercolor' = args'child-hdr-color' or args.headercolor,
				'hide' = args'hide',
				'hangul' = args'nkhangul'..i,
				'hanja' = args'nkhanja'..i,
				'rr' = args'nkrr'..i,
				'mr' = args'nkmr'..i,
				'northkorea' = 'yes',
				'lk' = args'nklk'..i,
				}
				
			table.insert (children, ibox_mln_ko (frame, ibox_args));
		end
	end
	return table.concat (children) or ;									
end
----------------------------------------------------------------------------------------------------
TODO: handle ko same way as enumerated zh?
--------
local function ko4 (frame, args)
	local children = {};
	if any_set ({args.skhanja, args.skhangul}) then
		local ibox_args = {
			'korean_header' = args'skkorean_header' or '남한어 이름',									
			'headercolor' = args'child-hdr-color' or 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_mln_ko (frame, ibox_args));
	end
	for i=2, 6 do
		if any_set ({args'skhanja'..i, args'skhangul'..i}) then
			local ibox_args = {
				'korean_header' = args'skkorean_header'..i or '대체 남한어',									
				'headercolor' = args'child-hdr-color' or args.headercolor,
				'hide' = args'hide',
				'hangul' = args'skhangul'..i,
				'hanja' = args'skhanja'..i,
				'rr' = args'skrr'..i,
				'mr' = args'skmr'..i,
				'northkorea' = nil,
				'lk' = args'sklk'..i,
				}
				
			table.insert (children, ibox_mln_ko (frame, ibox_args));
		end
	end
	return table.concat (children) or ;			
end
------------------------------------------------------------------------------------------------------
--------
local function lo (frame, args)
	if args.lo or args.lao then
		local ibox_args = {
			'lang_hdr' = args'lo-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'lo',
			'lang_content' = args.lo or args.lao,
			'lang_ipa' = args'lo-ipa',
			'lang_rom' = args'lo-rom',
			'lang_std' = args'lo-std',
			'lang_lit' = args'lo-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function mn (frame, args)
	if any_set ({args.mong, args.mon}) then
		local ibox_args = {
			'mongolian_header' = args'mongolian_header' or '몽골어',						
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'hide' = args.hide,
			'mon' = args.mon,
			'mong' = args.mong,
			'monr' = args.monr,
			}
			
		return ibox_mln_mn (frame, ibox_args);
	end
end
----------------------------------------------------------------------------------------------------
--------
local function mnc (frame, args)
	if any_set ({args.mnc_rom, args.mnc}) then
		local ibox_args = {
			'manchu_header' = args'manchu_header' or '만주어',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'mnc' = args.mnc,
			'mnc_rom' = args.mnc_rom,
			'mnc_a' = args.mnc_a,
			'mnc_v' = args.mnc_v,
			}
			
		return ibox_mln_mnc (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function ms (frame, args)
	if args.ms or args.msa then
		local ibox_args = {
			'lang_hdr' = args'ms-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'ms',
			'lang_content' = args.ms or args.msa,
			'lang_ipa' = args'ms-ipa',
			'lang_rom' = args'ms-rom',
			'lang_std' = args'ms-std',
			'lang_lit' = args'ms-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function my (frame, args)
	if args.my then
		local ibox_args = {
			'burmese_header' = args'burmese_header' or '버마어',								
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'my' = args.my,
			'bi' = args.bi,
			}
			
		return ibox_mln_my (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function ne (frame, args)
	if args.ne or args.nep then
		local ibox_args = {
			'lang_hdr' = args'ne-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'ne',
			'lang_content' = args.ne or args.nep,
			'lang_ipa' = args'ne-ipa',
			'lang_rom' = args'ne-rom',
			'lang_std' = args'ne-std',
			'lang_lit' = args'ne-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function pi (frame, args)
	if args.pi or args.pli then
		local ibox_args = {
			'lang_hdr' = args'pi-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'pi',
			'lang_content' = args.pi or args.pli,
			'lang_ipa' = args'pi-ipa',
			'lang_rom' = args'pi-rom',
			'lang_std' = args'pi-std',
			'lang_lit' = args'pi-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function pt (frame, args)
	if args.pt or args.por then
		local ibox_args = {
			'lang_hdr' = args'pt-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'pt',
			'lang_lbl' = args'pt-label',
			'lang_content' = args.pt or args.por,
			'lang_ipa' = args'pt-ipa',
			'lang_rom' = args'pt-rom',
			'lang_std' = args'pt-std',
			'lang_lit' = args'pt-lit',
			'lang_lit' = args'pt-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
----------------------------------------------------------------------------------------------------
--------
local function pra (frame, args)
	if args.pra then
		local ibox_args = {
			'lang_hdr' = args'pra-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'pra',
			'lang_content' = args.pra,
			'lang_ipa' = args'pra-ipa',
			'lang_rom' = args'pra-rom',
			'lang_std' = args'pra-std',
			'lang_lit' = args'pra-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function ru (frame, args)
	if any_set ({args.rus, args.russian}) then									-- TODO: unify parameter names
		local ibox_args = {
			'russian_header' = args'russian_header' or '러시아어',		
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'rus' = args.rus or args.russian,
			'rusr' = args.rusr,
			'rusipa' = args.rusipa or args'native pronunciation',			-- TODO: unify parameter names
			'ruslit' = args.ruslit or args'literal meaning',				-- TODO: unify parameter names
			'scientific' = args.scientific,
			'iso' = args.iso,
			'gost' = args.gost,
			'bgn/pcgn' = args'bgn/pcgn',
			}
			
		return ibox_mln_ru (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function sa (frame, args)
	if args.sa or args.san then
		local ibox_args = {
			'lang_hdr' = args'sa-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'sa',
			'lang_content' = args.sa or args.san,
			'lang_ipa' = args'sa-ipa',
			'lang_rom' = args'sa-rom',
			'lang_std' = args'sa-std',
			'lang_lit' = args'sa-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function ta (frame, args)
	if args.ta or args.tam then
		local ibox_args = {
			'lang_hdr' = args'ta-hdr',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'ta',
			'lang_content' = args.ta or args.tam,
			'lang_ipa' = args'ta-ipa',
			'lang_rom' = args'ta-rom',
			'lang_std' = args'ta-std',
			'lang_lit' = args'ta-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
----------------------------------------------------------------------------------------------------
--------
local function tet (frame, args)
	if args.tet then
		local ibox_args = {
			'lang_hdr' = args'tet-hdr' or '테툼어',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'tet',
			'lang_content' = args.tet,
			'lang_ipa' = args'tet-ipa',
			'lang_rom' = args'tet-rom',
			'lang_std' = args'tet-std',
			'lang_lit' = args'tet-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function th (frame, args)
	if args.th or args.tha then
		local ibox_args = {
			'thai_header' = args'thai_header' or '태국어',							
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'header' = args'th-hdr',
			'th' = args.th or args.tha,
			'rtgs' = args.rtgs,
			'ipa' = args'th-ipa',
			'rom' = args'th-rom',
			'std' = args'th-std',
			'lit' = args'th-lit',
			}
		return ibox_mln_th (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function tl (frame, args)
--	if args.tl or args.tgl then
	if args.tgl then
		local ibox_args = {
--			'blank_header' = '필리핀어',
			'lang_hdr' = args'tl-hdr' or '필리핀어',
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = 'tl',
--			'lang_content' = args.tl or args.tgl,								-- tl is used for Taiwanese Romanization System of Hokkien
			'lang_content' = args.tgl,
			'lang_ipa' = args'tl-ipa',
			'lang_rom' = args'tl-rom',
			'lang_std' = args'tl-std',
			'lang_lit' = args'tl-lit',
			}
			
		return ibox_mln_blank (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function ug (frame, args)
	if args.uig then
		local ibox_args = {
			'uyghur_header' = args'uyghur_header' or '위구르어',									
			'headercolor' = args'child-hdr-color' or 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,
			}
			
		return ibox_mln_ug (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------
local function vi (frame, args)
	if any_set ({args.qn, args.vie, args.chuhan}) then
		local ibox_args = {
			'vietnamese_header' = args'vietnamese_header' or '베트남어',							
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'vie' = args.vie,
			'qn' = args.qn,
			'hn' = args.hn,
			'chuhan' = args.chuhan,
			'chunom' = args.chunom,
			'lqn' = args.lqn,
			}
			
		return ibox_mln_vi (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------

local function za (frame, args)
	if args.zha then
		local ibox_args = {
			'zhuang_header' = args'zhuang_header' or '좡어',									
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'hide' = args.hide,
			'zha' = args.zha,
			'zha57' = args.zha57,
			'sd' = args.sd,
			}
			
		return ibox_mln_za (frame, ibox_args);
	end
end
------------------------------------------------------------------------------------------------------
--------------------
local function zh (frame, args)
	local children = {};
	
	if any_set ({args.c, args'중국어', args.t, args'정체자', args'번체자', args.p, args'파스파', 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'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 lang_mod._lang ({'zh-Arab', args.xej});
			if 'yes' == args.child then
				ibox_args'chinese_header' = args'chinese_header' or args.name1;						-- show the header name from parameter or default name from ibox_mln_zh()
			elseif any_set ({													-- when any of these are set there will be other child infoboxen so ...
					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
						ibox_args'chinese_header' = args'chinese_header' or  args.name1;				-- ... show the header name from parameter or default name from ibox_mln_zh()
			else
				ibox_args'chinese_header' = args'chinese_header' or args.name1 or 'none';				-- show the header name from parameter or no header (args.name1 missing or 'empty' - nil)
			end
			ibox_args'headercolor' = args'child-hdr-color' or args.headercolor;
			table.insert (children, ibox_mln_zh (frame, ibox_args));
		end
	end
	
	for i=2, 6 do
		if any_set ({args'c'..i, args'중국어'..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'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 lang_mod._lang ({'zh-Arab', args'xej'..i});
				if argsdata.zh_hdr_namesi1 then
					ibox_args'chinese_header' = argsdata.zh_hdr_namesi1;	-- use value from parameter
				else
					ibox_args'chinese_header' = args'chinese_header'..i or  data.zh_hdr_namesi2;		-- use the default
				end
				ibox_args'headercolor' = args'child-hdr-color' or args.headercolor;
				
				table.insert (children, ibox_mln_zh (frame, ibox_args));
			end
		end
	end
	
	return table.concat (children) or ;										-- big string of zh infoboxen or an empty string if nothing was done here
end
--name1= present with
empty string or whitespace as assigned value)
local function ibox_mln (frame)
	local args = getArgs(frame);												-- also gets parent frame params (there are no frame params for this function) TODO:, {removeBlanks = false}?
	local infobox_args = {};													-- table to hold arguments for ibox_mln frame:expandTemplate()
	local children = {};														-- table of returned infoboxen text
--------------------
	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  (template not magic word)
			'headercolor' = args.headercolor,
			'float' = args.float,
			'collapse' = args.collapse,
			'pic' = args.pic or args.image or args'그림',									-- TODO: unify parameter names
			'picsize' = args.picsize or args.imgwidth or args'그림크기',						-- TODO: unify parameter names
			'picupright' = args.picupright,
			'picalt' = args.picalt,
			'pictooltip' = args.pictooltip,
			'piccap' = args.piccap or args.caption or args'그림설명',							-- TODO: unify parameter names
			'pic2' = args.pic2,
			'picsize2' = args.picsize2,
			'picupright2' = args.picupright2,
			'picalt2' = args.picalt2,
			'pictooltip2' = args.pictooltip2,
			'piccap2' = args.piccap2,
			}
		table.insert (children, ibox_mln_header (frame, hdr_args));
	end
--------------------
	local lang_iboxen = {														-- table of codes used in |ibox-order= and their matching function pointers
		'ar' = ar, 'as' = as, 'bn' = bn, 'bo' = bo, 'dng' = dng,
		'hi' = hi, 'id' = id, 'ja' = ja, 'km' = km, 'ko1' = ko1,
		'ko2' = ko2, 'ko3' = ko3, 'ko4' = ko4, 'lo' = lo, 'mn' = mn,
		'mnc' = mnc, 'ms' = ms, 'my' = my, 'ne' = ne, 'pi' = pi,
		'pra' = pra, 'pt' = pt, 'ru' = ru, 'sa' = sa, 'ta' = ta,
		'tet' = tet, 'th' = th, 'tl' = tl, 'ug' = ug, 'vi' = vi,
		'za' = za, 'zh' = zh
		}
	local lang_ibox_order = {													-- default list of lang ibox calling functions as used by legacy 
		zh, my, bo, dng, vi, th, za, ko1, ko2, ko3, ko4, mn, ja, ms, id, tl,
		 ug, mnc, bn, as, ne, pra, ta, hi, sa, pi, pt, ru, lo, km, tet
		};
	
	if args'ibox-order' then														-- parameter value is comma-separated list of lang iboxen to render and their order
		local t = mw.text.split (args'ibox-order', '%s*,%s*')					-- make a table from the list
		lang_ibox_order = {};													-- reset; don't use default list
		for _, v in ipairs (t) do												-- spin through the lang_ibox_order list in order and 
			if lang_iboxenv then												-- if there is a matching ibox function
				table.insert (lang_ibox_order, lang_iboxenv);					-- add it to the list of functions to call; TODO: error message when specified language does not exist?
			end
		end
	end	
	for _, ibox_func in ipairs (lang_ibox_order) do								-- call each function in the list in the list order
		table.insert (children, ibox_func (frame, args) or );					-- add ibox string (or empty string when there is no ibox string)
	end
--------------------
	local i = 1;																-- blank ibox enumerator
	while args'lang' .. i and (args'lang-content' .. i or args'lang' .. i .. '_content') do		-- for as many ibox blank as there are ...
		local ibox_args = {
			'lang_hdr' = args'lang-hdr' .. i,
			'headercolor' = args'child-hdr-color' or args.headercolor,
			'lang' = args'lang' .. i,
			'lang_label' = args'lang-lbl' .. i,
			'lang_content' = args'lang-content' .. i or args'lang' .. i .. '_content',
			'lang_ipa' = args'lang-ipa' .. i,
			'lang_rom' = args'lang-rom' .. i,
			'lang_std' = args'lang-std' .. i,
			'lang_lit' = args'lang-lit' .. i,
			}
			
		table.insert (children, ibox_mln_blank (frame, ibox_args));
		i = i + 1;																-- bump the enumerator
	end
--------------------
	if 'yes' ~= args.child then
		table.insert (children, ibox_mln_footer (frame, {'footnote' = args.footnote}));
	end
--------------------
	return table.concat (children);												-- concatenate all of the children together into a ginormous string
end
----------------------------------------------------------------------
these not used outside of old :
	ibox_mln_dng = ibox_mln_dng,												-- 
	ibox_mln_mn = ibox_mln_mn,													-- 
	ibox_mln_mnc = ibox_mln_mnc,												-- 
	ibox_mln_my = ibox_mln_my,													-- 
	ibox_mln_th = ibox_mln_th,													-- 
	ibox_mln_ug = ibox_mln_ug,													-- 
	ibox_mln_za = ibox_mln_za,													-- 
these templates require parameter-name unification before they can directly use this module (and avoid the subtemplates):
	 uses:
		
		
	 uses:
		
		
		
		
		
return {
	ibox_mln = ibox_mln,														-- 
	ibox_mln_ar = ibox_mln_ar,													--  (used in Template:Infobox Arabic term)
	ibox_mln_blank = ibox_mln_blank,											-- 
	ibox_mln_bo = ibox_mln_bo,													-- 
	ibox_mln_footer = ibox_mln_footer,											-- 
	ibox_mln_header = ibox_mln_header,											-- 
	ibox_mln_hokkien = ibox_mln_hokkien,										--  (used in Template:Infobox Hokkien name)
	ibox_mln_ja = ibox_mln_ja,													-- 
	ibox_mln_ko = ibox_mln_ko,													-- 
	ibox_mln_ru = ibox_mln_ru,													--  (used in Template:Infobox Russian term)
	ibox_mln_vi = ibox_mln_vi,													--  (used in Template:Infobox Vietnamese)
	ibox_mln_zh = ibox_mln_zh,													-- 
	}