How to translate text in shipping-estimation.html
-
12-04-2021 - |
Question
I need to translate the text Enter your billing address to get a tax estimate. in vendor\magento\module-checkout\view\frontend\web\template\cart\shipping-estimation.html
It is a text showing in the cart
<form method="post" id="shipping-zip-form">
<fieldset class="fieldset estimate">
<legend class="legend">
<span data-bind="text: isVirtual ? $t('Estimate Tax') : $t('Estimate Shipping and Tax') "></span>
</legend><br>
<p class="field note" data-bind="text: isVirtual ? $t('Enter your billing address to get a tax estimate.') : $t('Enter your destination to get a shipping estimate.')"></p>
<!-- ko foreach: getRegion('address-fieldsets') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</fieldset>
</form>
I added the translation in app\design\frontend\company\base\i18n\de_DE.csv:
"Enter your destination to get a shipping estimate.", "Bitte geben Sie Ihren Ort an um eine Versandkostenschätzung zu erhalten."
and cleared the cache, but nothing changes.
Solution
I think I found a solution that works for me at least.
My translation file is in:
app/design/frontend/**MyPackage**/**MyTheme**/i18n/XX_XX.csv
I added the string there.
Then I copied this file to my theme folder:
vendor/magento/module-checkout/view/frontend/web/template/cart/shipping-estimation
to
app/design/frontend/**Yourpackage**/**Yourtheme**/Magento_Checkout/web/template/cart/shipping-estimation.html
Then I flushed all caches and manually deleted this file (I'm in developer mode):
pub/static/frontend/**Yourpackage**/**Yourtheme**/XX_XX/js-translation.json
When I refreshed the frontend checkout page the string was translated.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange