Add a new language to Indico 2.2

Hello,

I am setting up my own Indico instance for adding Chinese language in order to see how the translations show .

I have installed indico 2.2.7 (a production version) and it works now. I also installed transifex client.

Now I can see the following

ls  /opt/indico/.venv/lib/python2.7/site-packages/indico/translations/
 en_GB  es_ES  fr_FR  messages-js.pot  messages.pot  messages-react.pot  pt_BR  zh_CN.GB2312 

 ls -l /opt/indico/.venv/lib/python2.7/site-packages/indico/translations/zh_CN.GB2312/LC_MESSAGES/
 total 820
 -rw-r--r--. 1 indico apache   2384 May 20 16:19 for_use_indico_chat-messages-js_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache  10933 May 20 16:19 for_use_indico_chat-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache  68689 May 20 16:19 for_use_indico_core-messages-js_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache  81373 May 20 16:19 for_use_indico_core-messages-react_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache 587034 May 20 16:19 for_use_indico_core-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache    825 May 20 16:19 for_use_indico_importer-invenio-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   5713 May 20 16:19 for_use_indico_importer-messages-js_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache    799 May 20 16:19 for_use_indico_importer-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache    852 May 20 16:19 for_use_indico_livesync-invenio-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache    809 May 20 16:19 for_use_indico_livesync-messages-js_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   5181 May 20 16:19 for_use_indico_livesync-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   2475 May 20 16:19 for_use_indico_payment-manual-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   2959 May 20 16:19 for_use_indico_payment-paypal-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   1104 May 20 16:19 for_use_indico_piwik-messages-js_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   6765 May 20 16:19 for_use_indico_piwik-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache    867 May 20 16:19 for_use_indico_search-invenio-messages-js_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   1980 May 20 16:19 for_use_indico_search-invenio-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   1394 May 20 16:19 for_use_indico_search-messages-js_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   2222 May 20 16:19 for_use_indico_search-messages_zh_CN.GB2312.po
 -rw-r--r--. 1 indico apache   8564 May 20 16:19 for_use_indico_vc-vidyo-messages_zh_CN.GB2312.po 

Then I have done

su - indico 

source ~/.venv/bin/activate 

cd /opt/indico/.venv/lib/python2.7/site-packages/indico/translations/zh_CN.GB2312/LC_MESSAGES 

indico i18n compile-catalog
 error: indico/translations/es_ES/LC_MESSAGES/messages.po:2640: placeholders are incompatible
 error: indico/translations/es_ES/LC_MESSAGES/messages.po:2648: placeholders are incompatible
 2 errors encountered. 

I have got the error above. I did not get messages-js.po messages.mo messages.po files, and I did not see the translation.
Should I also check/configure something ?

Thanks a lot,

The es_ES errors are safe to ignore. For chinese to work properly you need to rename zh_CN.GB2312 to zh_Hans_CN.

After indico i18n compile-catalog the indico/translations/zh_Hans_CN/LC_MESSAGES/ folder should contain messages.mo plus the other files (messages.po, messages-js.po, messages-react.po, [messages-react.json]). Once messages.mo exists restarting uwsgi should be enough for the language to show up in Indico.

PS: Usually you should compile the i18n files locally on a dev setup and then copy the folder. Doing it on a production system will likely work (but I don’t think any of us tested it!) for the Python/Jinja translations (indico i18n compile-catalog for messages.po to messages.mo), and for the classic JS translations (messages-js.po - nothing to compile there), but NOT for the new React translations (indico i18n compile-catalog-react for messages-react.po to messages-react.json), since the tools for this are only available on a dev setup!

I renamed the folder name to “zh_hans_CN”. Then I re-run

indico i18n compile-catalog
error: indico/translations/es_ES/LC_MESSAGES/messages.po:2640: placeholders are incompatible
error: indico/translations/es_ES/LC_MESSAGES/messages.po:2648: placeholders are incompatible
2 errors encountered.

I still did not get messages-js.po messages.mo messages.po files. I cannot see the translation.
I am setting up a dev version, I have encountered a lot of problems. I am stupid. I do not know how to fix them.
Such as the ticket The problem about the webpack watcher when setting up development version installation p

Thank you!!

The po files are not generated. You need to download them from transifex (this may miss some strings now that we updated the transifex source files for the upcoming 2.3 release) or if you already have them locally copy them.

What is the current content of indico/translations/zh_Hans_CN/LC_MESSAGES/?

The content of

 ls -l /opt/indico/.venv/lib/python2.7/site-packages/indico/translations/zh_Hans_CN/LC_MESSAGES
total 820
-rw-r--r--. 1 indico apache   2384 May 20 16:19 for_use_indico_chat-messages-js_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache  10933 May 20 16:19 for_use_indico_chat-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache  68689 May 20 16:19 for_use_indico_core-messages-js_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache  81373 May 20 16:19 for_use_indico_core-messages-react_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache 587034 May 20 16:19 for_use_indico_core-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache    825 May 20 16:19 for_use_indico_importer-invenio-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   5713 May 20 16:19 for_use_indico_importer-messages-js_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache    799 May 20 16:19 for_use_indico_importer-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache    852 May 20 16:19 for_use_indico_livesync-invenio-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache    809 May 20 16:19 for_use_indico_livesync-messages-js_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   5181 May 20 16:19 for_use_indico_livesync-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   2475 May 20 16:19 for_use_indico_payment-manual-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   2959 May 20 16:19 for_use_indico_payment-paypal-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   1104 May 20 16:19 for_use_indico_piwik-messages-js_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   6765 May 20 16:19 for_use_indico_piwik-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache    867 May 20 16:19 for_use_indico_search-invenio-messages-js_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   1980 May 20 16:19 for_use_indico_search-invenio-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   1394 May 20 16:19 for_use_indico_search-messages-js_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   2222 May 20 16:19 for_use_indico_search-messages_zh_CN.GB2312.po
-rw-r--r--. 1 indico apache   8564 May 20 16:19 for_use_indico_vc-vidyo-messages_zh_CN.GB2312.po

there is no other files.

I’m not sure how you ended up with those files, but none of them will be used using these filenames. Plugin translations would have to go in the respective plugin directories, but let’s ignore those for now since you may not be using plugins anyway.

Take these files:

for_use_indico_core-messages-js_zh_CN.GB2312.po
for_use_indico_core-messages-react_zh_CN.GB2312.po
for_use_indico_core-messages_zh_CN.GB2312.po

and rename them to:

messages-js.po
messages-react.po
messages.po

And then use indico i18n compile-catalog to compile messages.po to message.mo.

I download these files manually from transifex,and copy them manullay to indico/translations/zh_Hans_CN/LC_MESSAGES/.
I have renamed these 3 files, use i18n compile-catalog to compile messages.po to message.mo, then restart indico. Then I can see the chinese transalations at webpage.
But “Room booking” does not work with chinese version. Why ?

I also have tried to do the following
tx init --skipsetup
tx pull -f -l zh_CN.GB2312

But I have got nothing. Maybe I should do it at a dev version. I will try.

Thanks a lot,

See my PS in this post:

PS: Usually you should compile the i18n files locally on a dev setup and then copy the folder. Doing it on a production system will likely work (but I don’t think any of us tested it!) for the Python/Jinja translations ( indico i18n compile-catalog for messages.po to messages.mo), and for the classic JS translations (messages-js.po - nothing to compile there), but NOT for the new React translations ( indico i18n compile-catalog-react for messages-react.po to messages-react.json), since the tools for this are only available on a dev setup!

Room booking is a React app so without the messages-react translations you will not have the proper translations there.