1

I have added my own custom validations, with a JS mixin, like:

validator.addRule(
    'validate-jurgis',
    function (value) {
        if (value.match(/\d/)) {return false;}
        else {return true;}
    },
    $.mage.__('Address should contain a house number')
);

How do I add translations to the message?

1 Answer 1

1

You need to add translations in module's i18n folder, theme folder or language pack inside your language csv file. Magento will "see" that you're using the translation inside a javascript file and will add your translation to the js-translation.json file who's located in pub/static/frontend/.... In production mode you need to redeploy static content in order to see your new text translated.

Your Answer

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

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