mirror of
https://github.com/spf13/cobra
synced 2024-11-18 03:37:11 +00:00
ab14efa558
- Recipe to extract new translations from the Go code: `make i18n_extract` - Embedded `MO` files - Detect language from environment variables - Some strings were pluralized
1.2 KiB
1.2 KiB
Locales
Localization uses embedded gettext files, defaulting to English when locale cannot be guessed from environment variables.
Development Flow
- Add calls to
gotext.Get(…)
somewhere in the codebase - Run
make i18n_extract
- Update the
PO
files with some software like Poedit - Make sure your software has also updated the
MO
files
Overview
POT files
The *.pot
file(s) are automatically generated by the following command :
make i18n_extract
They are named <domain>.pot
, and when the domain is not specified, it is default
.
PO & MO files
The actual translation files, in gettext format (*.po
and *.mo
), are in the directory <domain>/
.
They are named <language>.po
and <language>.mo
.
The supported <language>
formats are :
The *.po
files are plain text, and are the authoritative sources of translations.
The *.mo
files are the ones actually packaged in cobra as embedded files, because they are smaller.