Files
odoo_source/addons/web_editor/models
Arthur Detroux (ard) 8d48efeece [FIX] web_editor: add snippet_lang as a template cache context key
In commit [1] it was decided that the Snippet Menu would have its UI in
the user's language, while the Snippets' Content would be in the
language of the website they are currently editing. To do so, a new
context key was added: Snippet Lang.

Unfortunately, while Odoo handles the compilation according to a
language, website_id and more, it does not do so according to the
snippet lang.

It would not be an issue if the Snippets were compiled only in edit
mode, as a Website only has one default language. Unfortunately the
Snippet Content is also rendered in translate mode (Since the
SnippetMenu is one big XML template), therefore it can be rendered in
different Snippet Lang (though it's useless).

This commit fixes that by adding Snippet Lang as a cache key so that if
the key is present, it will re-compile the template.

Steps to reproduce:
- Create a new language
- Translate a snippet (e.g. search s_cover view and translate contact
 us)
- Create a new website with 2 languages, the new language as default and
 english
- Enter translate mode
- Leave it
- Enter edit mode via the "Edit master" button
- Drop the translated snippet
- It will not be translated because the Snippet Menu was rendered in
English first.

A commit introduced after this one will test these steps.

[1]: https://github.com/odoo/odoo/commit/55a978aa86967581956f855a1c5db33b7425bd15

X-original-commit: 6eba6203e9f1b8a730ab53f80fea8e7b78818bc7
Part-of: odoo/odoo#108643
2022-12-23 21:19:51 +01:00
..
…
…