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.

1
  • Which file did you find the example? Can you give me the path? Commented Sep 19, 2017 at 8:10

1 Answer 1

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 and acknowledge you have read our privacy policy.

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