Module:Infobox multi-lingual name/data

From MicroWiki, the micronational encyclopædia
Jump to navigation Jump to search

Documentation for this module may be created at Module:Infobox multi-lingual name/data/doc

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

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

TODO: convert showflag to a comma delimited list instead of these peculiar codes?

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


--[[--------------------------< K E Y S >----------------------------------------------------------------------
]]

local keys = {																	-- table of xscript table keys calls
	ar = 'arabic',
	bo = 'tibetan',
	hokkien = 'hokkien',
	ja = 'japanese',
	ko = 'korean',
	mn = 'mongolian',
	ru = 'russian',
	ug = 'uyghur',
	}


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

TODO: add support for transl transliteration standard parameter; akin to {{transl|lang code|standard code|text|italic=??}}

]]

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

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

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


--[[--------------------------< I B O X _ Z H Z H _ E N U M _ P A R A M S >------------------------------------
]]

local ibox_zhzh_enum_params = {													-- 'p', 'hp', 'xej' are special case enum parameters
	'c', 't', 's', 'l', 'tp', 'w', 'mi', 'myr', 'psp', 'myale', 'gr', 'bpmf', 'mps',
	'zh-dungan', 'sic', 'y', 'j', 'sl', 'gd', 'hk', 'mo', 'ci', 'toi', 'gan', 'wuu', 'ouji', 'suz',
	'hsn', 'h', 'phfs', 'poj', 'tl', 'bp', 'buc', 'hhbuc', 'mblmc', 'lmz', 'teo', 'lizu', 'hain',
	'mc', 'emc', 'lmc', 'oc-bs', 'oc-zz',
	'oc-b92', 																	-- only supported in the first ibox zhzh; why?
	'lao', 'khm', 'tet'															-- not supported by ibox zh/zh  why are they here?
	}


--[[--------------------------< Z H _ H D R _ N A M E S >------------------------------------------------------

this table fixes an oddity in the ibox zh/zh header name parameters.  |chinese_header= for the first ibox zh/zh 
gets filled from |name1= but the second gets its name from |altname= and then the third from |altname3=.
All of these parameter names should be replaced with |chinese_header= followed by |chinese_header2= ... like all
of the other enumerated parameters

]]

local zh_hdr_names = {
	[2] = {'altname', 'Alternative Chinese name'},
	[3] = {'altname3', 'Second alternative Chinese name'},
	[4] = {'altname4', 'Third alternative Chinese name'},
	[5] = {'altname5', 'Fourth alternative Chinese name'},
	[6] = {'altname6', 'Fifth alternative Chinese name'},
	};


--[[--------------------------< E X P O R T E D   T A B L E S >------------------------------------------------
]]

return {
	ibox_zhzh_enum_params = ibox_zhzh_enum_params,
	keys = keys,
	label_map = label_map,
	transl_map = transl_map,
	xscript = xscript,
	zh_hdr_names = zh_hdr_names,
	}