Fixing incorrect/missing translations due to legalities

We are trying to hold a Turkish event, and the universities have some strict legal restrictions on the terms. Unfortunately, the Turkish translation has significant number of “incorrect” (i.e. not legally acceptable) translations and missing translations.

I tried to fix this by editing “indico/translations/tr_TR/LC_MESSAGES/messages.po” in the venv, followed by a restart of services “systemctl restart nginx.service indico-celery.service indico-uwsgi.service”

However, my changes are ignored, and the generated PDF documents (pages) still insist on “incorrect” translations or direct English.

Is there a solution to this problem?

Indico 3.2.1 installed directly using the standard instructions

Hi, try running indico i18n compile-catalog. Note that such manual changes will be lost during an upgrade.
Afterwards you only need to restart uwsgi and celery; no need to restart nginx.

PS: If there are mistakes feel free to contribute fixes to our translations on Transifex; those will end up in an upcoming release and thus be available for everyone! See this page in the docs for details.

1 Like

That did the trick! Thank you very much. I didn’t think that section of the manual was relevant to my case, I’ll push my translations to there as well.

Btw, the command failed at first with

error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:996: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:1138: unknown named placeholder 'n'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:1855: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:2879: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:2885: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:3823: unknown named placeholder 'tpls_count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:5588: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:6727: unknown named placeholder 'missing_groups'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:6733: unknown named placeholder 'missing_groups'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:6931: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:9506: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:10968: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:12165: unknown named placeholder 'num'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:12624: unknown named placeholder 'total'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:13472: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:14090: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:14378: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:14634: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:15374: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:15693: unknown named placeholder 'count'
error: indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:17003: unknown named placeholder 'count'

I just deleted the translation, since I don’t need it.

Also, my react translation compilation failed. First, because I didn’t have npm installed, second for some reason I don’t clearly understand. This is not super important to me at the moment, but FYI the error message is attached.

[..................] \ idealTree:bb26327961e0b32d: sill idealTree buildDeps
[..................] / idealTree:prop-types: sill fetch manifest loose-envify@^1.1.0
Traceback (most recent call last):
  File "/opt/indico/.venv/bin/indico", line 8, in <module>
    sys.exit(cli())
  File "/opt/indico/.venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/indico/.venv/lib/python3.9/site-packages/flask/cli.py", line 567, in main
    return super().main(*args, **kwargs)
  File "/opt/indico/.venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/indico/.venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/indico/.venv/lib/python3.9/site-packages/indico/cli/util.py", line 108, in invoke
    return self._impl.invoke(ctx)
  File "/opt/indico/.venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/indico/.venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/indico/.venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/indico/.venv/lib/python3.9/site-packages/indico/cli/i18n.py", line 158, in compile_catalog_react
    json.loads(output)  # just to be sure the JSON is valid
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The chinese errors are safe to ignore, no need to delete anything.

Compiling react translations does NOT work in a production setup (since it requires the JS build env which is not present in production). Generally the way to go is to make a dev setup on another machine, compile the translations there, and then build a new Python wheel to install on production.
See Building — Indico 3.2.2 documentation on how to build an Indico Python wheel.

1 Like

Hi,

I’m using the descripted method for the last years to have custom german translation especially for things like “Sehr geehrte(r)….” and had to implement this after every update.

But since the last (or the update before) update compiling of the messages.po file isn’t working. I already tried with the original file which comes with the update but also getting the following error:

error: /opt/indico/.venv/lib/python3.12/site-packages/indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:821: unknown named placeholder ‘count’

error: /opt/indico/.venv/lib/python3.12/site-packages/indico/translations/zh_Hans_CN/LC_MESSAGES/messages.po:3881: unknown named placeholder ‘tpls_count’

error: /opt/indico/.venv/lib/python3.12/site-packages/indico/translations/ja_JP/LC_MESSAGES/messages.po:822: unknown named placeholder ‘count’

error: /opt/indico/.venv/lib/python3.12/site-packages/indico/translations/ja_JP/LC_MESSAGES/messages.po:3890: unknown named placeholder ‘tpls_count’

4 errors encountered.

Error running CompileCatalog for indico - [Errno 2] No such file or directory: ‘npx’

Any advice on fixing that?

Best Wishes,
Stefan

These warnings can be ignored, they’re because these languages have just a single form (ie no plural forms).

The other error happens because it looks like your do not have a nodejs environment. You are not supposed to modify compile i18n resources on a production deployment, this should be done on a dev installation of indico, and then you build a python wheel to deploy on your server.

Is this also necessary if i have only changes in the messages.po file?

Use --python when compiling it to skip the react step. Then you don’t need the node stuff.

Thanks, very helpful response. One last question, because editing doesn’t work like it did before. To change email text it was possible to change it in the file messages.po but now after compiling messages.po always contains the original text parts. Do we need to make changes in messages-all.po or what is the easiest way for the actuell version of indico. We only need to change form of address in email messages.

Best Wishes,
Stefan

Yes, according to my experience after some “try and error” you have to edit messages-all.po, then compile the translations. From that messages.po and a binary messages.mo are created. It should be sufficient to insert messages.mo on the production server. At least the (German) translations of our custom login page work that way.