Jump to content

Module:Infobox multi-lingual name

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Trappist the monk (talk | contribs) at 16:47, 5 January 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

require('Module:No globals');

--[[--------------------------< 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


--[[--------------------------< L A B E L _ M A P >------------------------------------------------------------

Table to map |showflags= value to the |labeln= parameter value for {{Infobox}}

]]
 
local label_map = {
	['bp'] = '[[Bbánlám pìngyīm|Bbánlám Pìngyīm]]',
	['bpmf'] = '[[Bopomofo]]',
	['gan'] = '[[Gan Chinese|Gan]]',
	['h'] = '[[Guangdong Romanization#Hakka|Hakka]]',
	['hsn'] = '[[Xiang Chinese|Xiang]]',
	['j'] = '[[Cantonese]] [[Jyutping]]',
	['jy'] = '[[Jyutping]]',													-- for |showflag=[jy | yj ] ???? why different from 'j'?
	['lmz'] = '[[Shanghainese]]<br />[[Long-short (romanization)|Romanization]]',
	['p'] = '[[Hanyu Pinyin]]',
	['phfs'] = '[[Pha̍k-fa-sṳ]]',
	['poj'] = '[[Hokkien]] [[Pe̍h-ōe-jī|POJ]]',
	['psic'] = '[[Sichuanese Mandarin|Sichuanese]] [[Sichuanese Pinyin|Pinyin]]',
	['tl'] = '[[Taiwanese Romanization System|Tâi-lô]]',
	['toi'] = '[[Taishanese]] [[Jyutping]]',
	['w'] = '[[Wade–Giles]]',
	['wuu'] = '[[Wu Chinese|Wu]]',
	['xej'] = '[[Xiao\'erjing]]',
	['y'] = '[[Cantonese]] [[Yale romanization of Cantonese|Yale]]',
	}


--[[--------------------------< T R A N S L _ M A P >----------------------------------------------------------

Table to map |showflags= value to an index into label_map for child infobox |labeln= value and to map |showflags=
vale to the correct parameter for use in child infobox |datan= paramter

Implementation deatils of |showflag= are in dispute see: Template_talk:Infobox_Chinese#Rfc_on_fixing_the_template_showflag

linked conversation is at: Template_talk:Infobox_Chinese/Archive_4#Showflag broken

]]

local transl_map = {															-- maps |showflag= value to label from label_map table and data from matching parameter name
	['bp'] = {['label1'] = 'bp', ['data1'] = 'bp'},
	['bpmf'] = {['label1'] = 'bpmf', ['data1'] = 'bpmf'},
	['gan'] = {['label1'] = 'gan', ['data1'] = 'gan'},
	['gdp'] = {['label1'] = 'y', ['data1'] = 'y', ['label2'] = 'p', ['data2'] = 'p'},
	['h'] = {['label1'] = 'h', ['data1'] = 'h'},
	['hsn'] = {['label1'] = 'hsn', ['data1'] = 'hsn'},
	['j'] = {['label1'] = 'j', ['data1'] = 'j'},
	['jp'] = {['label1'] = 'y', ['data1'] = 'y', ['label2'] = 'p', ['data2'] = 'p'},
	['jy'] = {
		['label1'] = 'jy',		-- why is this not the same as 'j'?
		['data1'] = 'j',
		['label2'] = 'y',
		['data2'] = 'y'
		},
	['jyp'] = {['label1'] = 'y', ['data1'] = 'y', ['label2'] = 'j', ['data2'] = 'j', ['label3'] = 'p', ['data3'] = 'p'},
	['lmz'] = {['label1'] = 'lmz', ['data1'] = 'lmz'},
	['p'] = {['label1'] = 'p', ['data1'] = 'p'},
	['phfs'] = {['label1'] = 'phfs', ['data1'] = 'phfs'},
	['phsn'] = {['label1'] = 'p', ['data1'] = 'p', ['label2'] = 'hsn', ['data2'] = 'hsn'},
	['pj'] = {['label1'] = 'p', ['data1'] = 'p', ['label2'] = 'j', ['data2'] = 'j'},
	['poj'] = {['label1'] = 'poj', ['data1'] = 'poj'},
	['psic'] = {['label1'] = 'p', ['data1'] = 'p', ['label2'] = 'sic', ['data2'] = 'sic'},
	['pwuu'] = {['label1'] = 'p', ['data1'] = 'p', ['label2'] = 'wuu', ['data2'] = 'wuu'},
	['py'] = {['label1'] = 'p', ['data1'] = 'p', ['label2'] = 'y', ['data2'] = 'y'},
	['tl'] = {['label1'] = 'tl', ['data1'] = 'tl'},
	['toip'] = {['label1'] = 'toi', ['data1'] = 'toi', ['label2'] = 'p', ['data2'] = 'p'},
	['wp'] = {['label1'] = 'w', ['data1'] = 'w', ['label2'] = 'p', ['data2'] = 'p'},
	['wuu'] = {['label1'] = 'wuu', ['data1'] = 'wuu'},
	['y'] = {['label1'] = 'y', ['data1'] = 'y'},
	['yj'] = {['label1'] = 'y', ['data1'] = 'y', ['label2'] = 'jy', ['data2'] = 'j'},
	['xej'] = {
		['label1'] = 'xej',
		['data1'] = 'xej',				-- ???? what to do about this; template calls {{lang|zh-Arab|{{{xej}}}}} on this value
		},
	['xejp'] = {
		['label1'] = 'xej',
		['data1'] = 'xej',				-- ???? template does not call {{lang|zh-Arab|{{{xej}}}}} on this value; why?
		['label2'] = 'p',
		['data2'] = 'p'
		},
	}


--[[--------------------------< 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 parameter 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 transl_map[show_flag] then
		local i=1;
		while (1) do
			local label = 'label' .. i;											-- make label index that matches |labeln= parameter 
			local data = 'data' .. i;											-- make data index that matches |datan= parameter 
			if not transl_map[show_flag][label] then
				break;															-- not found then done
			end
			infobox_args[label] = label_map[transl_map[show_flag][label]];		-- add |labeln=<label text / wikilink>
			infobox_args[data] = pframe.args[transl_map[show_flag][data]];		-- 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


--[[--------------------------< X S C R I P T >----------------------------------------------------------------

table that holds the various transcription headers and labels used by transcriptions()

indexed in this table are lower case versions of the header display text without punctuation (if any)

]]

local xscript = {
	['standard mandarin'] = {													-- lower case version of the header display text
		['header'] = '[[Standard Chinese|Standard Mandarin]]',					-- text to be displayed if headers are displayed
		['t'] = {																-- table of labels and their associated data parameter
			{'[[Hanyu Pinyin]]', 'p'},											-- label is [[Hanyu Pinyin]], data is taken from |p= parameter
			{'[[Bopomofo]]','bpmf'},
			{'[[Spelling in Gwoyeu Romatzyh|Gwoyeu Romatzyh]]', 'gr'},
			{'[[Wade–Giles]]', 'w'},
			{'[[Tongyong Pinyin]]', 'tp'},
			{'[[Yale romanization of Mandarin|Yale Romanization]]', 'myr'},
			{'[[Mandarin Phonetic Symbols II|MPS2]]', 'mps'},
			{'[[Help:IPA/Mandarin|IPA]]', 'mi'}
			}
		},
	['other mandarin'] = {
		['header'] = '[[Mandarin Chinese|other Mandarin]]',
		['t'] = {
			{'[[Xiao\'erjing]]', 'xej'},
			{'[[Dungan language|Dungan]]','zh-dungan'},
			{'[[Sichuanese Mandarin|Sichuanese]] [[Sichuanese Pinyin|Pinyin]]', 'sic'},
			}
		},
	['wu'] = {
		['header'] = '[[Wu Chinese|Wu]]',
		['t'] = {
			{'Romanization', 'wuu'},
			{'[[Shanghainese]]<br />Romanization', 'lmz'},
			{'[[Wenzhounese]]<br />[[Wenzhounese romanisation|Romanisation]]', 'ouji'},
			{'[[Suzhounese]]', 'suz'},
			}
		},
	['gan'] = {
		['header'] = '[[Gan Chinese|Gan]]',
		['t'] = {
			{'Romanization', 'gan'},
			}
		},
	['xiang'] = {
		['header'] = '[[Xiang Chinese|Xiang]]',
		['t'] = {
			{'IPA', 'hsn'},
			}
		},
	['hakka'] = {
		['header'] = '[[Hakka Chinese|Hakka]]',
		['t'] = {
			{'[[Guangdong Romanization#Hakka|Romanization]]', 'h'},
			{'[[Pha̍k-fa-sṳ]]', 'phfs'},
			}
		},
	['yue cantonese'] = {
		['header'] = '[[Cantonese|Yue: Cantonese]]',
		['t'] = {
			{'[[Yale romanization of Cantonese|Yale Romanization]]', 'y'},
			{'[[Help:IPA/Cantonese|IPA]]', 'ci'},
			{'[[Jyutping]]', 'j'},
			{'[[Sidney Lau romanisation|Sidney Lau]]', 'sl'},
			{'[[Guangdong Romanization|Canton Romanization]]', 'gd'},
			{'[[Hong Kong Government Cantonese Romanisation|Hong Kong Romanisation]]', 'hk'},
			{'[[Cantonese#Romanization|Macau Romanization]]', 'mo'},
			}
		},
	['other yue'] = {
		['header'] = '[[Yue Chinese|other Yue]]',
		['t'] = {
			{'[[Taishanese]]', 'toi'},
			}
		},
	['southern min'] = {
		['header'] = '[[Southern Min]]',
		['t'] = {
			{'[[Hokkien]] [[Pe̍h-ōe-jī|POJ]]', 'poj'},
			{'[[Taiwanese Romanization System|Tâi-lô]]', 'tl'},
			{'[[Bbánlám pìngyīm|Bbánlám Pìngyīm]]', 'bp'},
			{'[[Teochew dialect|Teochew]] [[Guangdong Romanization#Teochew|Peng\'im]]', 'teo'},
			{'[[Hainanese]] Romanization', 'hain'},
			{'[[Leizhou Min|Leizhou]] Romanization', 'lizu'},
			}
		},
	['eastern min'] = {
		['header'] = '[[Eastern Min]]',
		['t'] = {
			{'[[Fuzhou dialect|Fuzhou]] [[Foochow Romanized|BUC]]', 'buc'},
			}
		},
	['pu-xian min'] = {
		['header'] = '[[Pu-Xian Min]]',
		['t'] = {
			{'[[Pu-Xian Min|Hinghwa]] [[Hinghwa Romanized|BUC]]', 'hhbuc'},
			}
		},
	['northern min'] = {
		['header'] = '[[Northern Min]]',
		['t'] = {
			{'[[Jian\'ou dialect|Jian\'ou]] [[Kienning Colloquial Romanized|Romanized]]', 'mblmc'},
			}
		},
	['old mandarin'] = {
		['header'] = '[[Old Mandarin]]',
		['t'] = {
			{'Romanized \'Phags-pa', 'phagspa-latin'},
			}
		},
	['middle chinese'] = {
		['header'] = '[[Middle Chinese]]',
		['t'] = {
			{'[[Middle Chinese]]', 'mc'},
			{'[[Middle Chinese#Early Middle Chinese|Early Middle Chinese]]', 'emc'},
			{'[[Middle Chinese#Late Middle Chinese|Late Middle Chinese]]', 'lmc'},
			}
		},
	['old chinese'] = {
		['header'] = '[[Old Chinese]]',
		['t'] = {
			{'[[Reconstructions_of_Old_Chinese#Baxter (1992)|Baxter (1992)]]', 'oc-b92'},
			{'[[Reconstructions of Old Chinese#Baxter–Sagart (2014)|Baxter–Sagart (2014)]]', 'oc-bs'},
			{'[[Reconstructions of Old Chinese#Zhengzhang (1981–1995)|Zhengzhang]]', 'oc-zz'},
			}
		},

--------< non-Chinese transcriptions >--------

	['arabic'] = {
		['header'] = nil,														-- {{Infobox Chinese/Arabic}}; doesn't use header
		['t'] = {
			{'[[Arabic chat alphabet|Chat]]', 'chat'},							-- TODO: standardize on lowercase parameter names
			{'[[Arabic chat alphabet|Chat]]', 'Chat'},
			{'[[ALA-LC romanization|ALA-LC]]', 'ala-lc'},
			{'[[ALA-LC romanization|ALA-LC]]', 'ALA-LC'},
			{'[[ISO 233|ISO]]', 'iso'},
			{'[[ISO 233|ISO]]', 'ISO'},
			{'[[DIN 31635|DIN]]', 'din'},
			{'[[DIN 31635|DIN]]', 'DIN'},
			}
		},
	['hokkien'] = {
		['header'] = nil,														-- {{Infobox Chinese/Hokkien}}; doesn't use header
		['t'] = {
			{'[[Taiwanese Romanization System|Tâi-lô]]', 'tl'},
			{'[[Bbánlám pìngyīm|Bbánpìng]]', 'bp'},
			{'[[Help:IPA for Hokkien|IPA]]', 'hokkienipa'},
			}
		},
	['japanese'] = {
		['header'] = nil,														-- {{Infobox Chinese/Japanese}}; doesn't use header
		['t'] = {
			{'[[Romanization of Japanese|Romanization]]', 'romaji'},
			{'[[Hepburn romanization|Revised Hepburn]]', 'revhep'},
			{'[[Hepburn romanization|Traditional Hepburn]]', 'tradhep'},
			{'[[Kunrei-shiki romanization|Kunrei-shiki]]', 'kunrei'},
			{'[[Nihon-shiki romanization|Nihon-shiki]]', 'nihon'},
			}
		},
	['korean'] = {
		['header'] = nil,														-- {{Infobox Chinese/Korean}}; doesn't use header
		['t'] = {
			{'[[Revised Romanization of Korean|Revised Romanization]]', 'rr'},
			{'[[McCune–Reischauer]]', 'mr'},
			{'[[Help:IPA/Korean|IPA]]', 'koreanipa'},
			}
		},
	['mongolian'] = {
		['header'] = nil,														-- {{Infobox Chinese/Mongolian}}; doesn't use header
		['t'] = {
			{'[[SASM/GNC romanization#Mongolian|SASM/GNC]]', 'monr'},
			}
		},
	['russian'] = {
		['header'] = nil,														-- {{Infobox Chinese/Russian}}; doesn't use header
		['t'] = {
			{'[[Scientific transliteration of Cyrillic|Scientific]]', 'scientific'},
			{'[[Scientific transliteration of Cyrillic|Scientific]]', 'Scientific'},
			{'[[ISO 9|ISO]]', 'iso'},
			{'[[ISO 9|ISO]]', 'ISO'},
			{'[[GOST 16876-71|GOST 71]]', 'gost'},
			{'[[GOST 16876-71|GOST 71]]', 'GOST'},
			{'[[BGN/PCGN romanization of Russian|BGN/PCGN]]', 'bgn/pcgn'},
			{'[[BGN/PCGN romanization of Russian|BGN/PCGN]]', 'BGN/PGCN'},
			}
		},
	['tibetan'] = {
		['header'] = nil,														-- {{Infobox Chinese/Tibetan}}; doesn't use header
		['t'] = {
			{'[[Wylie transliteration|Wylie]]', 'wylie'},
			{'[[THL Simplified Phonetic Transcription|THL]]', 'thdl'},
			{'[[Tibetan pinyin|Tibetan Pinyin]]', 'zwpy'},
			{'[[Standard Tibetan|Lhasa]] [[Help:IPA/Tibetan|IPA]]', 'lhasa'},
			}
		},
	['uyghur'] = {
		['header'] = nil,														-- {{Infobox Chinese/Uyghur}}; doesn't use header
		['t'] = {
			{'[[Uyghur Latin alphabet|Latin Yëziqi]]', 'uly'},
			{'[[Uyghur New Script|Yengi Yeziⱪ]]', 'uyy'},
			{'[[SASM/GNC romanization#Uyghur|SASM/GNC]]', 'sgs'},
			{'[[Uyghur Cyrillic alphabet|Siril Yëziqi]]', 'usy'},
			{'Uyghur [[Wikipedia: IPA|IPA]]', 'uipa'},
			}
		},
	}


--[[--------------------------< 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

returns i for the next time this function is called

]]

local function add_transcription (infobox_args, args, idx, show, i)
	infobox_args['header' .. i] = show and xscript[idx].header;					-- if headers are displayed
	i = i + 1;																	-- bump the enumerator
	for _, v in ipairs (xscript[idx].t) do										-- each label / data pair in the xscript subtable
		i = add_label_data_pair (infobox_args, v[1], args[v[2]], 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);
	end

	if any_set ({args.xej, args['zh-dungan'], args.sic}) then
		i = add_transcription (infobox_args, args, 'other mandarin', show, i);
	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);
	end
	
	if is_set (args.gan) then
		i = add_transcription (infobox_args, args, 'gan', show, i);
	end
	
	if is_set (args.hsn) then
		i = add_transcription (infobox_args, args, 'xiang', show, i);
	end

	if any_set ({args.h, args.phfs}) then
		i = add_transcription (infobox_args, args, 'hakka', show, i);
	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);
	end

	if is_set (args.toi) then
		i = add_transcription (infobox_args, args, 'other yue', show, i);
	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);
	end

	if is_set (args.buc) then
		i = add_transcription (infobox_args, args, 'eastern min', show, i);
	end

	if is_set (args.hhbuc) then
		i = add_transcription (infobox_args, args, 'pu-xian min', show, i);
	end

	if is_set (args.mblmc) then
		i = add_transcription (infobox_args, args, 'northern min', show, i);
	end

	if is_set (args['phagspa-latin']) then
		i = add_transcription (infobox_args, args, 'old mandarin', show, i);
	end

	if any_set ({args.mc, args.emc, args.lmc}) then
		i = add_transcription (infobox_args, args, 'middle chinese', show, i);
	end

	if any_set ({args['oc-b92'], args['oc-bs'], args['oc-zz']}) then
		i = add_transcription (infobox_args, args, 'old chinese', show, i);
	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, lang)
	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;';

	local keys = {																-- table of xscript table keys calls
		ar = 'arabic',
		bo = 'tibetan',
		hokkien = 'hokkien',
		ja = 'japanese',
		ko = 'korean',
		mn = 'mongolian',
		ru = 'russian',
		ug = 'uyghur',
	}
	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, keys[lang], show, i);			
	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)
	local args = frame.args;
	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;
	
	if is_set (args.c) then
		i = add_label_data_pair (infobox_args, '[[Chinese language|Chinese]]', frame:expandTemplate ({title='Lang', args = {'zh-Hani', args.c, size = '1rem'}}), i)
	end

	if 'st' == args.order then
		if is_set (args.s) then
			i = add_label_data_pair (infobox_args, '[[Simplified Chinese characters|Simplified Chinese]]', frame:expandTemplate ({title='Lang', args = {'zh-Hans', args.s, size = '1rem'}}), i)
		end

		if is_set (args.t) then
			i = add_label_data_pair (infobox_args, '[[Traditional Chinese characters|Traditional&nbsp;Chinese]]', frame:expandTemplate ({title='Lang', args = {'zh-Hant', args.t, size = '1rem'}}), i)
		end
	else
		if is_set (args.t) then
			i = add_label_data_pair (infobox_args, '[[Traditional Chinese characters|Traditional&nbsp;Chinese]]', frame:expandTemplate ({title='Lang', args = {'zh-Hant', args.t, size = '1rem'}}), i)
		end

		if is_set (args.s) then
			i = add_label_data_pair (infobox_args, '[[Simplified Chinese characters|Simplified Chinese]]', frame:expandTemplate ({title='Lang', args = {'zh-Hans', args.s, size = '1rem'}}), i)
		end
	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, '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)
	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()
	
	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, '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}}

]]

local function ibox_zh_blank (frame)
	local lang_mod = require ('Module:Lang/sandbox');
	local args = frame.args;
	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 = frame:expandTemplate ({title='lang', args = {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)
	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()
	
	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, '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)
	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()
	
	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/Japanese}}

Module entry point

{{#invoke:Sandbox/trappist_the_monk/Ibox_zh|ibox_zh_hokkien}}

Template:Infobox Hokkien name/testcases

]]

local function ibox_zh_hokkien (frame)
	local args = frame:getParent().args;										-- there are no frame arguments for this function; all arguments must come from the parent (the template)
	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 frame:expandTemplate ({title='lang', args = {'nan', args.hanji, size = '115%'}}) or nil, i);
	i = add_label_data_pair (infobox_args, '[[Pe̍h-ōe-jī]]', is_set (args.poj) and frame:expandTemplate ({title='lang', args = {'nan', args.poj, size = '115%'}}) or nil, i);
	i = add_label_data_pair (infobox_args, '[[Hàn-lô]]', is_set (args.hanlo) and frame:expandTemplate ({title='lang', args = {'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, '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)
	local args = frame.args;
	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 frame:expandTemplate ({title='lang', args = {'ja', args.kanji}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Kana]]', is_set (args.kana) and frame:expandTemplate ({title='lang', args = {'ja', args.kana}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Hiragana]]', is_set (args.hiragana) and frame:expandTemplate ({title='lang', args = {'ja', args.hiragana}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Katakana]]', is_set (args.katakana) and frame:expandTemplate ({title='lang', args = {'ja', args.katakana}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Kyūjitai]]', is_set (args.kyujitai) and frame:expandTemplate ({title='lang', args = {'ja', args.kyujitai}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Shinjitai]]', is_set (args.shinjitai) and frame:expandTemplate ({title='lang', args = {'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, '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)
	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()
	
	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 frame:expandTemplate ({title='lang', args = {'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 frame:expandTemplate ({title='lang', args = {'ko', args.hangul, size = '1rem'}}) or nil, i)
	else
		i = add_label_data_pair (infobox_args, '[[Hangul]]', is_set (args.hangul) and frame:expandTemplate ({title='lang', args = {'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 frame:expandTemplate ({title='lang', args = {'ko', args.hanja, size = '1rem'}}) or nil, i)
	else
		i = add_label_data_pair (infobox_args, '[[Hanja]]', is_set (args.hanja) and frame:expandTemplate ({title='lang', args = {'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, '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 frame:expandTemplate ({title='transl', args = {'ko', 'rr', args.rr}}) or nil, i)
		i = add_label_data_pair (infobox_args, '[[McCune–Reischauer]]', is_set (args.mr) and frame:expandTemplate ({title='transl', args = {'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)
	local args = frame.args;
	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 frame:expandTemplate ({title='lang', args = {'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 frame:expandTemplate ({title='lang', args = {'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 frame:expandTemplate ({title='lang', args = {'mn', frame:expandTemplate ({title='MongolUnicode', args = {args.mong}}) }}) or nil, i)

	if is_set (args.monr) then
		infobox_args['data' .. i] = transcriptions (frame, '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)
	local args = frame.args;
	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)
	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()
	
	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)
	local args = frame.args;
	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 frame:expandTemplate ({title='lang', args = {'ru', args.rus}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Romanization of Russian|Romanization]]', is_set (args.rusr) and frame:expandTemplate ({title='lang', args = {'ru-Latn', args.rusr}}) or nil, i)
	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, '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}}

TODO: change RTGS label / data pair to use:
	frame:expandTemplate ({title='transl', args = {'th', 'rtgs', args.rtgs}})	-- needs rtgs defined in Module:Lang/data

]]

local function ibox_zh_th (frame)
	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()
	
	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 frame:expandTemplate ({title='lang', args = {'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 frame:expandTemplate ({title='lang', args = {'th-Latn', 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)
	local args = frame.args;
	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, '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)
	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()
	
	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 frame:expandTemplate ({title='lang', args = {'vi', args.vie}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Vietnamese alphabet]]', is_set (args.qn) and frame:expandTemplate ({title='lang', args = {'vi', args.qn}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Hán-Nôm]]', is_set (args.hn) and frame:expandTemplate ({title='lang', args = {'vi-Hani', args.hn}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Chữ Hán]]', is_set (args.chuhan) and frame:expandTemplate ({title='lang', args = {'vi-Hani', args.chuhan}}) or nil, i)
	i = add_label_data_pair (infobox_args, '[[Chữ Nôm]]', is_set (args.chunom) and frame:expandTemplate ({title='lang', args = {'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)
	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()
	
	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)
	local args = frame.args;
	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;';
	infobox_args['bodyclass'] =  is_set (args.collapse) and 'collapsible' .. ('yes' == args.collapse and ' collapsed' or '');
	
	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)
	local args = frame.args;
	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;
	
	local footer = frame:expandTemplate ({title='Infobox', args = infobox_args});

	return footer;
end


--[[--------------------------< E X P O R T E D   F U N C T I O N S >------------------------------------------
]]

return {
	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}}
	}