Name: universal-translator
Owner: Go Playgound
Description: :speech_balloon: i18n Translator for Go/Golang using CLDR data + pluralization rules
Created: 2016-02-09 19:53:38.0
Updated: 2018-01-03 09:52:42.0
Pushed: 2017-03-27 19:17:04.0
Size: 5158
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|---|---|
Travis Cline | 2017-02-04 22:05:39.0 | 1 |
Justin Clift | 2016-11-29 06:46:05.0 | 1 |
Thanakom sangnetra | 2016-05-07 05:41:58.0 | 7 |
Samuel Kelemen | 2017-02-07 00:31:40.0 | 2 |
Dean Karn | 2017-03-27 19:17:03.0 | 54 |
Other Committers
User | Most Recent Commit | # Commits | |
---|---|---|---|
Dean Karn | dean.karn@metricaid.com | 2017-01-24 02:20:44.0 | 17 |
Universal Translator is an i18n Translator for Go/Golang using CLDR data + pluralization rules
Because none of the plural rules seem to be correct out there, including the previous implementation of this package, so I took it upon myself to create locales for everyone to use; this package is a thin wrapper around locales in order to store and translate text for use in your applications.
Use go get
et github.com/go-playground/universal-translator
Please see https://godoc.org/github.com/go-playground/universal-translator for usage docs
All types, Plain substitution, Cardinal, Ordinal and Range translations can all be contained withing the same file(s); they are only separated for easy viewing.
NOTE: not all fields are needed for all translation types, see examples
"locale": "en",
"key": "days-left",
"trans": "You have {0} day left.",
"type": "Cardinal",
"rule": "One",
"override": false
|Field|Description| |—|—| |locale|The locale for which the translation is for.| |key|The translation key that will be used to store and lookup each translation; normally it is a string or integer.| |trans|The actual translation text.| |type|The type of translation Cardinal, Ordinal, Range or “” for a plain substitution(not required to be defined if plain used)| |rule|The plural rule for which the translation is for eg. One, Two, Few, Many or Other.(not required to be defined if plain used)| |override|If you wish to override an existing translation that has already been registered, set this to 'true'. 99% of the time there is no need to define it.|
To anyone interesting in helping or contributing, I sure could use some help creating tests for each language. Please see issue here for details.
Distributed under MIT License, please see license file in code for more details.