1

I want to Translate a custom button name using i18n. I tried like this

app/code/My_vendor/My_module/i18n/ar_SA.csv

"I am the gift Receiver","أنا المتلقي هدية"

The affect should take place in below html file

app/code/My_vendor/My_module/view/frontend/web/templates/actions.html

<button click="datafill">
   <span data-bind="i18n: 'I am the gift Receiver'"></span>
</button>

Note: I also tried translate but it also didn't work for me.

Question: How to translate i18n value from tag in html.

1

You can try like this:

<button click="datafill">
   <span>__('I am the gift Receiver')</span>
</button>
| improve this answer | |
  • yes, i am trying like this also, but it didn't worked – Siranjeevi K S May 12 at 11:18
1

That looks like the correct way to use the i18n databind. But that doesn't always populate properly on the frontend unless static content has been deployed. It's relies on the translation json file create there and it doesn't always populate correctly in developer mode. Check the checkout html template files and such if you need to check the syntax.

| improve this answer | |

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.