# Need help with translation system

**URL:** <https://talk.getindico.io/t/need-help-with-translation-system/3074>\
**Category:** Plugin Development\
**Created:** [May 12, 2023, 9:55am UTC](https://talk.getindico.io/t/need-help-with-translation-system/3074 "2023-05-12T09:55:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonreis](https://talk.getindico.io/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@antonreis](https://talk.getindico.io/u/antonreis)\
**Post date:** [May 12, 2023, 9:55am UTC](https://talk.getindico.io/t/need-help-with-translation-system/3074/1 "2023-05-12T09:55:48Z")

</div>

I’m developing a payment plugin and I can’t get the translation to work in the templates.

In plugin.py the render\_payment\_form returns:

```auto
return render_plugin_template('event_payment_form.html', **data)

```

The template is now very short:

```auto
{%- trans -%}RATest{%- endtrans -%}

```

Like with other translations, I put into translations/messages.pot

```auto
#: [...]/templates/event_payment_form.html:1
msgid "RATest"
msgstr ""

```

And the translations into the corresponding folders, as example for German translations/de\_DE/LC\_MESSAGES/messages.po:

```auto
#: [...]/templates/event_payment_form.html:1
msgid "RATest"
msgstr "RATest de"

```

But the output is always “RAtest”. What am I missing?

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [May 12, 2023, 9:59am UTC](https://talk.getindico.io/t/need-help-with-translation-system/3074/2 "2023-05-12T09:59:07Z")

</div>

Did you compile the translations?

```
pybabel compile -f -d ./indico_yourplugginname/translations/ -l de_DE

```

---

<div class="post-metadata">

**Author:** ![antonreis](https://talk.getindico.io/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@antonreis](https://talk.getindico.io/u/antonreis)\
**Post date:** [May 12, 2023, 10:02am UTC](https://talk.getindico.io/t/need-help-with-translation-system/3074/3 "2023-05-12T10:02:27Z")

</div>

I’ll try. But the other translations worked without compiling. I tested with a dev version of 3.2.1 locally previously. Now running a “real” server with latest Indico.

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [May 12, 2023, 10:03am UTC](https://talk.getindico.io/t/need-help-with-translation-system/3074/4 "2023-05-12T10:03:08Z")

</div>

That’s strange. The plaintext .po file is usually never used, only the compiled .mo file is…

---

<div class="post-metadata">

**Author:** ![antonreis](https://talk.getindico.io/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@antonreis](https://talk.getindico.io/u/antonreis)\
**Post date:** [May 12, 2023, 10:11am UTC](https://talk.getindico.io/t/need-help-with-translation-system/3074/5 "2023-05-12T10:11:06Z")

</div>

Indeed. I also assumed the .mo would be needed or Indico would generate them itself. But it worked with only .po  
Anyway, thanks! With compiled .po it works as intended 🙂

---

<div class="post-metadata">

**Author:** ![antonreis](https://talk.getindico.io/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@antonreis](https://talk.getindico.io/u/antonreis)\
**Post date:** [May 12, 2023, 10:19am UTC](https://talk.getindico.io/t/need-help-with-translation-system/3074/6 "2023-05-12T10:19:54Z")

</div>

Btw. how do the other handle that problem? I don’t see any .mo in the sources of other plugins.

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [May 12, 2023, 10:25am UTC](https://talk.getindico.io/t/need-help-with-translation-system/3074/7 "2023-05-12T10:25:30Z")

</div>

Most people probably do not care about plugin i18n and might not even bother with .po files

Our own plugins do have translations though:

```auto
[adrian@eluvian:~/dev/indico/py3/plugins/public:master *]> ll **/*.po | wc -l
132

```

The corresponding .mo files are generated output and thus do not belong in Git repos. Generally you’d compile them just before building the Python wheel for the plugin (either to release on PyPI or to install on your instance).
