Skip to content

Not translated "Please enter a valid email address (Ex: [email protected])." #4883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pareshe opened this issue Jun 6, 2016 · 53 comments
Closed
Labels
bug report Component: Checkout Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@pareshe
Copy link

pareshe commented Jun 6, 2016

In checkout with guest customer when enter invalid email address in "Email" field that time display this error and that is not translated.

@cpartica
Copy link
Contributor

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

@pboisvert
Copy link

@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

@pareshe
Copy link
Author

pareshe commented Jul 5, 2016

Please check this screen-shot:
http://awesomescreenshot.com/0f1600sw6a

@jernejh
Copy link

jernejh commented Jul 28, 2016

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.

@Tjitse-E
Copy link
Contributor

Tjitse-E commented Aug 2, 2016

Same issue here in Magento 2.1

@SchumacherFM
Copy link
Member

Same issue in M2.1 :-(

Hope this fix is included in >= 2.1.1

@onepack
Copy link

onepack commented Aug 24, 2016

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...?

@shockwavemk
Copy link

shockwavemk commented Aug 29, 2016

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]).')

validation.js.txt

@onepack
Copy link

onepack commented Aug 29, 2016

@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.

@shockwavemk
Copy link

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": ...

@heldchen
Copy link
Contributor

still present in 2.1.1...

@SerhiyShkolyarenko
Copy link
Contributor

@pareshe @jernejh @Tjitse-E @SchumacherFM @onepack @heldchen sorry for slow reply. We created internal issue MAGETWO-59123.

@SerhiyShkolyarenko SerhiyShkolyarenko added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Sep 29, 2016
@SchumacherFM
Copy link
Member

Thank you. That took you 4 month ...

@heldchen
Copy link
Contributor

appreciated, @SerhiyShkolyarenko

@tkn98
Copy link
Contributor

tkn98 commented Oct 5, 2016

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:

@PieterCappelle
Copy link
Contributor

PieterCappelle commented Oct 13, 2016

Remains unsolved in 2.1.2.

@tkn98
Copy link
Contributor

tkn98 commented Oct 13, 2016

@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.

@Ctucker9233
Copy link

They should take some time to clear their queue before the next release.

@benmarks
Copy link
Contributor

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.

@tkn98
Copy link
Contributor

tkn98 commented Nov 14, 2016

@benmarks: Just by chance, any list at hand?

@jibrandlr
Copy link

@tkn98 the "solution" has already been provided by @shockwavemk

@steros
Copy link
Contributor

steros commented May 29, 2017

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.

@royvanos
Copy link

royvanos commented Jun 1, 2017

This issue still persists in 2.1.7...

EDIT: the fix by @gemscng works perfectly fine, thanks!

@steros
Copy link
Contributor

steros commented Jun 1, 2017

@maksek Doesn't work for me in 2.1.7 too...

@shockwavemk
Copy link

shockwavemk commented Jun 1, 2017

@steros Maybe my module could help you with your translation issues.

Packagist

@kanduvisla
Copy link
Contributor

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.

@benmarks
Copy link
Contributor

benmarks commented Jun 7, 2017

@royvanos @steros - 2.1.7 is security-only release.

@steros
Copy link
Contributor

steros commented Jun 7, 2017

@benmarks I guess we were both referring to @maksek milestone change.

@gemscng
Copy link

gemscng commented Jun 7, 2017

You guys can check my message above if it is about translation in js file.

@pyyick
Copy link

pyyick commented Jul 14, 2017

@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

@gemscng
Copy link

gemscng commented Jul 14, 2017

@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.

@sakamotz
Copy link

sakamotz commented Aug 4, 2017

This issue still persists in 2.1.7CE.
Thanks @gemscng.
It solved by the following method
#4883 (comment)

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

@Userr017
Copy link

Userr017 commented Aug 6, 2017

@shockwavemk What is file path and line for this translate fix? "Please enter the same value again."

@ajmedway
Copy link

@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?

@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-72250

@magento-team magento-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Checkout labels Sep 2, 2017
@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Checkout Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Oct 2, 2017

Fix for the issue is already delivered to 2.2.0 with f67e598.
Closing this report for now. Please reopen if the issue persists.

@magento-engcom-team magento-engcom-team added Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line labels Oct 2, 2017
@superkgy
Copy link

Ok guys, here's what worked for me:

function () { return $.mage.__('Please enter a valid email address (Ex: [email protected]).'); }

validation.js.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Checkout Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests