1

I have this piece of code inside

app\design\frontend\Company_name\porto_base_child\Magento_Checkout\web\template\shipping.html

<div id="poboxmessage" style="display: none; color: red;">address</div>

I am trying to display this div inside this file at the bottom which is working fine on English page but not getting translated to french.

app\design\frontend\Company_name\porto_base_child\Magento_Checkout\web\js\view\shipping-address\list-dropdown.js

$.mage.__(document.getElementById('poboxmessage').style.display='block');

I have put the translation of english to french inside

app\design\frontend\Company_name\porto_base_child\i18n\fr_CA.csv

"address","adresse"

Also the translation in

app\code\Company_name\Catalog\view\frontend\web\js\fr_ca.js

$.mage.__("address");

I am able to display text only in English on both english and french pages the issue is just my text is not getting translated some how. I am still trying to figure out if I have missed any steps. Any advice or suggestion would help me thanks

1
document.getElementById('poboxmessage').style.display='block';
         document.getElementById('poboxmessage').innerHTML=$.mage.__(document.getElementById('poboxmessage').innerHTML);

I was misinterpreting that my div returns a string in block inside mage functionality rather it needs to be converted to block first and then into plain text. $.mage returns just a string while (__) is function which takes of translation putting whole chunk of document.getElementById('poboxmessage').style.display inside $.mage function would not understand anything and returns just a string block

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.