Daily updates from Odoo
Wednesday, July 19, 2023
1 change · master
Code cleanup and technical improvements
This update prepares Odoo to use one standard translation method instead of two, reducing confusion for future maintenance. It also adjusts automated guided tours and tests so translated text is only loaded when ready, helping keep validation stable across many business modules.
Original PR description
The goal of this commit is to prepare ground to remove
lazytranslate function _lt() and keep only _t()
for a better understanding of the use of the translation function.
In this commit,
- the translate function _t() has been updated to return the translation
if they are loaded. If not, it throws an error.
- the lazytranslate function _lt() returns _t() function.
**Corollaries :**
Steps in test tours are now a function that returns an array of steps
to avoid any interpolation of _t in this ones before translations has
been loaded.
**Example :**
```
registry.category("web_tour.tours").add("example", {
test: true,
steps: () => [
{...},
{...},
],
});
```
task-3292454
Community: https://github.com/odoo/odoo/pull/124157