Please advice is there any pre-requirements to translate in *.html files


<button type="submit" class="action primary"><span>Send link to a Friend</span></button>

Don't want to work:

<button type="submit" class="action primary"><span data-bind="i18n: 'Send link to a Friend'"></span></button>

Translation in i18n/en_US.csv exists. Am I doing something wrong?

2 Answers 2


you can use

<button type="submit" class="action primary">
  <span data-bind="text: $t('Send link to a Friend')"></span>

Make sure that the templates view component has the mage/translate dependency, also make sure that you re-generate your static view files.

Use a language pack, placed in app/i18n, instead of placing the translations in a module or theme. Translations of js files has been buggy, but using a language pack has worked for me in version 2.1.6+. See this Github issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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