Skip to content
Zack Guard edited this page May 28, 2019 · 9 revisions

CPod is available in a number of languages thanks to contributors.

Translation files are located in the locales directory.

To start a new translation, create a new file in the locales directory.

Filenames

The filename must be the language's ISO 639-1 code in lowercase, followed optionally, in cases of regional variants, by an underscore and the country's ISO 3166-1 alpha-2 code in uppercase, with the file extension json.

Examples:

Locale Filename
English (generic) en.json
Portuguese (generic) pt.json
Portuguese (Brazilian) pt_BR.json
Chinese (Traditional) zh_TW.json
Chinese (Simplified) zh_CN.json

Typically a regional sub-code should only be added if the base locale already exists.

Translating

Copy the contents of the canonical English locale from en.json into the new file.

Replace each string with the translated equivalent.

Please ensure that the JSON syntax is correct, otherwise the file will be unreadable by CPod. GitHub's editor highlights errors in red.

If you are working on a downloaded copy of CPod, rather than directly on GitHub, you can make use of the bin/i18n-progress.js script to check that all keys have been translated. Simply pass in your locale name (filename, minus the .json) and it will display translation progress as a percentage and list all untranslated keys.

Aliases

In some cases it is desirable to create an empty locale which simply points to another locale. For example, the zh_HK (Chinese (Hong Kong)) locale points to zh_TW (Chinese (Traditional)).

This type of locale does not appear in CPod's languages list, but is called upon internally when CPod performs automatic locale detection.

To create such a locale alias, create a new file with a filename as described above. The file contents are as follows (zh_HK.json shown as an example)

{
  "__redirect__": "zh_TW"
}
Clone this wiki locally