Magento 2: Translate knockout html where “mailto:info@sitename.com” is used
-
16-04-2021 - |
Question
In Magento_Checkout/web/template/minicart/content.html there is a "mailto:info@website.com" used. Now I can translate the last piece by -- ko text: $t('info@website.com') --> <-- /ko --> into something like "info@website.co.uk". But how can I translate "mailto:info@website.com" into "mailto:@website.co.uk"? So that I can use it for a multistore website. I believe it is in JS knockout: see the code below:
<!-- ko ifnot: getCartParam('summary_count') -->
<div class="c-minicart__footer__right col-8">
<i class="icon-envelope"></i>
<a href="mailto:info@website.com">info@website.com</a>
</div>
<!-- /ko -->
Solution
You can use so tag:
<!-- ko ifnot: getCartParam('summary_count') -->
<div class="c-minicart__footer__right col-8">
<i class="icon-envelope"></i>
<a href="#" attr="href: $t('mailto:info@website.com')">>
<translate args="'info@website.com'"/>
</a>
</div>
<!-- /ko -->
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange