Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Languages/List

From Neodyland Wiki
Revision as of 20:51, 19 April 2015 by commons>Verdy p (+"aeb", "arq", "bbc", "bbc-latn", "bgn", "gom-latn", "hrx", "ses", "tzm", "uz-cyrl", "uz-latn" : now use builtin mw.language to get the sorted code list (static list commented out and compacted))
Module documentation[ view · edit · history · purge ]
This documentation is transcluded from Module:Languages/List/doc.

Previously this module generated a static list like this:

p.list = {'aa', 'aae', 'ab', 'abr', 'abs', 'ace', 'acf', 'acm', 'ady', 'ady-cyrl', 'aeb', 'aeb-arab', 'aeb-latn', 'af', 'aig', 'aln', 'als', 'alt', 'am', 'ami', 'an', 'ang', 'ann', 'anp', 'apc', 'ar', 'arc', 'arn', 'arq', 'ary', 'arz', 'as', 'ase', 'ast', 'atj', 'av', 'avk', 'awa', 'ay', 'az', 'azb', 'ba', 'ban', 'ban-bali', 'bar', 'bat-smg', 'bbc', 'bbc-latn', 'bcc', 'bci', 'bcl', 'bdr', 'be', 'be-tarask', 'be-x-old', 'bew', 'bg', 'bgc', 'bgn', 'bh', 'bho', 'bi', 'bjn', 'blk', 'bm', 'bn', 'bo', 'bol', 'bpy', 'bqi', 'br', 'brh', 'bs', 'btm', 'bto', 'bug', 'bug-bugi', 'bxr', 'ca', 'cbk-zam', 'ccp', 'cdo', 'cdo-hant', 'cdo-latn', 'ce', 'ceb', 'ch', 'chn', 'cho', 'chr', 'chy', 'ckb', 'co', 'cop', 'cps', 'cpx', 'cpx-hans', 'cpx-hant', 'cpx-latn', 'cr', 'crh', 'crh-cyrl', 'crh-latn', 'crh-ro', 'cs', 'csb', 'cu', 'cv', 'cy', 'da', 'dag', 'de', 'de-at', 'de-ch', 'de-formal', 'dga', 'din', 'diq', 'dlg', 'dsb', 'dtp', 'dty', 'dua', 'dv', 'dz', 'ee', 'efi', 'egl', 'el', 'eml', 'en', 'en-ca', 'en-gb', 'eo', 'es', 'es-419', 'es-formal', 'et', 'eu', 'ext', 'fa', 'fat', 'ff', 'fi', 'fit', 'fiu-vro', 'fj', 'fo', 'fon', 'fr', 'frc', 'frp', 'frr', 'frs', 'fur', 'fvr', 'fy', 'ga', 'gaa', 'gag', 'gan', 'gan-hans', 'gan-hant', 'gcf', 'gcr', 'gd', 'gl', 'gld', 'glk', 'gn', 'gom', 'gom-deva', 'gom-latn', 'gor', 'got', 'gpe', 'grc', 'gsw', 'gu', 'guc', 'gur', 'guw', 'gv', 'ha', 'hak', 'hak-hans', 'hak-hant', 'hak-latn', 'haw', 'he', 'hi', 'hif', 'hif-latn', 'hil', 'hke', 'hno', 'ho', 'hoc-latn', 'hr', 'hrx', 'hsb', 'hsn', 'ht', 'hu', 'hu-formal', 'hy', 'hyw', 'hz', 'ia', 'iba', 'ibb', 'id', 'ie', 'ig', 'igl', 'ii', 'ik', 'ike-cans', 'ike-latn', 'ilo', 'inh', 'io', 'is', 'isv', 'isv-cyrl', 'isv-latn', 'it', 'iu', 'ja', 'jam', 'jbo', 'jut', 'jv', 'jv-java', 'ka', 'kaa', 'kab', 'kai', 'kaj', 'kbd', 'kbd-cyrl', 'kbp', 'kcg', 'kea', 'kg', 'kge', 'khw', 'ki', 'kiu', 'kj', 'kjh', 'kjp', 'kk', 'kk-arab', 'kk-cn', 'kk-cyrl', 'kk-kz', 'kk-latn', 'kk-tr', 'kl', 'km', 'kn', 'knc', 'ko', 'ko-kp', 'koi', 'kr', 'krc', 'kri', 'krj', 'krl', 'ks', 'ks-arab', 'ks-deva', 'ksh', 'ksw', 'ku', 'ku-arab', 'ku-latn', 'kum', 'kus', 'kv', 'kw', 'ky', 'la', 'lad', 'lb', 'lbe', 'lez', 'lfn', 'lg', 'li', 'lij', 'liv', 'ljp', 'lki', 'lkt', 'lld', 'lmo', 'ln', 'lo', 'loz', 'lrc', 'lt', 'ltg', 'lua', 'lus', 'luz', 'lv', 'lzh', 'lzz', 'mad', 'mag', 'mai', 'map-bms', 'mdf', 'mg', 'mh', 'mhr', 'mi', 'min', 'mk', 'ml', 'mn', 'mnc', 'mnc-latn', 'mnc-mong', 'mni', 'mnw', 'mo', 'mos', 'mr', 'mrh', 'mrj', 'ms', 'ms-arab', 'mt', 'mui', 'mus', 'mwl', 'my', 'myv', 'mzn', 'na', 'nah', 'nan', 'nan-hant', 'nan-latn-pehoeji', 'nan-latn-tailo', 'nap', 'nb', 'nds', 'nds-nl', 'ne', 'new', 'ng', 'nia', 'nit', 'niu', 'nl', 'nl-informal', 'nmz', 'nn', 'no', 'nod', 'nog', 'nov', 'nqo', 'nr', 'nrm', 'nso', 'nup', 'nv', 'ny', 'nyn', 'nyo', 'nys', 'oc', 'ojb', 'olo', 'om', 'or', 'os', 'pa', 'pag', 'pam', 'pap', 'pap-aw', 'pcd', 'pcm', 'pdc', 'pdt', 'pfl', 'pi', 'pih', 'pl', 'pms', 'pnb', 'pnt', 'ppl', 'prg', 'ps', 'pt', 'pt-br', 'pwn', 'qqq', 'qu', 'qug', 'rgn', 'rif', 'rki', 'rm', 'rmc', 'rmy', 'rn', 'ro', 'roa-rup', 'roa-tara', 'rsk', 'ru', 'rue', 'rup', 'ruq', 'ruq-cyrl', 'ruq-latn', 'rut', 'rw', 'ryu', 'sa', 'sah', 'sas', 'sat', 'sc', 'scn', 'sco', 'sd', 'sdc', 'sdh', 'se', 'se-fi', 'se-no', 'se-se', 'sei', 'ses', 'sg', 'sgs', 'sh', 'sh-cyrl', 'sh-latn', 'shi', 'shi-latn', 'shi-tfng', 'shn', 'shy', 'shy-latn', 'si', 'simple', 'sjd', 'sje', 'sk', 'skr', 'skr-arab', 'sl', 'sli', 'sm', 'sma', 'smn', 'sms', 'sn', 'so', 'sq', 'sr', 'sr-ec', 'sr-el', 'srn', 'sro', 'ss', 'st', 'stq', 'sty', 'su', 'sv', 'sw', 'syl', 'szl', 'szy', 'ta', 'tay', 'tcy', 'tdd', 'te', 'tet', 'tg', 'tg-cyrl', 'tg-latn', 'th', 'ti', 'tig', 'tk', 'tl', 'tly', 'tly-cyrl', 'tn', 'to', 'tok', 'tpi', 'tr', 'tru', 'trv', 'ts', 'tt', 'tt-cyrl', 'tt-latn', 'ttj', 'tum', 'tw', 'ty', 'tyv', 'tzm', 'udm', 'ug', 'ug-arab', 'ug-latn', 'uk', 'ur', 'uz', 'uz-cyrl', 'uz-latn', 've', 'vec', 'vep', 'vi', 'vls', 'vmf', 'vmw', 'vo', 'vot', 'vro', 'wa', 'wal', 'war', 'wls', 'wlx', 'wo', 'wuu', 'wuu-hans', 'wuu-hant', 'xal', 'xh', 'xmf', 'xsy', 'yi', 'yo', 'yrl', 'yua', 'yue', 'yue-hans', 'yue-hant', 'za', 'zea', 'zgh', 'zgh-latn', 'zh', 'zh-classical', 'zh-cn', 'zh-hans', 'zh-hant', 'zh-hk', 'zh-min-nan', 'zh-mo', 'zh-my', 'zh-sg', 'zh-tw', 'zh-yue', 'zu'}

Now this list is generated from the internal list of supported languages in the local instance of MediaWiki, which is then sorted by native name of each language in its primary script (LTR scripts are sorted before RTL scripts, language names in the same script are sorted together.

The order is also consistant with Module:Multilingual description which has its own comprehensive tests for the sort order of the list, its completeness (all language codes supported by the local instance of Mediawiki, plus some known aliases needed for BCP 47 conformance or for compatibility with past versions of this wiki even if they are not supported now and not shown in the list above), as well as for the directionality of each language.

Note that as of 2020-10-18, there's a new bug in Scribunto, which causes the standard "table.sort()" function to no longer accept a standard comparison function. Now when "table.sort()" fails, the error is correctly catched (instead of producing a viabile error), but the list may not be sorted correctly (temporarily) in some cases. The bug is tracked and corrected in Mediawiki but waiting to be deployed with the fix. Nothing will need to be changed (using "perror()" will then no longer have any effect, it is just needed for now and the bug was not a bug of this module which was properly tested and sudddently failed unexpectedly). Thanks.

local p = {};

--[[
// JavaScript-snippet to update this list:
var list = "";
$.each(wpAvailableLanguages, function(lang, _) {
    list += "'" + lang + "',";
})
console.log("p.list={" + list + "}")
]]

-- @Deprecated
-- p.list={'aa','ab','ace','aeb','af','ak','aln','als','am','an','ang','anp','ar','arc','arn','arq','ary','arz','as','ast','av','avk','ay','az','azb','ba','bar','bat-smg','bbc','bbc-latn','bcc','bcl','be','be-tarask','be-x-old','bg','bgn','bh','bho','bi','bjn','bm','bn','bo','bpy','bqi','br','brh','bs','bto','bug','bxr','ca','cbk-zam','cdo','ce','ceb','ch','cho','chr','chy','ckb','co','cps','cr','crh','crh-cyrl','crh-latn','cs','csb','cu','cv','cy','da','de','de-at','de-ch','de-formal','diq','dsb','dtp','dv','dz','ee','egl','el','eml','en','en-ca','en-gb','eo','es','et','eu','ext','fa','ff','fi','fit','fiu-vro','fj','fo','fr','frc','frp','frr','fur','fy','ga','gag','gan','gan-hans','gan-hant','gd','gl','glk','gn','gom-latn','got','grc','gsw','gu','gv','ha','hak','haw','he','hi','hif','hif-latn','hil','ho','hr','hrx','hsb','ht','hu','hy','hz','ia','id','ie','ig','ii','ik','ike-cans','ike-latn','ilo','inh','io','is','it','iu','ja','jam','jbo','jut','jv','ka','kaa','kab','kbd','kbd-cyrl','kg','khw','ki','kiu','kj','kk','kk-arab','kk-cn','kk-cyrl','kk-kz','kk-latn','kk-tr','kl','km','kn','ko','koi','ko-kp','kr','krc','kri','krj','ks','ks-arab','ks-deva','ksh','ku','ku-arab','ku-latn','kv','kw','ky','la','lad','lb','lbe','lez','lfn','lg','li','lij','liv','lmo','ln','lo','loz','lrc','lt','ltg','lus','lv','lzh','lzz','mai','map-bms','mdf','mg','mh','mhr','mi','min','mk','ml','mn','mo','mr','mrj','ms','mt','mus','mwl','my','myv','mzn','na','nah','nan','nap','nb','nds','nds-nl','ne','new','ng','niu','nl','nl-informal','nn','no','nov','nrm','nso','nv','ny','oc','om','or','os','pa','pag','pam','pap','pcd','pdc','pdt','pfl','pi','pih','pl','pms','pnb','pnt','prg','ps','pt','pt-br','qu','qug','rgn','rif','rm','rmy','rn','ro','roa-rup','roa-tara','ru','rue','rup','ruq','ruq-cyrl','ruq-latn','rw','sa','sah','sat','sc','scn','sco','sd','sdc','se','sei','ses','sg','sgs','sh','shi','shi-latn','shi-tfng','si','simple','sk','sl','sli','sm','sma','sn','so','sq','sr','sr-ec','sr-el','srn','ss','st','stq','su','sv','sw','szl','ta','tcy','te','tet','tg','tg-cyrl','tg-latn','th','ti','tk','tl','tly','tn','to','tokipona','tpi','tr','tru','ts','tt','tt-cyrl','tt-latn','tum','tw','ty','tyv','tzm','udm','ug','ug-arab','ug-latn','uk','ur','uz','uz-cyrl','uz-latn','ve','vec','vep','vi','vls','vmf','vo','vot','vro','wa','war','wo','wuu','xal','xh','xmf','yi','yo','yue','za','zea','zh','zh-classical','zh-cn','zh-hans','zh-hant','zh-hk','zh-min-nan','zh-mo','zh-my','zh-sg','zh-tw','zh-yue','zu',}

--
--[[ Check this list by running this in the console of the Lua Module editor in MediaWiki:
="p.list={'" .. table.concat(p.getSortedList(mw.language.fetchLanguageNames()), "','") .. "',}"
]]
function p.getSortedList(mwLangList)
    local sortedList = {}
    for lang, _ in pairs(mwLangList) do
        table.insert(sortedList, lang)
    end
    table.sort(sortedList)
    return sortedList
end

p.list = p.getSortedList(mw.language.fetchLanguageNames())


return p;
Cookies help us deliver our services. By using our services, you agree to our use of cookies.