Question

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: johndoe@domain.com). or Please enter 6 or more characters. Leading or trailing spaces will be ignored.)

This is a sample:

enter image description here

Was it helpful?

Solution

1) magento 2.0.5 (test - true)

lib/web/mage/validation.js

line 246 :

replace : 'Please enter a valid email address (Ex: johndoe@domain.com).'
$.mage.__('Please enter a valid email address (Ex: johndoe@domain.com).')
2) Del. static : pub/static/ (only dir) and var/view_preprocessed/ 

OTHER TIPS

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top