Module:LatestUpdate: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Added Plural rules for different languages |
Add special-case "today"/"yesterday" wording for 0/1 days, with translations for all supported languages (with help from vergir-bot LLM) |
||
| Line 177: | Line 177: | ||
-- [1] = "há %d dia", | -- [1] = "há %d dia", | ||
-- [2] = "há %d dias" | -- [2] = "há %d dias" | ||
-- } | |||
} | |||
-- Special-case wording for 0 and 1 days, keyed by day count. | |||
-- A language missing an entry here falls back to the plural forms above. | |||
local relative_days = { | |||
en = { | |||
[0] = "today", | |||
[1] = "yesterday" | |||
}, | |||
es = { | |||
[0] = "hoy", | |||
[1] = "ayer" | |||
}, | |||
fr = { | |||
[0] = "aujourd'hui", | |||
[1] = "hier" | |||
}, | |||
ko = { | |||
[0] = "오늘", | |||
[1] = "어제" | |||
}, | |||
ru = { | |||
[0] = "сегодня", | |||
[1] = "вчера" | |||
}, | |||
tr = { | |||
[0] = "bugün", | |||
[1] = "dün" | |||
}, | |||
cs = { | |||
[0] = "dnes", | |||
[1] = "včera" | |||
}, | |||
["zh-hans"] = { | |||
[0] = "今天", | |||
[1] = "昨天" | |||
}, | |||
["zh-hant"] = { | |||
[0] = "今天", | |||
[1] = "昨天" | |||
}, | |||
-- uncomment when needed | |||
-- pl = { | |||
-- [0] = "dzisiaj", | |||
-- [1] = "wczoraj" | |||
-- }, | |||
-- uk = { | |||
-- [0] = "сьогодні", | |||
-- [1] = "вчора" | |||
-- }, | |||
-- de = { | |||
-- [0] = "heute", | |||
-- [1] = "gestern" | |||
-- }, | |||
-- it = { | |||
-- [0] = "oggi", | |||
-- [1] = "ieri" | |||
-- }, | |||
-- pt = { | |||
-- [0] = "hoje", | |||
-- [1] = "ontem" | |||
-- } | -- } | ||
} | } | ||
| Line 240: | Line 317: | ||
local days = p.days_since() | local days = p.days_since() | ||
local relative = relative_days[lang] | |||
if relative and relative[days] then | |||
return relative[days] | |||
end | |||
local plural_rule = plural_rules[lang] or plural_rules.en | local plural_rule = plural_rules[lang] or plural_rules.en | ||