[FIX] web_editor: translate and add translations for placeholders

Reproduction:
1. Switch to French, create a /heading 1, and input nothing
2. The placeholder “Heading 1” is not translated

Fix: add translate function around the terms and manually add the
translations in pot

Note: since OdooEditor.js is under web_editor/static/lib/web-editor,
only the js code under /static/src/ is considered for translation export
The translation is manually added with specific path. In Odoo 16, the
path is changed to /static/src/ and translations can be exported
correctly. The translation code paths added here should be changed in
Odoo 16

Related PR adding translations: https://github.com/odoo/odoo/pull/93272

opw-3224482

closes odoo/odoo#117142

X-original-commit: 5f297854348e073a3915bca5cec13066f6abe90e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Jinjiu Liu
2023-03-30 15:09:44 +02:00
parent b26d7d19ba
commit 51179c706f
2 changed files with 53 additions and 10 deletions
+43
View File
@@ -1070,6 +1070,13 @@ msgstr ""
msgid "Embed the youtube video in the document"
msgstr ""
#. module: web_editor
#. odoo-javascript
#: code:addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js:0
#, python-format
msgid "Empty quote"
msgstr ""
#. module: web_editor
#. odoo-javascript
#: code:addons/web_editor/static/src/js/common/ace.js:0
@@ -1311,6 +1318,27 @@ msgstr ""
msgid "Heading 3"
msgstr ""
#. module: web_editor
#. odoo-javascript
#: code:addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js:0
#, python-format
msgid "Heading 4"
msgstr ""
#. module: web_editor
#. odoo-javascript
#: code:addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js:0
#, python-format
msgid "Heading 5"
msgstr ""
#. module: web_editor
#. odoo-javascript
#: code:addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js:0
#, python-format
msgid "Heading 6"
msgstr ""
#. module: web_editor
#: model_terms:ir.ui.view,arch_db:web_editor.snippet_options_background_options
msgid "Height"
@@ -1716,6 +1744,14 @@ msgstr ""
msgid "Link to"
msgstr ""
#. module: web_editor
#. odoo-javascript
#: code:addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js:0
#: code:addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js:0
#, python-format
msgid "List"
msgstr ""
#. module: web_editor
#. odoo-javascript
#: code:addons/web_editor/static/src/components/media_dialog/file_selector.xml:0
@@ -2903,6 +2939,13 @@ msgid ""
"reload the page."
msgstr ""
#. module: web_editor
#. odoo-javascript
#: code:addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js:0
#, python-format
msgid "To-do"
msgstr ""
#. module: web_editor
#: model_terms:ir.ui.view,arch_db:web_editor.snippet_options_image_optimization_widgets
msgid "Toaster"
@@ -3871,16 +3871,16 @@ export class OdooEditor extends EventTarget {
}
const selectors = {
BLOCKQUOTE: 'Empty quote',
H1: 'Heading 1',
H2: 'Heading 2',
H3: 'Heading 3',
H4: 'Heading 4',
H5: 'Heading 5',
H6: 'Heading 6',
'UL LI': 'List',
'OL LI': 'List',
'CL LI': 'To-do',
BLOCKQUOTE: this.options._t('Empty quote'),
H1: this.options._t('Heading 1'),
H2: this.options._t('Heading 2'),
H3: this.options._t('Heading 3'),
H4: this.options._t('Heading 4'),
H5: this.options._t('Heading 5'),
H6: this.options._t('Heading 6'),
'UL LI': this.options._t('List'),
'OL LI': this.options._t('List'),
'CL LI': this.options._t('To-do'),
};
for (const hint of this.editable.querySelectorAll('.oe-hint')) {