local lang_data = mw.loadData ('Module:Lang/data/sandbox'); -- language name override and transliteration tool-tip tableslocal lang_name_table = lang_data.lang_name_table; -- language codes, names, regions, scripts, suppressed scripts
local lang_table = lang_name_table.lang; -- language codes, nameslocal lang_dep_table = lang_name_table.lang_dep; -- deprecated language codes, nameslocal override_table = lang_data.override;
local rev_lang_table = ; -- same as lang_table reversed so language name is key and language tag is valuelocal rev_lang_dep_table = ; -- same as lang_dep_table reversed so language name is key and language tag is valuelocal rev_override_table = ; -- same as override_table except reversedlocal dedabbed_names_list = ; -- holds a list of dedabbed name and tags
----------------------------< R E V _ L I S T _ A D D >------------------------------------------------------
local function to add
local function rev_list_add (rev_list, name, tag) if rev_list[name] then -- if already in
----------------------------< D E D A B B E D _ N A M E S _ L I S T _ A D D >--------------------------------
adds
local function dedabbed_names_list_add (dab, name, tag) if 0 ~= dab then -- if dab was removed if dedabbed_names_list[name] then -- if this dedabbed name is in the table then there are more than one name with different dabs dedabbed_names_list[name] = ; -- unset but not too unset else dedabbed_names_list[name] = tag; -- add name / tag pair in case this the only dedabbed name end endend
----------------------------< D E D A B B E D _ T O _ R E V _ L I S T _ A D D >------------------------------
adds
local function dedabbed_to_rev_list_add (rev_list, name, tag) for name, tag in pairs (dedabbed_names_list) do -- add dedabbed
--
for tag, name_table in pairs (lang_table) do if not override_table[tag] then -- only add names/tags from name_table when tag not present in override table local name_raw = name_table[1]:lower; -- there can be multiple names, always take the first name; may have disambiguation local name, dab = name_raw:gsub ('%s+%b', ); -- remove parenthetical disambiguators or qualifiers from names that have them;
dedabbed_to_rev_list_add (rev_lang_table, name, tag); -- add dedabbed name/tag pairs to the reversed table
dedabbed_names_list = ; -- reset list of dedabbed names
for tag, name_table in pairs (lang_dep_table) do if not override_table[tag] then -- only add names/tags from name_table when tag not present in override table local name_raw = name_table[1]:lower; -- there can be multiple names, always take the first name; may have disambiguation local name, dab = name_raw:gsub ('%s+%b', ); -- remove parenthetical disambiguators or qualifiers from names that have them;
dedabbed_to_rev_list_add (rev_lang_dep_table, name, tag); -- add dedabbed name/tag pairs to the reversed table
dedabbed_names_list = ; -- reset list of dedabbed names
for tag, name_table in pairs (override_table) do local name_raw = name_table[1]:lower; -- there can be multiple names, always take the first name local name, dab = name_raw:gsub ('%s+%b', ); -- remove parenthetical disambiguators or qualifiers from names that have them
rev_list_add (rev_override_table, name_raw, tag); dedabbed_names_list_add (dab, name, tag); -- add to dedabbed_names_list if dabbedend
dedabbed_to_rev_list_add (rev_override_table, name, tag); -- add dedabbed name/tag pairs to the reversed table
dedabbed_names_list = ; -- reset list
----------------------------< E X P O R T E D T A B L E S >------------------------------------------------
return