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– Kishan Patadia2017年04月03日 09:35:06 +00:00Commented Apr 3, 2017 at 9:35
1 Answer 1
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 translatedKpone– Kpone2017年04月03日 12:36:44 +00:00Commented Apr 3, 2017 at 12:36
Explore related questions
See similar questions with these tags.