Magento2: Translate "This is a required field" and validation errors on 2.3

Created on 13 Feb 2019  路  37Comments  路  Source: magento/magento2

Summary (*)

Magento 2.3 vanilla with 2 store views

I've installed multiple language packs, currently using this one
https://github.com/EaDesgin/magento2-romanian-language-pack

Everything is translated except the JS validation errors.

Examples (*)

For example :
"This is a required field."

Static deploy is ok generating static files correctly. We can find the translation in mage_translation via cache.

Checked validations.js and entire project and seems string is defined correctly:
$.mage.__('This is a required field.')

Expected results (*)

Translation should display instead of original string "This is a required field."

Behaviour existing on Magento 2.3 vanilla.

Same behaviour found on 2.2.6

Proposed solution (*)

Translation should be loaded normally.

Clear Description Format is valid

Most helpful comment

馃憤 translations are correct in the localstorage mage-translation-storage.
In javascript console `jQuery.mage.__('This is a required field.') give the right translation too (it is related i suppose).

But when i put a breakpoint in jquery/jquery-validate.js, messages are not yet translated , $.mage.__('This is a required field.') doesn't give the translation.

All 37 comments

Hi @verdde. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@verdde do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • _Next steps are available in case you are a member of Community Maintainers._

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

Hi @verdde thank you for you report, i'm not able to reproduce following steps you described,
deepinscreenshot_select-area_20190214102430

@engcom-backlog-nazar

Could you please explain how you did the translation ? Did you tested on multiple store views for a specific language/locale ?

I've tried everything i knew/could and it still doesn't work.

As it should in i18n/test/fr_fr/fr_FR.csv exported the string list translated with no success. Checked theme for bugs or missing strings, found none.

I would greatly appreciate it.

Thank you !

@magento-engcom-team
@engcom-backlog-nazar
@engcom-backlog-tomash
@engcom-backlog-nickolas
Please reopen the ticket this is affecting everyone i am working with and it's using Magento 2.3

Just tested on new M2.3 and the issue is still there.

I have same problem, did you find a solution please ?

Not yet, this problem persists for specific locales only. Haven't time to investigate it on my own and they are closing everyone's ticket.

@magento-engcom-team
@engcom-backlog-nazar
@engcom-backlog-tomash
@engcom-backlog-nickolas

Maybe it's time to take this serious, as you can see more people are encountering these issues.

@verdde but i'm posting a screen, i'm not able to reproduce on different locales, please provide your clear steps. how we can fix this without reproducing this ?

There aren't much steps to provide, in my example i have 2 store views for 1 website. One is English, the default one, and one is Romanian. From this point the translations work fine except the validation ones (tried theme, module, language pack translation, even changing it directly from database)

Please see also the replies from others on

https://github.com/magento/magento2/issues/21367

@engcom-backlog-nazar have you tried on production mode?

@verdde just checked on production mod 2.3-develop
DeepinScreenshot_select-area_20190319105001

Same issue here, magento community edition 2.3.0.
can you tell us the commit fixing it in 2.3-develop, as we can patch it waiting for 2.3.1 ?
thank's

@verdde with ro_RO language pack
DeepinScreenshot_select-area_20190319105607

S茅lection_003

How is it possible ? ^^

@kevinvuillemin maybe problem in your theme ?

Maybe, but it works with version 2.2.x

@verdde @kevinvuillemin do you test on magento community edition 2.3.0 , seems @engcom-backlog-nazar test on 2.3-develop

@spras yes i'm tested on 2.3-develop, now checking on 2.3.0

@spras same on 2.3.0 i'm have translated this message.
steps

  1. composer require mageplaza/magento-2-german-language-pack:dev-master
  2. bin/magento setup:static-content:deploy de_DE
  3. In admin change locale
  4. message appears translated

How about fresh Magento 2.3 CE installation? Answear is below:
Opera Snapshot_2019-03-13_100554l
Opera Snapshot_2019-03-13_100639l

I guess is a caching issue or deployment

With @verdde we have 2 store views.

@kevinvuillemin one is en_US second ith de_DE ?

The same for both : fr_FR

2.3 community, the irony is that we had this issue on enterprise for one of our clients (haha, i don't know the status of the issue there now but one thing is for sure that ticket was closed and forgot about) .

A notice tho, if you check the mage-translation-storage, you'll see the string translated there ! but not in frontend

@verdde that very strange, i was try to reproduce with 2 store views, same result on clean 2.3.0 install, and i was recheck on commerce edition but still have no issue, maybe i'm missed something ?

@verdde that very strange, i was try to reproduce with 2 store views, same result on clean 2.3.0 install, and i was recheck on commerce edition but still have no issue, maybe i'm missed something ?

What could be the cause for not showing in front-end but having it correctly translated in mage-translation-storage ? Maybe we can start from this point.

馃憤 translations are correct in the localstorage mage-translation-storage.
In javascript console `jQuery.mage.__('This is a required field.') give the right translation too (it is related i suppose).

But when i put a breakpoint in jquery/jquery-validate.js, messages are not yet translated , $.mage.__('This is a required field.') doesn't give the translation.

@engcom-backlog-nazar could you try with parameters Merge JavaScript Files, Enable JavaScript Bundling and Minify JavaScript Files to ON please ?

@kevinvuillemin yes with this option also i'm have translated string. any others things ?

Re-opening, because we are seeing this as wel on an upgrade of one of our shops to 2.3.0
It only seems to happen in production mode, not locally in developer mode.

I'll see if I can find exact steps to reproduce when I find a bit time later today/this week.

Ok, update, my previous test wasn't very well conducted, I can also reproduce the problem locally on the create an account page (was previously testing some other frontend component which actually did work).

So I've gone ahead and tested 3 different versions of Magento for the bug on vanilla installations: versions 2.2.7, 2.3.0 & 2.3-develop (commit 77297a11ead).
Results: 2.3.0 is broken, 2.2.7 & 2.3-develop work as expected.

Here are my steps to reproduce:

  • Install vanilla installation
  • Run composer require honl/magento2-nl-nl (version 1.1.14 is installed at the time of writing)
  • Run bin/magento setup:upgrade
  • In the backend, go to Stores > Configuration
  • Switch to scope 'Default Store View'
  • Go to General > General > Locale Options > Locale and change it to 'Dutch (Netherlands)'
  • Flush caches
  • Go to homepage on frontend
  • Click on the 'Account aanmaken' link in the header
  • Now just click the button 'Account aanmaken' without filling in the form

Expected error under each field (works on 2.2.7 & 2.3-develop): Dit is een verplicht veld.
Actual error under each field (2.3.0): This is a required field.

So it looks like this is fixed in 2.3-develop, and so hopefully the fix will be included in 2.3.1
I currently don't have the time to do some git bisecting to find the fix, if somebody else is willing to do this and post the commit(s) which fixes this, that would probably be appreciated by others.

We aren't going to put any shop live on 2.3.0 anyways, because the amount of bugs in this particular version is a little bit ridiculous and many will be fixed in 2.3.1 luckily, so I'm just going to hope a fix for this problem will be included as well in 2.3.1

@magento-engcom-team can you please confirm the fix will be included in 2.3.1 ?

@verdde: I just tested the steps to reproduce I mentioned in my previous post on a vanilla 2.3.1 installation, and it looks like the validation translations work now, yay!

So we can close this issue, thanks for reporting btw!

@magento-engcom-team The bug is present on 2.2.8 XD

@gabs77: I've just tested using my steps to reproduce mentioned above on both Magento 2.2.8 and 2.2.9 and I can't reproduce. So what you are running against must be another problem.
Can you open a new issue with exact steps to reproduce on a vanilla installation? That would be great. Thanks!

How is this fixed on magento 2.3.1? Can somebody post a link to the fix?

it's still on 2.3.5-p2. Random strings aren't translated. Magento is a piece of shit written by brainless fagots :/

Was this page helpful?
0 / 5 - 0 ratings