Skip to content
Formats in catalogs

Formats in catalogs

Since v0.3.0

The format and relative sections of a catalog, which i18n.Date, Time, DateTime, Format, Currency, Ago, Duration and LanguageName use, and the date pattern fields. The framework’s English values are in i18n/locales/en.yaml; a language’s come from anetos lang:add (Numbers, dates and languages). A key a locale lacks comes from its parents, then English (the app’s en catalogs, then the framework’s), never from a fallback locale in another language.

format

KeyValueEnglish
format.languageThe language’s name in itselfEnglish
format.months12 month names, January first, as in dates (MMMM)[January, …]
format.months_short12 abbreviations (MMM)[Jan, …]
format.months_standaloneOptional: 12 names on their own (LLLL), for languages whose month names change in a date (Russian марта, март)—
format.days7 day names, Sunday first (EEEE)[Sunday, …]
format.days_short7 abbreviations (EEE)[Sun, …]
format.periodsBefore and after noon (a)[AM, PM]
format.date.short … fullDate patterns of the four stylesM/d/yy, MMM d, y, MMMM d, y, EEEE, MMMM d, y
format.time.short … fullTime patternsh:mm a, h:mm:ss a, h:mm:ss a z, h:mm:ss a zzzz
format.datetime.short … fullHow DateTime joins them: {date}, {time}{date}, {time}; {date} at {time} (long, full)
format.currencyWhere Currency puts {symbol} and {amount} ({code}: the ISO code){symbol}{amount}
format.numberingOptional: a CLDR numbering system for numbers and dates, instead of the language’s (latn for 0–9)—

A symbol of letters next to the amount gets a no-break space (BDT 1,250.00), as CLDR does; a negative amount gets a minus sign in front.

Date pattern fields

Patterns follow CLDR’s date format patterns, the subset below. Numbers use the locale’s digits.

FieldShowsExample (Friday 16 January 2026, 02:04:05 in Dhaka)
y, yyyyYear2026
yyTwo-digit year26
M, MMMonth number1, 01
MMM, MMMMMonth name, short and fullJan, January
MMMMMIts first letterJ
LLL, LLLL, LLLLLThe same, standalone formsJan, January, J
d, ddDay of the month16, 16
E, EE, EEEShort day nameFri
EEEEDay nameFriday
EEEEEIts first letterF
aPeriodAM
h, hhHour, 1–122, 02
H, HHHour, 0–232, 02
m, mmMinute4, 04
s, ssSecond5, 05
zZone abbreviation+06
zzzzZone’s IANA name (the abbreviation for a zone without one)Asia/Dhaka
'text'Literal text'at'
''A single quote, in quoted text tooh 'o''clock' → 2 o'clock

Other letters are shown as they are: Y (week year), G, Q, w, k and the rest of CLDR’s fields aren’t supported.

relative

KeyValueEnglish
relative.nowUnder 45 secondsjust now
relative.pastA past time; {time} is the duration{time} ago
relative.futureA future timein {time}
relative.units.second … yearPlural messages for {count} units: second, minute, hour, day, month, year{one: "{count} hour", other: "{count} hours"}

Duration shows the largest unit, rounded to the nearest: from 45 seconds a minute, from 45 minutes an hour, from 22 hours a day, from 26 days a month (30 days), from 345 days a year (365 days). DurationUp rounds up, for waits. Ago of a zero time is “”.

Limits

Numbers follow the CLDR data in golang.org/x/text, which lags CLDR in places: Spanish groups four-digit numbers (1.234, CLDR 1234), French groups with a no-break space (U+00A0, CLDR U+202F), and the many plural category of French and Spanish (1 000 000 de jours) isn’t used.