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.
Best Answer
Try adding i18n: in front of the value of data-bind attribute. Something like below;
Note: Please note that the translation for corresponding string should be present in your language translation csv.