Module:Dir/RTL overrides

From Chaosvermittlung Wiki
< Module:Dir
Revision as of 15:30, 15 January 2017 by PhilmacFLy (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

local p = {}

--[==[ Basic input sequences: relative order or duplicates does not matter here (but the end of the self test displays them sorted and deduplicated), but codes must be valid and belong to only one of the two sequences).

Any missing language code will be checked with mw.language.new(code):isRTL(), which is costly in loaded resources (it can only check 20 languages at most including the content language) So it is best to map all languages that are the most likely to be used. --]==]

local rtlLangs = { 'aeb', 'aeb-arab', 'ar', 'arc', 'arq', 'arz', 'azb', 'bcc', 'bgn', 'bqi', 'ckb', 'dv', 'fa', 'fa-af', 'glk', 'ha-arab', 'he', 'khw', 'kk-arab', 'kk-cn', 'ks', 'ks-arab', 'ku-arab', 'lki', 'lrc', 'luz', 'mzn', 'pnb', 'prd', 'ps', 'sd', 'sdh', 'ug', 'ug-arab', 'ur', 'uz-arab', 'ydd', 'yi' }

local ltrLangs = { 'aa', 'ab', 'ace', 'ady', 'ady-cyrl', 'aeb-latn', 'af', 'ak', 'aln', 'als', 'am', 'an', 'ang', 'anp', 'arn', 'ary', 'as', 'ase', 'ast', 'av', 'avk', 'awa', 'ay', 'az', 'ba', 'ban', 'bar', 'bat-smg', 'bbc', 'bbc-latn', 'bcl', 'be', 'be-tarask', 'be-x-old', 'bg', 'bh', 'bho', 'bi', 'bjn', 'bm', 'bn', 'bo', 'bpy', 'br', 'brh', 'bs', 'bto', 'bu', 'bug', 'bxr', 'ca', 'cbk-zam', 'cdo', 'ce', 'ceb', 'ch', 'cho', 'chr', 'chy', 'co', 'cps', 'cr', 'crh', 'crh-cyrl', 'crh-latn', 'cs', 'csb', 'cu', 'cv', 'cy', 'da', 'de', 'de-at', 'de-ch', 'de-formal', 'diq', 'dsb', 'dtp', 'dty', 'dz', 'ee', 'egl', 'el', 'eml', 'en', 'en-ca', 'en-gb', 'en-ie', 'en-us', 'eo', 'es', 'et', 'eu', 'ext', 'ff', 'fi', 'fil', 'fit', 'fiu-vro', 'fj', 'fo', 'fr', 'frc', 'fro', 'frp', 'frr', 'fur', 'fy', 'ga', 'gag', 'gan', 'gan-hans', 'gan-hant', 'gcf', 'gd', 'gl', 'gn', 'gom', 'gom-deva', 'gom-latn', 'got', 'grc', 'gsw', 'gu', 'gv', 'ha', 'hak', 'haw', 'hi', 'hif', 'hif-deva', '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', 'kbd-latn', 'kg', 'ki', 'kiu', 'kj', 'kk', 'kk-cyrl', 'kk-kz', 'kk-latn', 'kk-tr', 'kl', 'km', 'kn', 'ko', 'koi', 'ko-kp', 'ko-kr', 'kr', 'krc', 'kri', 'krj', 'ks-deva', 'ksh', 'ku', 'ku-latn', 'kv', 'kw', 'ky', 'la', 'lad', 'lb', 'lbe', 'lez', 'lfn', 'lg', 'li', 'lij', 'liv', 'lmo', 'ln', 'lo', 'loz', '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', 'na', 'nah', 'nan', 'nap', 'nb', 'nds', 'nds-nl', 'ne', 'new', 'ng', 'niu', 'nl', 'nl-informal', 'nn', 'no', 'nov', 'nrm', 'nso', 'nv', 'ny', 'oc', 'olo', 'om', 'or', 'os', 'pa', 'pag', 'pam', 'pap', 'pcd', 'pdc', 'pdt', 'pfl', 'pi', 'pih', 'pl', 'pms', 'pnt', 'prg', 'pt', 'pt-br', 'pt-cv', 'pt-pt', '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', 'scd', 'scn', 'sco', 'sdc', 'se', 'sei', 'ses', 'sg', 'sgs', 'sh', 'sh-cyrl', 'shi', 'shi-latn', 'sh-latn', 'shi-tfng', 'shn', 'si', 'simple', 'sk', 'sl', 'sli', 'sm', 'sma', 'sn', 'so', 'sq', 'sr', 'sr-cyrl', 'sr-ec', 'sr-el', 'sr-latn', '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-latn', 'uk', 'uz', 'uz-cyrl', 'uz-latn', 've', 'vec', 'vep', 'vi', 'vls', 'vmf', 'vo', 'vot', 'vro', 'wa', 'war', 'wo', 'wuu', 'xal', 'xh', 'xmf', '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-wuu', 'zh-yue', 'zu' }

-- Build the inverted map of languages to direction returned by this data module (fast, but collisions are not checked: run the test module) for _, lang in ipairs(rtlLangs) do p[lang] = true end for _, lang in ipairs(ltrLangs) do p[lang] = false end

-- Also store the two lists (at boolean indice), used by the test module to check the inverted map p[true] = rtlLangs p[false] = ltrLangs

return p