summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2017-11-30 09:39:41 +0100
committerMartin Trigaux <mat@odoo.com>2017-11-30 10:18:10 +0100
commite7f1acf97be5d3011faac0050ffd57d05af8c3c2 (patch)
tree327f52a0019c836351a62eb25328179f138a8933 /doc/reference
parent1f39b6021e08d471bc9f59162973e3297a808811 (diff)
[IMP] doc: clarify lazy-loading
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/translations.rst11
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/reference/translations.rst b/doc/reference/translations.rst
index 534853ff7dd..adfc11a259f 100644
--- a/doc/reference/translations.rst
+++ b/doc/reference/translations.rst
@@ -80,7 +80,7 @@ In JavaScript, the wrapping function is generally :js:func:`odoo.web._t`:
.. code-block:: javascript
- title = _t("Bank Accounts")
+ title = _t("Bank Accounts");
.. warning::
@@ -135,8 +135,8 @@ Plural
else:
msg = _("You have %s invoice") % invoice_count
-Lazy
-^^^^
+Read vs Run Time
+^^^^^^^^^^^^^^^^
**Don't** invoke translation lookup at server launch::
@@ -151,7 +151,7 @@ Lazy
def _raise_error(self, code):
raise UserError(ERROR_MESSAGE[code])
-**Don't** invoke translation lookup before loading the translation memory::
+**Don't** invoke translation lookup when the javascript file is read::
# bad, js _t is evaluated too early
var core = require('web.core');
@@ -170,7 +170,8 @@ Lazy
missing_error: _('Missing Record'),
}
-**Do** use `_lt` for lazy-loading::
+**Do** in the case where the translation lookup is done when the JS file is
+*read*, use `_lt` instead of `_t` to translate the term when it is *used*::
# good, js _lt is evaluated lazily
var core = require('web.core');