Content deleted Content added
keep track of {} in a consistent manner; add internationalisation for ordinals |
return ordinal numbers for century and millenium |
||
Line 105:
loadI18n()
-- this function needs to be internationalised along with the above:
-- we need three exceptions in English for 1st, 2nd, 3rd
-- takes cardinal numer as a numeric and returns the ordinal as a string
local function makeOrdinal(cardinal)
local ordsuffix = i18n.ordinal.default
if cardinal % 10 == 1 then
ordsuffix = i18n.ordinal[1]
elseif cardinal % 10 == 2 then
ordsuffix = i18n.ordinal[2]
elseif cardinal % 10 == 3 then
ordsuffix = i18n.ordinal[3]
end
return tostring(cardinal) .. ordsuffix
end
local function printError(code)
Line 187 ⟶ 202:
end
-- precision is decades (8), centuries (7) and millennia (6)
local era, card
if precision == 6 then
if precision == 6 then era = mw.ustring.gsub(i18n.datetime[6], "$1", tostring(math.floor((math.abs(intyear) - 1) / 1000) + 1)) end▼
end
if precision == 7 then
card = math.floor((intyear - 1) / 100) + 1
era = mw.ustring.gsub(i18n.datetime[7], "$1", makeOrdinal(card))
end
if precision == 8 then
▲
end
if era then
if addon ~= "" then
|