1

I use magento 2.0 and I have a problem.

The JS messages of fields control do not translated (like Please enter a valid email address (Ex: [email protected]). or Please enter 6 or more characters. Leading or trailing spaces will be ignored.)

This is a sample:

enter image description here

1

3 Answers 3

4

1) magento 2.0.5 (test - true)

lib/web/mage/validation.js

line 246 :

replace : 'Please enter a valid email address (Ex: [email protected]).'
$.mage.__('Please enter a valid email address (Ex: [email protected]).')
2) Del. static : pub/static/ (only dir) and var/view_preprocessed/ 
1
  • Have you verified this issue with upstream? E.g. is this reported? If so can you please provide a link or a ticket number? That would be tremendously great.
    – hakre
    Oct 4, 2016 at 11:29
0

To solve this Magento bug, I copy the file lib/web/mage/validation.js to my theme and translated it there.

So, the translated file is in: app/design/frontend/<vendor>/<theme>/web/mage/validation.js

1
  • app/design/frontend/vendor/theme/web/mage/validation.js Jul 27, 2017 at 0:04
0

Instead of direct changes in js. Make csv as per locale Ex: app/design/frontend///i18n/de_DE.csv(locale name).

Ex:

"You can create an account after checkout.","Sie können nach dem Auschecken ein Konto erstellen."

"Provided Zip/Postal Code seems to be invalid.","Die angegebene Postleitzahl scheint ungültig zu sein."

" Example: "," Beispiel: "

"If you believe it is the right one you can ignore this notice.","Wenn Sie glauben, dass es das richtige ist, können Sie diesen Hinweis ignorieren."

Run the following commands:

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy de_DE -f

php bin/magento cache:clean

Now refresh the page with Ctrl + F5.

Now you can see js messages are translated

Your Answer

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

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