From 477a535e03a07bbacf514612c3f9d9d43ac087fc Mon Sep 17 00:00:00 2001 From: Romain Estievenart Date: Mon, 2 Aug 2021 09:06:00 +0000 Subject: [PATCH] [FIX] pos_*: add missing translation flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes odoo/odoo#79448 X-original-commit: 1ace6a4a51a86922c9632614c4043e85f6ef1d6e Related: odoo/enterprise#22146 Signed-off-by: Pierre Paridans (app) Signed-off-by: Adrien Dieudonné (adr) Co-authored-by: Adrien Dieudonné --- .../point_of_sale/static/src/js/Popups/ConfirmPopup.js | 7 ++++--- .../point_of_sale/static/src/js/Popups/EditListPopup.js | 5 +++-- .../static/src/js/Popups/ErrorBarcodePopup.js | 9 +++++---- addons/point_of_sale/static/src/js/Popups/ErrorPopup.js | 7 ++++--- .../static/src/js/Popups/ErrorTracebackPopup.js | 9 +++++---- .../static/src/js/Popups/OfflineErrorPopup.js | 9 +++++---- .../static/src/js/Popups/OrderImportPopup.js | 5 +++-- .../point_of_sale/static/src/js/Popups/SelectionPopup.js | 7 ++++--- .../point_of_sale/static/src/js/Popups/TextAreaPopup.js | 5 +++-- .../point_of_sale/static/src/js/Popups/TextInputPopup.js | 5 +++-- .../static/src/js/Screens/PaymentScreen/PaymentScreen.js | 2 +- .../pos_mercury/static/src/js/PaymentTransactionPopup.js | 7 ++++--- .../static/src/js/Screens/FloorScreen/FloorScreen.js | 4 ++-- .../ProductScreen/ControlButtons/SubmitOrderButton.js | 4 ++-- addons/pos_restaurant/static/src/js/Screens/TipScreen.js | 4 ++-- 15 files changed, 50 insertions(+), 39 deletions(-) diff --git a/addons/point_of_sale/static/src/js/Popups/ConfirmPopup.js b/addons/point_of_sale/static/src/js/Popups/ConfirmPopup.js index e22c1aaa159..4536feb3e94 100644 --- a/addons/point_of_sale/static/src/js/Popups/ConfirmPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/ConfirmPopup.js @@ -3,14 +3,15 @@ odoo.define('point_of_sale.ConfirmPopup', function(require) { const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); // formerly ConfirmPopupWidget class ConfirmPopup extends AbstractAwaitablePopup {} ConfirmPopup.template = 'ConfirmPopup'; ConfirmPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', - title: 'Confirm ?', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), + title: _lt('Confirm ?'), body: '', }; diff --git a/addons/point_of_sale/static/src/js/Popups/EditListPopup.js b/addons/point_of_sale/static/src/js/Popups/EditListPopup.js index ac4b262d668..46e5f627c6f 100644 --- a/addons/point_of_sale/static/src/js/Popups/EditListPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/EditListPopup.js @@ -5,6 +5,7 @@ odoo.define('point_of_sale.EditListPopup', function(require) { const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); const Registries = require('point_of_sale.Registries'); const { useAutoFocusToLast } = require('point_of_sale.custom_hooks'); + const { _lt } = require('@web/core/l10n/translation'); /** * Given a array of { id, text }, we show the user this popup to be able to modify this given array. @@ -93,8 +94,8 @@ odoo.define('point_of_sale.EditListPopup', function(require) { } EditListPopup.template = 'EditListPopup'; EditListPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), array: [], isSingleItem: false, }; diff --git a/addons/point_of_sale/static/src/js/Popups/ErrorBarcodePopup.js b/addons/point_of_sale/static/src/js/Popups/ErrorBarcodePopup.js index 8cf11c40207..da3e32e3f87 100644 --- a/addons/point_of_sale/static/src/js/Popups/ErrorBarcodePopup.js +++ b/addons/point_of_sale/static/src/js/Popups/ErrorBarcodePopup.js @@ -3,6 +3,7 @@ odoo.define('point_of_sale.ErrorBarcodePopup', function(require) { const ErrorPopup = require('point_of_sale.ErrorPopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); // formerly ErrorBarcodePopupWidget class ErrorBarcodePopup extends ErrorPopup { @@ -12,12 +13,12 @@ odoo.define('point_of_sale.ErrorBarcodePopup', function(require) { } ErrorBarcodePopup.template = 'ErrorBarcodePopup'; ErrorBarcodePopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', - title: 'Error', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), + title: _lt('Error'), body: '', message: - 'The Point of Sale could not find any product, client, employee or action associated with the scanned barcode.', + _lt('The Point of Sale could not find any product, client, employee or action associated with the scanned barcode.'), }; Registries.Component.add(ErrorBarcodePopup); diff --git a/addons/point_of_sale/static/src/js/Popups/ErrorPopup.js b/addons/point_of_sale/static/src/js/Popups/ErrorPopup.js index 865779c475e..8c07dc1e8f0 100644 --- a/addons/point_of_sale/static/src/js/Popups/ErrorPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/ErrorPopup.js @@ -3,6 +3,7 @@ odoo.define('point_of_sale.ErrorPopup', function(require) { const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); // formerly ErrorPopupWidget class ErrorPopup extends AbstractAwaitablePopup { @@ -12,9 +13,9 @@ odoo.define('point_of_sale.ErrorPopup', function(require) { } ErrorPopup.template = 'ErrorPopup'; ErrorPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', - title: 'Error', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), + title: _lt('Error'), body: '', }; diff --git a/addons/point_of_sale/static/src/js/Popups/ErrorTracebackPopup.js b/addons/point_of_sale/static/src/js/Popups/ErrorTracebackPopup.js index 1af25e42180..b9ca658e855 100644 --- a/addons/point_of_sale/static/src/js/Popups/ErrorTracebackPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/ErrorTracebackPopup.js @@ -3,6 +3,7 @@ odoo.define('point_of_sale.ErrorTracebackPopup', function(require) { const ErrorPopup = require('point_of_sale.ErrorPopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); // formerly ErrorTracebackPopupWidget class ErrorTracebackPopup extends ErrorPopup { @@ -29,12 +30,12 @@ odoo.define('point_of_sale.ErrorTracebackPopup', function(require) { } ErrorTracebackPopup.template = 'ErrorTracebackPopup'; ErrorTracebackPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', - title: 'Error with Traceback', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), + title: _lt('Error with Traceback'), body: '', exitButtonIsShown: false, - exitButtonText: 'Exit Pos', + exitButtonText: _lt('Exit Pos'), exitButtonTrigger: 'close-pos' }; diff --git a/addons/point_of_sale/static/src/js/Popups/OfflineErrorPopup.js b/addons/point_of_sale/static/src/js/Popups/OfflineErrorPopup.js index 147ed7c435a..5da85994243 100644 --- a/addons/point_of_sale/static/src/js/Popups/OfflineErrorPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/OfflineErrorPopup.js @@ -3,6 +3,7 @@ odoo.define('point_of_sale.OfflineErrorPopup', function(require) { const ErrorPopup = require('point_of_sale.ErrorPopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); /** * This is a special kind of error popup as it introduces @@ -17,10 +18,10 @@ odoo.define('point_of_sale.OfflineErrorPopup', function(require) { OfflineErrorPopup.template = 'OfflineErrorPopup'; OfflineErrorPopup.dontShow = false; OfflineErrorPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', - title: 'Offline Error', - body: 'Either the server is inaccessible or browser is not connected online.', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), + title: _lt('Offline Error'), + body: _lt('Either the server is inaccessible or browser is not connected online.'), }; Registries.Component.add(OfflineErrorPopup); diff --git a/addons/point_of_sale/static/src/js/Popups/OrderImportPopup.js b/addons/point_of_sale/static/src/js/Popups/OrderImportPopup.js index c2c352917e7..8395bf28c81 100644 --- a/addons/point_of_sale/static/src/js/Popups/OrderImportPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/OrderImportPopup.js @@ -3,6 +3,7 @@ odoo.define('point_of_sale.OrderImportPopup', function(require) { const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); // formerly OrderImportPopupWidget class OrderImportPopup extends AbstractAwaitablePopup { @@ -16,8 +17,8 @@ odoo.define('point_of_sale.OrderImportPopup', function(require) { } OrderImportPopup.template = 'OrderImportPopup'; OrderImportPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), body: '', }; diff --git a/addons/point_of_sale/static/src/js/Popups/SelectionPopup.js b/addons/point_of_sale/static/src/js/Popups/SelectionPopup.js index 5321fdea0fe..f57f729f581 100644 --- a/addons/point_of_sale/static/src/js/Popups/SelectionPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/SelectionPopup.js @@ -4,6 +4,7 @@ odoo.define('point_of_sale.SelectionPopup', function (require) { const { useState } = owl.hooks; const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); // formerly SelectionPopupWidget class SelectionPopup extends AbstractAwaitablePopup { @@ -44,9 +45,9 @@ odoo.define('point_of_sale.SelectionPopup', function (require) { } SelectionPopup.template = 'SelectionPopup'; SelectionPopup.defaultProps = { - confirmText: 'Confirm', - cancelText: 'Cancel', - title: 'Select', + confirmText: _lt('Confirm'), + cancelText: _lt('Cancel'), + title: _lt('Select'), body: '', list: [], }; diff --git a/addons/point_of_sale/static/src/js/Popups/TextAreaPopup.js b/addons/point_of_sale/static/src/js/Popups/TextAreaPopup.js index 1f2735f671d..cbeb9528309 100644 --- a/addons/point_of_sale/static/src/js/Popups/TextAreaPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/TextAreaPopup.js @@ -4,6 +4,7 @@ odoo.define('point_of_sale.TextAreaPopup', function(require) { const { useState, useRef } = owl.hooks; const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); // formerly TextAreaPopupWidget // IMPROVEMENT: This code is very similar to TextInputPopup. @@ -27,8 +28,8 @@ odoo.define('point_of_sale.TextAreaPopup', function(require) { } TextAreaPopup.template = 'TextAreaPopup'; TextAreaPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), title: '', body: '', }; diff --git a/addons/point_of_sale/static/src/js/Popups/TextInputPopup.js b/addons/point_of_sale/static/src/js/Popups/TextInputPopup.js index 4a0612d21fe..2a121052499 100644 --- a/addons/point_of_sale/static/src/js/Popups/TextInputPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/TextInputPopup.js @@ -4,6 +4,7 @@ odoo.define('point_of_sale.TextInputPopup', function(require) { const { useState, useRef } = owl.hooks; const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); // formerly TextInputPopupWidget class TextInputPopup extends AbstractAwaitablePopup { @@ -21,8 +22,8 @@ odoo.define('point_of_sale.TextInputPopup', function(require) { } TextInputPopup.template = 'TextInputPopup'; TextInputPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), title: '', body: '', startingValue: '', diff --git a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js index c3550b84e12..71c2495fee9 100644 --- a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js @@ -229,7 +229,7 @@ odoo.define('point_of_sale.PaymentScreen', function (require) { if (!result) { await this.showPopup('ErrorPopup', { title: this.env._t('Error: no internet connection.'), - body: this.env._t('Some, if not all, post-processing after syncing order failed.') + body: this.env._t('Some, if not all, post-processing after syncing order failed.'), }); } } diff --git a/addons/pos_mercury/static/src/js/PaymentTransactionPopup.js b/addons/pos_mercury/static/src/js/PaymentTransactionPopup.js index 9b47da70993..565c9928ae1 100644 --- a/addons/pos_mercury/static/src/js/PaymentTransactionPopup.js +++ b/addons/pos_mercury/static/src/js/PaymentTransactionPopup.js @@ -4,6 +4,7 @@ odoo.define('pos_mercury.PaymentTransactionPopup', function(require) { const { useState } = owl.hooks; const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); class PaymentTransactionPopup extends AbstractAwaitablePopup { constructor() { @@ -25,9 +26,9 @@ odoo.define('pos_mercury.PaymentTransactionPopup', function(require) { } PaymentTransactionPopup.template = 'PaymentTransactionPopup'; PaymentTransactionPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', - title: 'Online Payment', + confirmText: _lt('Ok'), + cancelText: _lt('Cancel'), + title: _lt('Online Payment'), body: '', }; diff --git a/addons/pos_restaurant/static/src/js/Screens/FloorScreen/FloorScreen.js b/addons/pos_restaurant/static/src/js/Screens/FloorScreen/FloorScreen.js index 3a48c25efcc..dabbf25a1a2 100644 --- a/addons/pos_restaurant/static/src/js/Screens/FloorScreen/FloorScreen.js +++ b/addons/pos_restaurant/static/src/js/Screens/FloorScreen/FloorScreen.js @@ -340,8 +340,8 @@ odoo.define('pos_restaurant.FloorScreen', function (require) { } catch (error) { if (error.message.code < 0) { await this.showPopup('OfflineErrorPopup', { - title: 'Offline', - body: 'Unable to get orders count', + title: this.env._t('Offline'), + body: this.env._t('Unable to get orders count'), }); } else { throw error; diff --git a/addons/pos_restaurant/static/src/js/Screens/ProductScreen/ControlButtons/SubmitOrderButton.js b/addons/pos_restaurant/static/src/js/Screens/ProductScreen/ControlButtons/SubmitOrderButton.js index 948410e5d08..73d3921aad3 100644 --- a/addons/pos_restaurant/static/src/js/Screens/ProductScreen/ControlButtons/SubmitOrderButton.js +++ b/addons/pos_restaurant/static/src/js/Screens/ProductScreen/ControlButtons/SubmitOrderButton.js @@ -32,8 +32,8 @@ odoo.define('pos_restaurant.SubmitOrderButton', function(require) { order.saveChanges(); } else { await this.showPopup('ErrorPopup', { - title: 'Printing failed', - body: 'Failed in printing the changes in the order', + title: this.env._t('Printing failed'), + body: this.env._t('Failed in printing the changes in the order'), }); } } diff --git a/addons/pos_restaurant/static/src/js/Screens/TipScreen.js b/addons/pos_restaurant/static/src/js/Screens/TipScreen.js index bb6e17a21bb..32d5a44a621 100644 --- a/addons/pos_restaurant/static/src/js/Screens/TipScreen.js +++ b/addons/pos_restaurant/static/src/js/Screens/TipScreen.js @@ -42,8 +42,8 @@ odoo.define('pos_restaurant.TipScreen', function (require) { if (!serverId) { this.showPopup('ErrorPopup', { - title: 'Unsynced order', - body: 'This order is not yet synced to server. Make sure it is synced then try again.', + title: this.env._t('Unsynced order'), + body: this.env._t('This order is not yet synced to server. Make sure it is synced then try again.'), }); return; }