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

asked Apr 3, 2017 at 9:18
1
  • Did you use like $.mage.__('Your message here') ? Commented 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'));
 });
});
answered Apr 3, 2017 at 9:36
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 Commented Apr 3, 2017 at 12:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.