I've translated some text in a javascript file with translation.js, I've done it the following way:
I've defined the translator.
define([
'mage/translate',
];
After that, I translated my text.
$.mage.__('excl. VAT')
And added the translation in the CSV file.
The strange thing is, that sometimes it get's translated and sometimes not…
Did I miss something?
Best Answer
Best approach for this would be to use
'domReady!'
in yourdefine
to make sure document is fully loaded once translation is applied.