From 80fec8b5ffafcb059de7dd9c88df84771994c497 Mon Sep 17 00:00:00 2001 From: fja-odoo Date: Thu, 25 Nov 2021 06:50:40 +0000 Subject: [PATCH] [FIX] web: fix chineese calendar format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: The way we generate the dayNamesMin is not compatible with the chineese translation provided by "moment.js". This is because the dayNamesShort contains an extra character in front 週 (week). Because of that the names of the days on the small calendar are all the character 週 (week). Solution: There is a variable (weekdaysMin) which is unused and contain a shorter version of the days this variable is consitent in the other languages so it should have no side effect and will fix the chinese translation as it only contains one character. Introduced by: 1fc33a63beb20d134081c93852e62f5fe0ff67d4 task-2692910 closes odoo/odoo#80448 X-original-commit: 7cc502a6eb61bc541dbc27beefed004fcf81e04b Signed-off-by: Samuel Degueldre Signed-off-by: fja-odoo --- .../web/static/src/legacy/js/views/calendar/calendar_model.js | 1 + .../static/src/legacy/js/views/calendar/calendar_renderer.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/legacy/js/views/calendar/calendar_model.js b/addons/web/static/src/legacy/js/views/calendar/calendar_model.js index f1decec9088..f1a37543c1a 100644 --- a/addons/web/static/src/legacy/js/views/calendar/calendar_model.js +++ b/addons/web/static/src/legacy/js/views/calendar/calendar_model.js @@ -477,6 +477,7 @@ return AbstractModel.extend({ monthNamesShort: moment.monthsShort(), dayNames: moment.weekdays(), dayNamesShort: moment.weekdaysShort(), + dayNamesMin: moment.weekdaysMin(), firstDay: this.week_start, slotLabelFormat: _t.database.parameters.time_format.search("%H") !== -1 ? format24Hour : format12Hour, allDaySlot: this.mapping.all_day || this.fields[this.mapping.date_start].type === 'date', diff --git a/addons/web/static/src/legacy/js/views/calendar/calendar_renderer.js b/addons/web/static/src/legacy/js/views/calendar/calendar_renderer.js index fc87d3876f7..1f0208c79dc 100644 --- a/addons/web/static/src/legacy/js/views/calendar/calendar_renderer.js +++ b/addons/web/static/src/legacy/js/views/calendar/calendar_renderer.js @@ -639,7 +639,7 @@ return AbstractRenderer.extend({ }); }, 'showOtherMonths': true, - 'dayNamesMin' : this.state.fc_options.dayNamesShort.map(x => x[0]), + 'dayNamesMin': this.state.fc_options.dayNamesMin.map(x => x[0]), 'monthNames': this.state.fc_options.monthNamesShort, 'firstDay': this.state.fc_options.firstDay, });