In checkout with guest customer when enter invalid email address in "Email" field that time display this error and that is not translated.
if you have a look at Magento/Ui/view/base/web/js/lib/validation/rules.js
$.mage.__('Please enter a valid email address (Ex: [email protected]).')
that means that error message is translated, but probably you don't have the right translation in your translation file, so it's not a Magento 2 issue, more of who's maintaining your language pack
You can manually add that into your language file
@pareshe were you able to resolve this issue by translating this string in your language pack? If so please close the issue or provide more details
Please check this screen-shot:
http://awesomescreenshot.com/0f1600sw6a
I am facing the same issue in Magneto 2.1.0.
I have the following line in sl_SI.csv:
"Please enter a valid email address (Ex: [email protected]).","Prosimo vnesite veljaven elektronski naslov (Primer: [email protected]).",module,Magento_Ui
Magento is still not translating the string, despite I removed pub/static, var/cache, var/generation, var/page_cache, var/view_preprocessed folders and ran bin/magento setup:static-content:deploy sl_SI command and refreshed the cache.
Same issue here in Magento 2.1
Same issue in M2.1 :-(
Hope this fix is included in >= 2.1.1
Same here in M2.1
Translating Magento should have become easier with M2 but it has become a nightmare to get some simple stuff translated.
To get my theme translated I'm now working with 2 translation files. One general Magento i18n under app/i18n/locale/locale.csv and one in the theme.
As some strings (from .js files) are not translatable by my theme csv file like "Search entire store here" I ended up making the general magento translation file.
Also I might expect that a theme translation is always ruling and thus overruling the general magento translation but I found out that my theme translations were gone after I placed a general magento locale translation in app/i18n. So I stripped down that file to only contain what I cannot translate in my theme translation file like the .js strings.
And even with all these trials and errors, still johndoe is here to stay. Why...?
Hi :)
The solution for most of this not translated errors in validation is the following library "mage/validation". Most of the returned messages do not call the mage translation method.
You can override the file with your own file by using a module with a requirejs-config:
/*jshint browser:true jquery:true*/
/*global alert*/
var config = {
"map": {
"*": {
'mage/validation': 'YourVendor_CoreBugFix/js/model/validation',
}
}
};
You can translate every validation hint after surronding it with a $.mage.__('') method call:
$.mage.__('Please enter a valid email address (Ex: [email protected]).')
@shockwavemk
Yeah, I saw this solution a couple of times but in my opinion this should be translatable by a translation or theme translation. So without an extra module.
I will use this solution for the time being until it is solved in a coming M2 release.
Some additional hint: some errors are still not translateable by default even if you surround all values in validation.js. For example: passwords have to be same.
To solve this issue just add an override of the method "equalTo" (jquery.validate.js) into the validation.js
/**
* Collection of validation rules including rules from additional-methods.js
* @type {Object}
*/
var rules = {
"equalTo": [
function (value, element, param) {
// bind to the blur event of the target in order to revalidate whenever the target field is updated
// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
var target = $(param);
if (this.settings.onfocusout) {
target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function () {
$(element).valid();
});
}
return value === target.val();
},
$.mage.__('Please enter the same value again.')
],
"max-words": ...
still present in 2.1.1...
@pareshe @jernejh @Tjitse-E @SchumacherFM @onepack @heldchen sorry for slow reply. We created internal issue MAGETWO-59123.
Thank you. That took you 4 month ...
appreciated, @SerhiyShkolyarenko
Can confirm that translation for strings in lib/web/mage/validation.js
are missing. It looks like they have been hard-encoded and is not interfaced with any translation layer.
Refs:
Remains unsolved in 2.1.2.
@PieterCappelle: Yes, no change with that patch. We're trying hard on our end to technically raise and escalate the issue. However it looks like that Magento (the vendor) is (currently) blocked by the load in it's queue. I wish the vendor have taken more care about translation (everything not in en_US) from the very beginning.
They should take some time to clear their queue before the next release.
They should take some time to clear their queue before the next release.
As it turns out, we are. Expect a lot of fixes up to and especially including 2.2.
@benmarks: Just by chance, any list at hand?
@tkn98 the "solution" has already been provided by @shockwavemk
@lgarridoj commented 7 hours ago
Still it would be nice if magento can make a permanent fix in stead of needing these default workarounds.
No need to feed the troll.
Issue was fixed in MAGETWO-55900. Please, check the develop branch and leave a feedback if it works for you.
Tasks for backporting MAGETWO-56919(ver. 2.0) and MAGETWO-56920(ver. 2.1)
@SerhiyShkolyarenko Can you please provide the commit hash(es) of the fix in MAGETWO-55900?
@tkn98 here you are f67e598 :)
@SerhiyShkolyarenko: Thanks!
Problem still present in 2.1.3. Waiting for fix.
Im in the middle of a project with 2.1.2 and I have too many bugs related to translation:
1)Order confirmation not working when sent via backend - reported already
2)validation.js, jquery.validate.js not translated - reported already
3)Saving configurable product with translation via backend results to simple being reset to 0.000 price vaues - reported already
......
.... "I am thinking what the hell is going on" quote by Trump / president elect
same problem here, magento2 CE 2.1.3
Problem still present on 2.1.3 for all validation messages generated on vendor/magento/magento2-base/lib/web/mage/validation.js.
Someone probably missed the use of $.mage.__() on that file. Overriding and implementing this method on your theme, solves the problem
As a temporarily fix:
For example:
/**
* Validate credit card number based on mod 10
* @param value - credit card number
* @return {boolean}
*/
function (value) {
if (value) {
return validateCreditCard(value);
}
return false;
}, 'Please enter a valid credit card number.'
],`
Should be:
/**
* Validate credit card number based on mod 10
* @param value - credit card number
* @return {boolean}
*/
function (value) {
if (value) {
return validateCreditCard(value);
}
return false;
}, $.mage.__('Please enter a valid credit card number.')
],
Yes, it's still in 2.1.x, I got confirmation from Magento support that it is not yet backported to the current stable version.
Fix will be delivered in 2.1.7, 2.0.15 and 2.2.0
@maksek: Can you please provide an ETA? And don't stumble upon revisions ... :)
For any one who come across this post. You can just copy validation.js from lib/mage to your own theme's web folder and create mage folder, says [Vendor]/[theme]/web/mage/validation.js. Then add back $.mage.__().
Attached is a working js we are using now.
validation.txt
I have tried to follow this instructions and the page was translated
https://github.com/magento/magento2/issues/2951
but the page only translate on local pc (apache). Why on my EC2 aws (nginx), the page are not translate after bundle js?
I did as @shockwavemk proposed but the messages are still not translated even though it picks up that file (I tried by changing error messages) and those messages are translated in my translation files...
Any suggestion for this? Of course I rebuild static content and so on.
I'm on 2.1.6 currently.
This issue still persists in 2.1.7...
EDIT: the fix by @gemscng works perfectly fine, thanks!
@maksek Doesn't work for me in 2.1.7 too...
@steros Maybe my module could help you with your translation issues.
This problem still persists in Magento 2.1.7. I had to uses @gemscng 's solution to solve it. But doesn't seem very neat.
@royvanos @steros - 2.1.7 is security-only release.
@benmarks I guess we were both referring to @maksek milestone change.
You guys can check my message above if it is about translation in js file.
@kanduvisla : @gemscng solution is not neat. Directly overwrite the core is a very bad practice. So instead of overwrite this file, I'd rather override this file, as if the solution from @shockwavemk . Actually in Magento Stack Exchange, there are a method to teach you the whole steps to override the validation.js
https://magento.stackexchange.com/questions/162195/translate-checkout-strings
@pyyick Mine is same concept as the link you posted. Instead of creating a module. Just put the validation.js in your own theme. No need to modify the core.
This issue still persists in 2.1.7CE.
Thanks @gemscng.
It solved by the following method
https://github.com/magento/magento2/issues/4883#issuecomment-285018521
Put to file
/app/design/frontend/[Vendor]/[theme]/web/mage/validation.js.
In the case of passing, it was not reflected in the file placement and cache clear command (/ bin / magento cache: flush).
and, reflect with the following command.
cd pub/static/
find . -depth -name .htaccess -prune -o -delete
cd ../../
rm -rf var/view_preprocessed
bin/magento setup:static-content:deploy
@shockwavemk What is file path and line for this translate fix? "Please enter the same value again."
@steros and anyone else struggling with this... have you tried switching to production mode? I nuked every aspect of the cache and everything was 100% in order so that translations from .js strings, which I could see were being run through the $.mage.__()
function, were just not being translated. I then switched to production mode skipping compilation:
php bin/magento deploy:mode:set production --skip-compilation
Then compiled assets for the locale and themes I was working with and then all my strings from my .csv dictionary were translated. Maybe there was some area of the cache I failed to nuke? It seems ridiculous that you must go into production mode and recompile to see translation strings/changes. Here is my cache nuke 1-liner:
rm -rf var/cache/*; rm -rf var/di/*; rm -rf var/generation/*; rm -rf var/view_preprocessed/*; rm -rf var/page_cache/*; rm -rf pub/static/*;
What am I missing?
Internal ticket to track issue progress: MAGETWO-72250
Fix for the issue is already delivered to 2.2.0
with f67e5989f5efb36ca331e5cc28ee109961fcb99c.
Closing this report for now. Please reopen if the issue persists.
Ok guys, here's what worked for me:
function () { return $.mage.__('Please enter a valid email address (Ex: [email protected]).'); }
Most helpful comment
Thank you. That took you 4 month ...