Module:ISO 639 name/ISO 639 name to code/make: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 11:
code is the associate ISO 639 code from the source data
part is 1 for ISO 639-1 language names and codes, 2 ..., 3 ...
 
language names with parenthetical disambiguation are listed twice; with and without the disambiguators
 
TODO: convert characters with diacritics to characters without?
Line 21 ⟶ 19:
lang = mw.ustring.lower (lang); -- convert to lowercase for use as table index
if lang:match (' *%b()') then -- if language name does not have a disambiguator
if not temp[lang] then -- when no entry for this language
temp[lang] = {'""', '""', '""'}; -- make blank table entry for this language
end
 
temp[lang][part] = table.concat ({'"', code, '"'}); -- add the code
end
 
lang = lang:gsub (' *%b()', ''); -- remove disambiguation if there is one
if not temp[lang] then -- when no entry for this language
temp[lang] = {'""', '""', '""'}; -- make one