0

I have override the register template in my custom theme. In this form use the validation to validate my fields but the translation of the error messages aren't showed.

I declare the function where I validate my fields by :

require([
        'jquery',
        'mage/translate',
        'mage/mage',
        'mage/validation'
    ], function ($) {
        var dataForm = $('#form-validate');
        ...
        if (dataForm.validation('isValid')) {
           ...
        }
        ...
});

I cleared caches, deploy static content by the language I used, remove js-translation.json to regenerate it (it is well regenerated with all js string content to translate)...

My translations are in my theme app/design/frontend/Vendor/themeName/i18n/xx_XX.csv

1
  • Did you use like $.mage.__('Your message here') ? Apr 3, 2017 at 9:35

1 Answer 1

0

You should use like below code. This is just example.

require([
'jquery',
'jquery/ui', 
'mage/translate'
], function($){ 
    $(window).load(function() {
        alert($.mage.__('Your Message'));
    });
});
1
  • Yes it works but why validation are not translated ? it's the problem the strings I generate with translations and base string translations are not translated
    – Kpone
    Apr 3, 2017 at 12:36

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.