[FIX] web_editor: stop auto-capitalize of editor UI labels (translation)
Commit [1] added a rule whose intention was to unify the way our editor labels look: capitalized. However, this is not working as intended for translations as some languages have different rules for capitalization. In the future, we will rely solely on the labels being written with the intended capitalization in the first place (which is currently not the case for dozens of English labels). As a fix, we keep the auto CSS rule for English languages only. Hopefully, the amount of translations made by translators being better than their auto-capitalized versions is greater than non-capitalized English labels translated by mistake without the auto-capitalization. Note: this is the way python fields work too, they are not displayed auto-capitalized in the webclient, although we want them to be. [1]: https://github.com/odoo/odoo/commit/5db73c12d3ed14239dc81f60eec6c21d0f65af26 closes odoo/odoo#153732 X-original-commit: 453b1e86840d81ffeff4d182b161b0ea50a38486 Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user