mirror of
https://github.com/spf13/cobra
synced 2024-11-18 03:37:11 +00:00
39 lines
1.2 KiB
Markdown
39 lines
1.2 KiB
Markdown
|
# Locales
|
||
|
|
||
|
Localization uses embedded _gettext_ files, defaulting to English
|
||
|
when locale cannot be guessed from environment variables.
|
||
|
|
||
|
|
||
|
## Development Flow
|
||
|
|
||
|
1. Add calls to `gotext.Get(…)` somewhere in the codebase
|
||
|
2. Run `make i18n_extract`
|
||
|
3. Update the `PO` files with some software like [Poedit]
|
||
|
4. Make sure your software has also updated the `MO` files
|
||
|
|
||
|
[Poedit]: https://poedit.net/
|
||
|
|
||
|
## 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 :
|
||
|
- [ISO 639-3](https://fr.wikipedia.org/wiki/ISO_639-3) _(eg: eng, fra, …)_
|
||
|
- [BCP 47](https://fr.wiktionary.org/wiki/Wiktionnaire:BCP_47/language-2) _(eg: en, fr, …)_
|
||
|
|
||
|
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.
|
||
|
|