0

I struggled a LOT with the translation of my module.

As I finally get it, I share the result, hoping it will save someone some day.

My local Odoo didn't wish to translate at all my module. I tried everything, until I drop the ir.translation table to rewrite it from scratch, but still, it wouldn't.

When I got to odoo.sh for other tests, it miraculously appeared translated. I can't explain why. I guess a fresh start solves it and I may have had re-import translations to solve issue. But some text stayed untranslated, and this is the most tricky part.

The widgets were not translated at all, even if portal_chatter is correclty translated and if I copied the code and translations.

EmmanuelM
  • 53
  • 5

1 Answers1

0

So, the solution is dead simple, but I had a long road to find out. You need to add a model ir.http, like in website_sales or website_livechat, and make it add your module to an obscur _get_translation_frontend_modules_domain method.

PS : I don't if that helps, but maybe. I also added this : 'js': ['static/src/js/*.js'], 'qweb': ['static/src/xml/*/*.xml'] to my __manifest__.py

EmmanuelM
  • 53
  • 5
  • I must add that, even though I'm not sure it was useful, that it seems to be forbidden to organize your widgets as you wish. A standard is frozen (`xml` and `js` folders in `src/static`) in odoo/odoo/tools/translate.py at lines 988 and 994 : `if fnmatch.fnmatch(root, '*/static/src/js*'):` and `if fnmatch.fnmatch(root, '*/static/src/xml*'):` – EmmanuelM May 26 '20 at 18:53
  • Have you found solution for that ? – Rihard Novozhilov Jul 08 '21 at 16:44
  • /lv/website/translations/b1501aebd883a6358ec20cd20823b7eccea0e6f9?mods=&lang=lv_LV returns just couple of modules no custom modules – Rihard Novozhilov Jul 08 '21 at 16:56
  • Have a look here: https://stackoverflow.com/a/69025625/320150 there I've posted a code-example for the ir.http inheritance. – OlafW Sep 02 '21 at 11:51
  • 1
    Yes @RihardNovozhilov I did, the answer is the solution. Thx @OlafW for the example. In my case (Odoo12), I added this to the `_get_translation_frontend_modules_domain` function : `domain = super(IrHttp, cls)._get_translation_frontend_modules_domain(); return expression.OR([domain, [("name", "=", "MY_MODULE")]])` – EmmanuelM Sep 03 '21 at 12:20