[IMP] developer: extend internationalization guide

In order for javascript translations to become active, the corresponding
addon needs to follow a certain naming scheme or register explicitly.
This commit updates the internationalization guide with a respective
hint.

Fixes odoo/documentation#1676

closes odoo/documentation#1725

X-original-commit: 112b6c1267
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
0b11001111 2022-03-18 11:05:26 +00:00 committed by Martin Trigaux
parent 04cae556ea
commit 92cb732684

View File

@ -97,6 +97,26 @@ The lazy version of `_` and `_t` is :func:`odoo._lt` in python and
at rendering and can be used to declare translatable properties in class methods
of global variables.
.. note::
Translations of a module are **not** exposed to the front end by default and
thus are not accessible from JavaScript. In order to achieve that, the
module name has to be either prefixed with `website` (just like
`website_sale`, `website_event` etc.) or explicitly register by implementing
:func:`_get_translation_frontend_modules_name` for the `ir.http` model.
This could look like the following::
from odoo import models
class IrHttp(models.AbstractModel):
_inherit = 'ir.http'
@classmethod
def _get_translation_frontend_modules_name(cls):
modules = super()._get_translation_frontend_modules_name()
return modules + ['your_module']
Variables
^^^^^^^^^
**Don't** the extract may work but it will not translate the text correctly::