Module:Dir/RTL overrides

From The FunKey Wiki

Documentation for this module may be created at Module:Dir/RTL overrides/doc

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', 'ary', 'arz', 'azb', 'bcc', 'bgn', 'bqi', 'ckb', 'dv', 'fa', 'fa-af', 'glk', 'ha-arab', 'he', 'khw', 'kk-arab', 'kk-cn', 'ks-arab', 'ku-arab', 'lki', 'lrc', 'luz', 'mzn', 'nqo', 'ota', 'pnb', 'prd', 'ps', 'sd', 'sdh', 'skr', 'skr-arab', 'ug', 'ug-arab', 'ur', 'uz-arab', 'ydd', 'yi' }

local ltrLangs = { 'aa', 'ab', 'abs', 'ace', 'ady', 'ady-cyrl', 'aeb-latn', 'af', 'ak', 'aln', 'als', 'alt', 'am', 'ami', 'an', 'ang', 'anp', 'arn', 'as', 'ase', 'ast', 'atj', 'av', 'avk', 'awa', 'ay', 'az', 'ba', 'ban', 'ban-bali', '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', 'btm', 'bto', 'bu', 'bug', 'bxr', 'ca', 'cbk-zam', 'cdo', 'ce', 'ceb', 'ch', 'cho', 'chr', 'chy', 'co', 'cop', 'cps', 'cr', 'crh', 'crh-cyrl', 'crh-latn', 'cs', 'csb', 'cu', 'cv', 'cy', 'da', 'de', 'de-at', 'de-ch', 'de-formal', 'din', 'diq', 'dsb', 'dtp', 'dty', 'dz', 'ee', 'egl', 'el', 'eml', 'en', 'en-ca', 'en-gb', 'en-ie', 'en-us', 'eo', 'es', 'es-419', 'es-formal', 'et', 'eu', 'ext', 'ff', 'fi', 'fil', 'fit', 'fiu-vro', 'fj', 'fkv', 'fo', 'fr', 'frc', 'fro', 'frp', 'frr', 'fur', 'fy', 'ga', 'gag', 'gan', 'gan-hans', 'gan-hant', 'gcf', 'gcr', 'gd', 'gl', 'gn', 'gom', 'gom-deva', 'gom-latn', 'gor', 'got', 'grc', 'gsw', 'gu', 'gv', 'ha', 'hak', 'haw', 'hi', 'hif', 'hif-deva', 'hif-latn', 'hil', 'hmn', 'ho', 'hr', 'hrx', 'hsb', 'ht', 'hu', 'hu-formal', 'hy', 'hyw', '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', 'kbp', 'kcg', 'kea', 'kg', 'ki', 'kiu', 'kj', 'kjp', 'kk', 'kk-cyrl', 'kk-kz', 'kk-latn', 'kk-tr', 'kl', 'km', 'kn', 'ko', 'ko-kp', 'ko-kr', 'koi', 'kr', 'krc', 'kri', 'krj', 'krl', 'ks', 'ks-deva', 'ksh', 'ku', 'ku-latn', 'kum', 'kv', 'kw', 'ky', 'la', 'lad', 'lb', 'lbe', 'lez', 'lfn', 'lg', 'li', 'lij', 'liv', 'lld', 'lmo', 'ln', 'lo', 'loz', 'lt', 'ltg', 'lus', 'lv', 'lzh', 'lzz', 'mad', 'mai', 'map-bms', 'mdf', 'mg', 'mh', 'mhr', 'mi', 'min', 'mk', 'ml', 'mn', 'mni', 'mnw', 'mo', 'mr', 'mrh', 'mrj', 'ms', 'mt', 'mus', 'mwl', 'my', 'myv', 'na', 'nah', 'nan', 'nap', 'nb', 'nds', 'nds-nl', 'ne', 'new', 'ng', 'nia', 'niu', 'nl', 'nl-informal', 'nn', 'no', 'nod', 'non', 'nov', 'nrf', 'nrf-fr', 'nrf-gg', 'nrf-je', 'nrm', 'nso', 'nv', 'ny', 'nys', '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', 'quc', 'qug', 'rgn', 'rif', 'rm', 'rmf', 'rmy', 'rn', 'ro', 'roa-rup', 'roa-tara', 'ru', 'rue', 'rup', 'ruq', 'ruq-cyrl', 'ruq-latn', 'rw', 'rwr', 'sa', 'sah', 'sat', 'sc', 'scd', 'scn', 'sco', 'sdc', 'se', 'sei', 'ses', 'sg', 'sgs', 'sh', 'sh-cyrl', 'sh-latn', 'shi', 'shi-latn', 'shi-tfng', 'shn', 'shy-latn', 'si', 'simple', 'sjd', 'sje', 'sju', 'sk', 'sl', 'sli', 'sm', 'sma', 'smj', 'smn', 'sms', 'sn', 'so', 'sq', 'sr', 'sr-cyrl', 'sr-ec', 'sr-el', 'sr-latn', 'srn', 'srq', 'ss', 'st', 'stq', 'sty', 'su', 'sv', 'sw', 'szl', 'szy', 'ta', 'tay', 'tcy', 'te', 'tet', 'tg', 'tg-cyrl', 'tg-latn', 'th', 'ti', 'tk', 'tl', 'tly', 'tn', 'to', 'tokipona', 'tpi', 'tr', 'tru', 'trv', 'ts', 'tt', 'tt-cyrl', 'tt-latn', 'tum', 'tw', 'ty', 'tyv', 'tzl', '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', 'xsy', 'yo', 'yue', 'za', 'zea', 'zgh', '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