talira

locales (Go)

Go locale data and formatting functions generated from Unicode CLDR

open sourceMITfree

locales is a Go library of locales generated from the Unicode CLDR data: for each locale it has cardinal, ordinal and range plural rules, month, weekday and time zone names, date and time formatting, and number, currency, accounting and percent formatting. It works on its own or inside an i18n package, and was built for go-playground's Universal Translator. Only the Gregorian calendar is supported.

Problems it solves

  • format dates and currency amounts the way each country writes them in my Go service
  • pick the right plural form of a word for each language in my Go app's messages
  • show month and weekday names in the user's language in a Go program without hand-writing translation tables

Features

  • plural rules (cardinal, ordinal and range) for each CLDR locale
  • month, weekday and time zone translations
  • date, time, number, currency, accounting and percent formatting

Limitations

  • Supports the Gregorian calendar only.1
  • Its locale data comes from CLDR 36.0.1.1

Alternatives

The same job

These do what locales (Go) does.

  1. universal-translator i18n translator for Go using CLDR data and plural rules

Compare locales (Go) with the top 3