Translations¶
Indico comes with a number of languages by default. In release 3.2, those are: English (default), French, Portuguese, Spanish, Chinese, Ukrainian, Polish, Mongolian, Turkish and German, Czech and Italian (in the order of integration). Additional languages are being prepared on the Transifex platform.
In order to use (partially) existing translations from Transifex or to contribute translations, you need to register with the Indico project on the Transifex platform.
If, instead, you are interested in contributing translations, we have a separate guide just for that.
Additional Translations¶
This is a guide to set up an Indico instance with a new language. It is useful for translators to verify how the translation looks in production or for administrators who just want to lurk at the incubated translation embryos.
You may also use the translation demo instance to check out both official and unofficial translations.
Alternatively, you may use this guide to expose a translation we do not officially support, in your production version.
1. Setup an Indico dev environment¶
This should usually be done on your own computer or a virtual machine.
For creating your own Indico instance, we provide two different guides: The first one is for a production system, it will prepare Indico to be served to users and used in all the different purposes you may have besides translations. The second is development a light-weight, easier to set up, version oriented to testing purposes, that should not be exposed to the public.
For the purpose of translation development or testing we recommend using the development version.
2. Install the transifex client¶
Follow the instructions on the transifex site.
3. Get an API token¶
Go to your transifex settings and generate an API token.
Next, create a ~/.transifexrc
configuration file:
[https://www.transifex.com]
rest_hostname = https://rest.api.transifex.com
token = API_TOKEN_HERE
You can either save your API token in the configuration file as shown above or pass it
as an environment variable every time you invoke a command using TX_TOKEN=myapitoken
.
You can also consult the official transifex client guide.
4. Install the translations¶
Navigate to ~/dev/indico/src
(assuming you used the standard locations from the dev setup guide).
Run indico i18n pull indico <language_code>
.
Languages codes can be obtained here.
For example, Chinese (China) is zh_CN.GB2312
.
5. Check the translations¶
Run indico i18n check-format-strings
to make sure that all placeholders in the
translated strings match.
If this command finds any issues, we recommend fixing the translations in Transifex and reinstalling the updated translations before proceeding to the next step. Otherwise, this could to lead to errors when Indico tries to use the translated string.
6. Compile translations and run Indico¶
Run the command indico i18n compile indico
and:
launch Indico, or
build and deploy your own version of Indico, if you wish to deploy the translation in a production version.
The language should now show up as an option in the top right corner.
In case you modified the .js
resources, you also need to delete the cached
files in ~/dev/indico/data/cache/assets_i18n_*.js
.
FAQ¶
Why isn’t Indico loading my language?¶
Some languages in transifex use codes that Indico is not able to recognize.
One example is the Chinese’s zh_CN.GB2312
.
The easy fix for this is to rename the folder zh_CN.GB2312
(inside
indico/translations/
) to the extended locale code zh_Hant_TW
.
Unfortunately, there is no list with mappings for all the languages.
So if by any reason it doesn’t work for you, feel free to ask us.
File Organisation¶
The relationship between
transifex resources names (core.js, core.py, core.react.js)
PO file names (messages-js.po, messages.po, messages-react.po) and
the actual place, where the strings are found
is not always obvious. Starting with the resource names, the files ending in
.py
refer to translations used with python and jinja templates,.js
refer to translations used with generic or legacy javascript,react.js
refer to translations used with the new react-based javascript.
These contain a relationship to PO files, as defined in the following example extracted
from src/.tx/config
.
[indico.<transifex resource slug>]
file_filter = indico/translations/<lang>/LC_MESSAGES/<PO file name>.po
source_file = indico/translations/<source file name>.pot
source_lang = en
type = PO
Note
The transifex resource slug is a name-like alias that identifies a particular file.
For more information regarding this subject a thread has started here.