Anonymous user
Module:Lang/data: Difference between revisions
Jump to navigation
Jump to search
+hno, pnb, skr as ISO 15919;
Richardpruen (talk | contribs) m (1 revision imported) |
(+hno, pnb, skr as ISO 15919;) |
||
Line 1: | Line 1: | ||
local lang_obj = mw.language.getContentLanguage(); | |||
local this_wiki_lang_tag = lang_obj.code; -- get this wiki's language tag | |||
--[[--------------------------< L A N G _ N A M E _ T A B L E >------------------------------------------------ | --[[--------------------------< L A N G _ N A M E _ T A B L E >------------------------------------------------ | ||
Line 42: | Line 46: | ||
end | end | ||
local | local lang_name_table_t = { | ||
lang = key_to_lower ('Module:Language/data/iana languages', 'lang'), | lang = key_to_lower ('Module:Language/data/iana languages', 'lang'), | ||
lang_dep = key_to_lower ('Module:Language/data/iana languages', 'lang_dep'), | lang_dep = key_to_lower ('Module:Language/data/iana languages', 'lang_dep'), | ||
Line 50: | Line 54: | ||
suppressed = key_to_lower ('Module:Language/data/iana suppressed scripts', 'var_sup'), -- script keys are capitalized; set to lower | suppressed = key_to_lower ('Module:Language/data/iana suppressed scripts', 'var_sup'), -- script keys are capitalized; set to lower | ||
} | } | ||
--[[--------------------------< I 1 8 N M E D I A W I K I O V E R R I D E >-------------------------------- | |||
For internationalization; not used at en.wiki | |||
The language names taken from the IANA language-subtag-registry file are given in English. That may not be ideal. | |||
Translating ~8,000 language names is also not ideal. MediaWiki maintains (much) shorter lists of language names | |||
in most languages for which there is a Wikipedia edition. When desired, Module:Lang can use the MediaWiki | |||
language list for the local language. | |||
Caveat lector: the list of MediaWiki language names for your language may not be complete or may not exist at all. | |||
When incomplete, MediaWiki's list will 'fall back' to another language (typically English). When that happens | |||
add an appropriate entry to the override table below. | |||
Caveat lector: the list of MediaWiki language names for your language may not be correct. At en.wiki, the | |||
MediaWiki language names do not agree with the IANA language names for these ISO 639-1 tags. Often it is simply | |||
spelling differences: | |||
bh: IANA: Bihari languages MW: Bhojpuri – the ISO 639-3 tag for Bhojpuri is bho | |||
bn: IANA: Bengali MW: Bangla – Bengali is the exonym, Bangla is the endonym | |||
dv: IANA: Dhivehi MW: Divehi | |||
el: IANA: Modern Greek MW: Greek | |||
ht: IANA: Haitian MW: Haitian Creole | |||
ky: IANA: Kirghiz MW: Kyrgyz | |||
li: IANA: Limburgan MW: Limburgish | |||
or: IANA: Oriya MW: Odia | |||
os: IANA: Ossetian MW: Ossetic | |||
"pa: IANA: Panjabi MW: Punjabi | |||
"ps: IANA: Pushto MW: Pashto | |||
"to: IANA: Tonga MW: Tongan | |||
"ug: IANA: Uighur MW: Uyghur | |||
use the override table to override language names that are incorrect for your project | |||
To see the list of names that MediaWiki has for your language, enter this in the Debug colsole: | |||
=mw.dumpObject (mw.language.fetchLanguageNames ('<tag>', 'all')) | |||
(replacing <tag> with the language tag for your language) | |||
Use of the MediaWiki language names lists is enabled when media_wiki_override_enable is set to boolean true. | |||
]] | |||
local media_wiki_override_enable = false; -- set to true to override IANA names with MediaWiki names; always false at en.wiki | |||
-- caveat lector: the list of MediaWiki language names for your language may not be complete or may not exist at all | |||
if true == media_wiki_override_enable then | |||
local mw_languages_by_tag_t = mw.language.fetchLanguageNames (this_wiki_lang_tag, 'all'); -- get a table of language tag/name pairs known to MediaWiki | |||
for tag, name in pairs (mw_languages_by_tag_t) do -- loop through each tag/name pair in the MediaWiki list | |||
if lang_name_table_t.lang[tag] then -- if the tag is in the main list | |||
lang_name_table_t.lang[tag] = name; -- overwrite exisiting name with the name from MediaWiki | |||
end | |||
end | |||
end | |||
Line 120: | Line 175: | ||
["alv"] = "Atlantic–Congo languages", -- to match en.wiki article title (endash) | ["alv"] = "Atlantic–Congo languages", -- to match en.wiki article title (endash) | ||
["arc"] = "Aramaic", | ["arc"] = "Imperial Aramaic (700-300 BCE)", -- Official Aramaic (700-300 BCE), Imperial Aramaic (700-300 BCE); to match en.wiki article title uses ISO639-2 'preferred' name | ||
["art"] = "constructed", -- to match en.wiki article; lowercase for category name | ["art"] = "constructed", -- to match en.wiki article; lowercase for category name | ||
["bhd"] = "Bhadarwahi", -- Bhadrawahi; to match en.wiki article title | ["bhd"] = "Bhadarwahi", -- Bhadrawahi; to match en.wiki article title | ||
Line 135: | Line 190: | ||
["frs"] = "East Frisian Low Saxon", -- Eastern Frisian | ["frs"] = "East Frisian Low Saxon", -- Eastern Frisian | ||
["gsw-fr"] = "Alsatian", -- match MediaWiki | ["gsw-fr"] = "Alsatian", -- match MediaWiki | ||
["haa"] = "Hän", -- Han; to match en.wiki article title | |||
["hmx"] = "Hmong–Mien languages", -- to match en.wiki article title (endash) | ["hmx"] = "Hmong–Mien languages", -- to match en.wiki article title (endash) | ||
["ilo"] = "Ilocano", -- Iloko; to match en.wiki article title | ["ilo"] = "Ilocano", -- Iloko; to match en.wiki article title | ||
Line 157: | Line 213: | ||
["orv"] = "Old East Slavic", -- Old Russian | ["orv"] = "Old East Slavic", -- Old Russian | ||
["pfl"] = "Palatine German", -- Pfaelzisch; to match en.wiki article | ["pfl"] = "Palatine German", -- Pfaelzisch; to match en.wiki article | ||
["pie"] = "Piro Pueblo", -- Piro; to match en.wiki article | |||
["pms"] = "Piedmontese", -- Piemontese; to match en.wiki article title | ["pms"] = "Piedmontese", -- Piemontese; to match en.wiki article title | ||
["pnb"] = "Punjabi (Western)", -- Western Panjabi; dab added to override import from ~/wp languages and distinguish pnb from pa in reverse look up tag_from_name() | ["pnb"] = "Punjabi (Western)", -- Western Panjabi; dab added to override import from ~/wp languages and distinguish pnb from pa in reverse look up tag_from_name() | ||
["rop"] = "Australian Kriol", -- Kriol; en.wiki article is a dab; point to correct en.wiki article | |||
["sdo"] = "Bukar–Sadong", -- Bukar-Sadung Bidayuh; to match en.wiki article title | ["sdo"] = "Bukar–Sadong", -- Bukar-Sadung Bidayuh; to match en.wiki article title | ||
["stq"] = "Saterland Frisian", -- Saterfriesisch | ["stq"] = "Saterland Frisian", -- Saterfriesisch | ||
Line 246: | Line 304: | ||
------------------------------< P R I V A T E _ U S E _ T A G S >---------------------------------------------- | ------------------------------< P R I V A T E _ U S E _ T A G S >---------------------------------------------- | ||
["alg-x-proto"] = "Proto-Algonquian", -- alg in IANA is Algonquian languages | |||
["cel-x-proto"] = "Proto-Celtic", -- cel in IANA is Celtic languages | ["cel-x-proto"] = "Proto-Celtic", -- cel in IANA is Celtic languages | ||
["gem-x-proto"] = "Proto-Germanic", -- gem in IANA is Germanic languages | ["gem-x-proto"] = "Proto-Germanic", -- gem in IANA is Germanic languages | ||
Line 436: | Line 495: | ||
['gu'] = 'ISO 15919 Indic', | ['gu'] = 'ISO 15919 Indic', | ||
['hi'] = 'ISO 15919 Indic', | ['hi'] = 'ISO 15919 Indic', | ||
['hno'] = 'ISO 15919 Indic', | |||
['inc'] = 'ISO 15919 Indic', | ['inc'] = 'ISO 15919 Indic', | ||
['kn'] = 'ISO 15919 Indic', | ['kn'] = 'ISO 15919 Indic', | ||
Line 448: | Line 508: | ||
['or'] = 'ISO 15919 Indic', | ['or'] = 'ISO 15919 Indic', | ||
['pa'] = 'ISO 15919 Indic', | ['pa'] = 'ISO 15919 Indic', | ||
['pnb'] = 'ISO 15919 Indic', | |||
['raj'] = 'ISO 15919 Indic', | ['raj'] = 'ISO 15919 Indic', | ||
['sa'] = 'ISO 15919 Indic', | ['sa'] = 'ISO 15919 Indic', | ||
Line 453: | Line 514: | ||
['sd'] = 'ISO 15919 Indic', | ['sd'] = 'ISO 15919 Indic', | ||
['si'] = 'ISO 15919 Indic', | ['si'] = 'ISO 15919 Indic', | ||
['skr'] = 'ISO 15919 Indic', | |||
['ta'] = 'ISO 15919 Indic', | ['ta'] = 'ISO 15919 Indic', | ||
['tcy'] = 'ISO 15919 Indic', | ['tcy'] = 'ISO 15919 Indic', | ||
Line 473: | Line 535: | ||
['jyutping'] = { | ['jyutping'] = { | ||
['default'] = 'Jyutping transliteration', | ['default'] = 'Jyutping transliteration', | ||
}, | |||
['mlcts'] = { | |||
['default'] = 'Myanmar Language Commission Transcription System', | |||
}, | }, | ||
Line 530: | Line 596: | ||
return | return | ||
{ | { | ||
this_wiki_lang_tag = this_wiki_lang_tag, | |||
this_wiki_lang_dir = lang_obj:getDir(), -- wiki's language direction | |||
article_name = article_name, | article_name = article_name, | ||
lang_name_table = | lang_name_table = lang_name_table_t, | ||
override = override, | override = override, | ||
rtl_scripts = rtl_scripts, | rtl_scripts = rtl_scripts, |