Skip to content

"Not yet calculated" for the tax in the summary section in the checkout is not translatable #18939

Closed
@rajeev-k-tomy

Description

@rajeev-k-tomy

Preconditions (*)

  1. 2.2.3 (still present in 2.3-beta)
  2. Those sites which uses more than 1 stores (languages).

Steps to reproduce (*)

  1. Setup a two-store site where the default store uses "en_Us" as the language and the second store uses "es_ES" (Spanish ).

  2. Add Spanish translation for the text: "Not yet calculated" through the design section. i.e, in the file: app/design/frontend/<Package>/<theme>/i18n/es_ES.csv.

     "Not yet calculated","Aún no calculado"
    
  3. Now on the frontend, switch to Spanish store. Then add a product to the cart and go for checkout.

  4. In the payment step, under the summary section, you will see "Not yet calculated" is not translated for the Tax eventhough the same text corresponding to Shipping is translated.

Expected result (*)

  1. In the summary section in the checkout, we should see Aún no calculado for the Tax total.

Actual result (*)

  1. But what we see there is Not yet calculated

Why this is happened

The issue occured because of there is no translation applied for the text: "Not yet calculated" in the UiComponent Magento_Tax/js/view/checkout/summary/tax.

This is how the text is called on the template. File: vendor/magento/module-tax/view/frontend/web/template/checkout/summary/tax.html

       <!-- ko ifnot: isCalculated() -->
            <span class="not-calculated" data-bind="text: getValue()"></span>
        <!-- /ko -->

So getValue() is providing the text here. So if we check in the component js file: vendor/magento/module-tax/view/frontend/web/js/view/checkout/summary/tax.js

return Component.extend({
    defaults: {
        ...
        notCalculatedMessage: 'Not yet calculated',
       ...
    },
    ...
    /**
     * @return {*}
     */
    getValue: function () {
        var amount;

        if (!this.isCalculated()) {
            return this.notCalculatedMessage;
        }
        amount = totals.getSegment('tax').value;

        return this.getFormattedPrice(amount);
    },
   ....

As you can see the text does not have any translations applied.

How can fix this?

Apparently adding translation in the component will fix the issue. Example is shown:

File: vendor/magento/module-tax/view/frontend/web/js/view/checkout/summary/tax.js

define([
    'ko',
    'mage/translate',
    'Magento_Checkout/js/view/summary/abstract-total',
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/model/totals'
], function (ko, $t, Component, quote, totals) {
    
    return Component.extend({
        defaults: {
            notCalculatedMessage: $t('Not yet calculated'),
        },
        ...
    });
});

Awaiting the response. Thank you. :)

Metadata

Metadata

Labels

Component: CheckoutComponent: TaxFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions