0

In a Magento Knockout template I find a function like so:

<element data-bind="something: function() {
    return 'some string';
}" />

How can I translate this string? I tried following, but it does not work:

<element data-bind="something: function() {
    return $t('some string');
}" />

The translation exists and works in other places, so that is not the problem.

  • Which file did you find the example? Can you give me the path? – Khoa TruongDinh Sep 19 '17 at 8:10
1

Try adding i18n: in front of the value of data-bind attribute. Something like below;

<element data-bind="i18n: something: function() {
    return $t('some string');
}" />

Note: Please note that the translation for corresponding string should be present in your language translation csv.

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.