diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 06a62034792..2d60f2bbf7e 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -4,6 +4,7 @@ import { Mutex } from "@web/core/utils/concurrency"; import { clamp } from "@web/core/utils/numbers"; import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog"; import dom from "@web/legacy/js/core/dom"; +import { session } from "@web/session"; import Widget from "@web/legacy/js/core/widget"; import { useDragAndDrop } from "@web_editor/js/editor/drag_and_drop"; import options from "@web_editor/js/editor/snippets.options"; @@ -1867,6 +1868,13 @@ var SnippetsMenu = Widget.extend({ // own window and not on the top window lest jquery behave unexpectedly. this.$el = this.window.$(this.$el); this.$el.data('snippetMenu', this); + + // TODO somehow this attribute is not on the HTML element of the backend + // ... it probably should be. + const context = this.options.context || session.user_context || {}; + const userLang = context.user_lang || context.lang || 'en_US'; + this.el.setAttribute('lang', userLang.replace('_', '-')); + // We need to activate the touch events to be able to drag and drop // snippets on devices with a touch screen. this.__onTouchEvent = this._onTouchEvent.bind(this); diff --git a/addons/web_editor/static/src/scss/wysiwyg_snippets.scss b/addons/web_editor/static/src/scss/wysiwyg_snippets.scss index 2064b183263..34cf0a02fcb 100644 --- a/addons/web_editor/static/src/scss/wysiwyg_snippets.scss +++ b/addons/web_editor/static/src/scss/wysiwyg_snippets.scss @@ -855,10 +855,17 @@ we-title { display: block; - text-transform: capitalize; text-align: left; } + // TODO in master, remove the text-transform rule entirely and rely on + // developers writing their label with the intended "design". The + // "where" change here was added as a way to minimize the impact of this + // fix in stable. That CSS style was breaking translations. + we-title:where(:lang(en)) { + text-transform: capitalize; + } + we-customizeblock-options { position: relative; display: block;