This project contains helpers to aid in the development of libraries and programs that require i18n support. It doesn't perform i18n itself, that is delegated to go-i18n. Rather it aims to provide functionality that makes using go-i18n easier. For example, implementing localised error messages can be a bit tedious and error prone so included within this module is a cli app, lingo, that can generate all error related code (PS, this has not been implemented yet, so is still in the works).
- unit testing with Ginkgo/Gomega
- i18n with go-i18n
- linting configuration and pre-commit hooks, (see: linting-golang).
This template has been setup to support localisation. The default language is en-GB
with support for en-US
. There is a translation file for en-US
defined as src/i18n/deploy/arcadia.active.en-US.json. This is the initial translation for en-US
that should be deployed with the app.
Make sure that the go-i18n package has been installed so that it can be invoked as cli, see go-i18n for installation instructions.
To maintain localisation of the application, the user must take care to implement all steps to ensure translate-ability of all user facing messages. Whenever there is a need to add/change user facing messages including error messages, to maintain this state, the user must:
- define template struct (xxxTemplData) in src/i18n/messages.go and corresponding Message() method. All messages are defined here in the same location, simplifying the message extraction process as all extractable strings occur at the same place. Please see go-i18n for all translation/pluralisation options and other regional sensitive content.
For more detailed workflow instructions relating to i18n, please see i18n README. For details on how defining translate-able content can be achieved consistently, see Defining Content