モジュール:I18n/ordinal
表示
モジュールの解説[作成]
local p = {}
--[[ Different languages use different schemes for ordinals, and some of these schemes are shared between languages.
"SchemeFromLang" picks an ordinal scheme based on a specified language.
All unlisted languages default to the "period-scheme", i.e. "104." is the ordinal for the value "104".
Languages will follow the regular language fallback chain. For example, "de-formal" would fallback to scheme for "de",
and only if that does not exist would the "period-scheme" be used.
]]
p.SchemeFromLang = {
['bn'] = 'bn-scheme', -- Bengali
['br'] = 'br-scheme', -- Breton
['cs'] = 'period-scheme', -- Czech
['da'] = 'period-scheme', -- Danish
['de'] = 'period-scheme', -- German
['el'] = 'el-scheme', -- Greek
['en'] = 'en-scheme', -- English
['eo'] = 'eo-scheme', -- Esperanto
['es'] = 'es-scheme', -- Spanish
['et'] = 'period-scheme', -- Estonian
['fa'] = 'fa-scheme', -- Persian
['fi'] = 'period-scheme', -- Finnish
['fr'] = 'fr-scheme', -- French
['hr'] = 'period-scheme', -- Croatian
['hu'] = 'period-scheme', -- Hungarian
['hy'] = 'hy-scheme', -- Armenian
['ia'] = 'ia-scheme', -- Interlingua
['it'] = 'romance-scheme', -- Italian
['ja'] = 'ja-scheme', -- Japanese
['km'] = 'km-scheme', -- Khmer
['ko'] = 'ko-scheme', -- Korean
['la'] = 'la-scheme', -- Latin
['lo'] = 'lo-scheme', -- Laothian
['mk'] = 'mk-scheme', -- Macedonian
['ml'] = 'ml-scheme', -- Malayalam
['ms'] = 'ms-scheme', -- Malay
['nds'] = 'period-scheme', -- Low German
['nl'] = 'nl-scheme', -- Dutch
['no'] = 'no-scheme', -- Norwegian
['pl'] = 'pl-scheme', -- Polish
['pt'] = 'romance-scheme', -- Portuguese
['ru'] = 'ru-scheme', -- Russian
['sk'] = 'period-scheme', -- Slovak
['sl'] = 'period-scheme', -- Slovene
['sv'] = 'sv-scheme', -- Swedish
['th'] = 'th-scheme', -- Thai
['zh'] = 'zh-scheme', -- Chinese
}
--[[ Text used to internationalize the various schemes.
Styles are supported by suffixing "/style" to key.
Styles that are superscripted set "superscript" to true.
Scheme set was developed to match the output of the pre-Lua {{Ordinal}} template, preserved as {{Ordinal/old}}
]]
p.Scheme = {
-- the null scheme, i.e. just the number
['null-scheme'] = {
},
-- the period scheme, i.e. "<value>." used for at least: cs, de, fi, hu
['period-scheme'] = {
rules = 'suffix',
suffix = '.'
},
-- the English scheme, i.e. "1st", "2nd", "3rd", "4th".
['en-scheme'] = {
rules = 'skip-tens',
superscript = true,
suffix = 'th',
suffix_1 = 'st',
suffix_2 = 'nd',
suffix_3 = 'rd',
},
-- the English scheme using the "d" style, i.e. "23d".
['en-scheme/d'] = {
rules = 'suffix',
suffix = 'd'
},
-- Bengali
['bn-scheme'] = {
rules = 'mod10-suffix',
superscript = true,
suffix_0 = 'ম',
suffix_1 = 'ম',
suffix_2 = 'য়',
suffix_3 = 'য়',
suffix_4 = 'র্থ়',
suffix_5 = 'ম',
suffix_6 = 'ষ্ঠ',
suffix_7 = 'ম',
suffix_8 = 'ম',
suffix_9 = 'ম',
},
-- Breton
['br-scheme'] = {
rules = 'suffix',
suffix = '-vet',
formatlang = 'eo' -- pre-Lua {{Ordinal}} template used "eo" number formatting for "br" ordinals
},
-- Greek
-- not exact. see distinct declentions in: wiktionary:Category:Greek ordinal numbers
['el-scheme'] = {
rules = 'gendered-suffix',
suffix = 'ος',
suffix_m = 'ος',
suffix_f = 'η',
suffix_n = 'ο',
},
-- Esperanto
['eo-scheme'] = {
rules = 'suffix',
suffix = '-a',
},
-- Romance (Italian, Portuguese)
['romance-scheme'] = {
rules = 'gendered-suffix',
superscript = true,
period = false,
suffix = 'o',
suffix_m = 'o',
suffix_f = 'a',
suffix_n = 'o',
},
-- Spanish
['es-scheme'] = {
rules = 'gendered-suffix',
superscript = true,
period = true,
suffix = 'o',
suffix_m = 'o',
suffix_f = 'a',
suffix_n = 'o',
},
-- Persian
['fa-scheme'] = {
rules = 'suffix',
suffix = 'م',
},
-- French
['fr-scheme'] = {
rules = 'gendered-suffix-one',
superscript = true,
suffix = 'e',
suffix_1 = 'e',
suffix_1_m = 'er',
suffix_1_f = 're',
suffix_1_n = 'e',
},
-- the French scheme using the "roman" style ("roman year" is a supported alias for "roman")
['fr-scheme/roman'] = {
rules = 'gendered-suffix-one',
superscript = true,
suffix = 'e',
suffix_1 = 'e',
suffix_1_m = 'er',
suffix_1_f = 're',
suffix_1_n = 'е',
formatlang = 'roman'
},
-- Armenian
['hy-scheme'] = {
rules = 'suffix-one',
suffix = '-րդ',
suffix_1 = '-ին',
},
-- Interlingua
['ia-scheme'] = {
rules = 'mod10-suffix',
superscript = true,
suffix_0 = 'te',
suffix_1 = 'me',
suffix_2 = 'nde',
suffix_3 = 'tie',
suffix_4 = 'te',
suffix_5 = 'te',
suffix_6 = 'te',
suffix_7 = 'me',
suffix_8 = 've',
suffix_9 = 'ne',
},
-- Khmer
['km-scheme'] = {
rules = 'prefix',
prefix = 'ទ',
},
-- Japanese
-- this is for the adjective in undetermined order before noun; otherwise Japanese use: <cardinal number><noun>目
['ja-scheme'] = {
rules = 'prefix',
prefix = '第',
},
-- Latin
['la-scheme'] = {
rules = 'suffix',
superscript = true,
suffix = 'o',
formatlang = 'roman'
},
-- Laothian
['lo-scheme'] = {
rules = 'prefix',
prefix = 'ທີ່',
},
-- Korean
['ko-scheme'] = {
rules = 'suffix',
suffix = '째',
},
-- Macedonian
['mk-scheme'] = {
rules = 'mod10-suffix',
suffix_0 = '-тиот',
suffix_1 = '-виот',
suffix_2 = '-риот',
suffix_3 = '-иот',
suffix_4 = '-иот',
suffix_5 = '-тиот',
suffix_6 = '-иот',
suffix_7 = '-миот',
suffix_8 = '-миот',
suffix_9 = '-тиот',
},
-- Malayalam
['ml-scheme'] = {
rules = 'suffix',
suffix = '-മത്തെ',
},
-- Malay
['ms-scheme'] = {
rules = 'prefix',
prefix = 'ke-',
},
-- Dutch
['nl-scheme'] = {
rules = 'suffix',
suffix = 'e',
},
--Norwegian
['no-scheme'] = {
rules = 'skip-tens',
superscript = true,
suffix = 'de',
suffix_1 = 'ste',
suffix_2 = 'dre',
suffix_3 = 'dje',
suffix_5 = 'te',
suffix_6 = 'te',
},
-- Polish
['pl-scheme'] = {
rules = 'mod10-gendered-suffix-skip-tens',
suffix = '-ty',
suffix_f = '-ta',
suffix_n = '-te',
suffix_1 = '-szy',
suffix_1_f = '-sza',
suffix_1_n = '-sze',
suffix_2 = '-gi',
suffix_2_f = '-ga',
suffix_2_n = '-gie',
suffix_3 = '-ci',
suffix_3_f = '-cia',
suffix_3_n = '-cie',
suffix_7 = '-my',
suffix_7_f = '-ma',
suffix_7_n = '-me',
suffix_8 = '-my',
suffix_8_f = '-ma',
suffix_8_n = '-me',
},
-- Russian
['ru-scheme'] = {
rules = 'gendered-suffix',
suffix = '-й',
suffix_m = '-й',
suffix_f = '-я',
suffix_n = '-е',
},
-- Swedish
['sv-scheme'] = {
rules = 'skip-tens',
suffix = ':e',
suffix_1 = ':a',
suffix_2 = ':a',
},
['th-scheme'] = {
rules = 'prefix',
prefix = 'ที่',
},
['zh-scheme'] = {
rules = 'prefix',
prefix = '第',
},
}
return p