magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

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

Open pareshe opened this issue 10 years ago • 53 comments

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

pareshe avatar Jun 06 '16 05:06 pareshe

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

cpartica avatar Jun 20 '16 23:06 cpartica

@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

pboisvert avatar Jul 05 '16 13:07 pboisvert

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

pareshe avatar Jul 05 '16 13:07 pareshe

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.

jernejh avatar Jul 28 '16 12:07 jernejh

Same issue here in Magento 2.1

Tjitse-E avatar Aug 02 '16 10:08 Tjitse-E

Same issue in M2.1 :-(

Hope this fix is included in >= 2.1.1

SchumacherFM avatar Aug 17 '16 12:08 SchumacherFM

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

onepack avatar Aug 24 '16 20:08 onepack

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

shockwavemk avatar Aug 29 '16 09:08 shockwavemk

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

onepack avatar Aug 29 '16 10:08 onepack

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

shockwavemk avatar Aug 29 '16 11:08 shockwavemk

still present in 2.1.1...

heldchen avatar Sep 23 '16 08:09 heldchen

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

SerhiyShkolyarenko avatar Sep 29 '16 09:09 SerhiyShkolyarenko

Thank you. That took you 4 month ...

SchumacherFM avatar Sep 29 '16 09:09 SchumacherFM

appreciated, @SerhiyShkolyarenko

heldchen avatar Sep 29 '16 09:09 heldchen

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:

  • Internal Issue: MAGETWO-59123
  • Magento Enterprise Support Case: #03191452
  • Duplicated by: #6141

tkn98 avatar Oct 05 '16 07:10 tkn98

Remains unsolved in 2.1.2.

PieterCappelle avatar Oct 13 '16 10:10 PieterCappelle

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

tkn98 avatar Oct 13 '16 14:10 tkn98

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

Ctucker9233 avatar Oct 16 '16 00:10 Ctucker9233

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 avatar Nov 11 '16 19:11 benmarks

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

tkn98 avatar Nov 14 '16 08:11 tkn98