Content deleted Content added
add getImageLegend function |
fix makeOrdinal to account for 11th, 12th, 13th, etc. |
||
Line 107:
-- 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
▲-- we need three exceptions in English for 1st, 2nd, 3rd, 21st, .. 31st, etc.
local function makeOrdinal (cardinal)
local ordsuffix = i18n.ordinal.default
if cardinal % 10 == 1 then
Line 117:
elseif cardinal % 10 == 3 then
ordsuffix = i18n.ordinal[3]
end
-- In English, 1, 21, 31, etc. use 'st', but 11, 111, etc. use 'th'
-- similarly for 12 and 13, etc.
if (cardinal % 100 == 11) or (cardinal % 100 == 12) or (cardinal % 100 == 13) then
ordsuffix = i18n.ordinal.default
end
return tostring(cardinal) .. ordsuffix
|