[FIX] point_of_sale: correctly translate some UI elements

Before some translations didn't work in the point_of_sale because in owl
you can't use t-set to manage translations. In cashMovePopup, _t was
used at a time when loading translations is not yet guaranteed.

Now we have changed _t to _lt to ensure that the translation is done
correctly. For the t-set, we have added the translations in static
properties of the concerned components.

closes odoo/odoo#120403

X-original-commit: b2b9f760844304858aa64c51e7bda87190b11386
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Mountain Tran
2023-05-04 10:00:42 +02:00
committed by Joseph Caburnay
parent c0ce6ca7b6
commit a774b5ec7f
4 changed files with 8 additions and 7 deletions
@@ -5,6 +5,7 @@ import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { useBarcodeReader } from "@point_of_sale/app/barcode_reader_hook";
import { parseFloat } from "@web/views/fields/parsers";
import { _lt } from "@web/core/l10n/translation";
import { NumberPopup } from "@point_of_sale/js/Popups/NumberPopup";
import { ErrorPopup } from "@point_of_sale/js/Popups/ErrorPopup";
@@ -31,6 +32,7 @@ export class ProductScreen extends ControlButtonsMixin(Component) {
OrderWidget,
ProductsWidget,
};
static numpadActionName = _lt("Payment");
setup() {
super.setup();
@@ -6,6 +6,7 @@ import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { deserializeDateTime } from "@web/core/l10n/dates";
import { parseFloat } from "@web/views/fields/parsers";
import { _lt } from "@web/core/l10n/translation";
import { ErrorPopup } from "@point_of_sale/js/Popups/ErrorPopup";
import { ConfirmPopup } from "@point_of_sale/js/Popups/ConfirmPopup";
@@ -41,6 +42,8 @@ export class TicketScreen extends IndependentToOrderScreen {
reuseSavedUIState: false,
ui: {},
};
static numpadActionName = _lt("Refund");
static searchPlaceholder = _lt("Search Orders...");
setup() {
super.setup();
@@ -18,10 +18,9 @@
</t>
</div>
<div class="subpads">
<t t-set="_actionName">Payment</t>
<ActionpadWidget
partner="partner"
actionName="_actionName"
actionName="constructor.numpadActionName"
onSwitchPane.bind="switchPane" />
<NumpadWidget
updateSelectedOrderline.bind="updateSelectedOrderline"
@@ -35,11 +35,10 @@
</button>
</t>
</t>
<t t-set="_placeholder">Search Orders...</t>
<SearchBar
t-if="state.showSearchBar"
config="getSearchBarConfig()"
placeholder="_placeholder"
placeholder="constructor.searchPlaceholder"
onSearch.bind="onSearch"
onFilterSelected.bind="onFilterSelected" />
<div t-if="shouldShowPageControls()" class="item">
@@ -131,11 +130,9 @@
<ReprintReceiptButton order="_selectedSyncedOrder" />
</div>
<div class="subpads">
<!-- We set so that the term 'Refund' is translated. -->
<t t-set="_actionName">Refund</t>
<ActionpadWidget
partner="getSelectedPartner()"
actionName="_actionName"
actionName="constructor.numpadActionName"
actionToTrigger.bind="onDoRefund"
isActionButtonHighlighted="getHasItemsToRefund()" />
<NumpadWidget