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

  • Did you use like $.mage.__('Your message here') ? – Kishan Patadia Apr 3 '17 at 9:35
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'));
    });
});
  • 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 '17 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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