Skip to content
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

[2.2.0-RC2.2] Static content deploy with multiple locales: js-translation.json files are the same #10673

Closed
hostep opened this issue Aug 26, 2017 · 14 comments
Labels
Area: Frontend bug report Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@hostep
Copy link
Contributor

hostep commented Aug 26, 2017

Preconditions

  1. PHP 7.0.22

Steps to reproduce

  1. Install Magento 2.2.0-rc22 using composer
  2. Add 2 language packs using composer: composer require honl/magento2-nl-nl imaginaerum/magento2-language-fr-fr
  3. Create 2 different storeviews in the backend and set the Locale configuration to Dutch (Netherlands) and French (France) for those 2 storeviews
  4. Run php bin/magento setup:static-content:deploy -f -t Magento/luma nl_NL && php bin/magento setup:static-content:deploy -f -t Magento/luma fr_FR
  5. Run diff -rwq pub/static/frontend/Magento/luma/nl_NL/ pub/static/frontend/Magento/luma/fr_FR/
  6. Results: Files pub/static/frontend/Magento/luma/nl_NL/js-translation.json and pub/static/frontend/Magento/luma/fr_FR/js-translation.json differ => Good
  7. Remove all generated static files: rm -R pub/static/* var/view_preprocessed/*
  8. Run php bin/magento setup:static-content:deploy -f -t Magento/luma nl_NL fr_FR
  9. Run diff -rwq pub/static/frontend/Magento/luma/nl_NL/ pub/static/frontend/Magento/luma/fr_FR/
  10. Results: ... nothing, all files are equal => Not good

Expected result

  1. When generating static content using multiple locales in one go, the generated js-translation.json files should be different

Actual result

  1. When generating static content using multiple locales in one go, the generated js-translation.json files are the same
    This has as result that all javascript translations are in the wrong locale on the frontend.

Discussion

This is the same issue like I reported on #7862 for Magento 2.1.3, but this was supposed to be fixed by MAGETWO-62660, which is included in Magento 2.2.0-RC2.2, but looks like that didn't really help, or something else might broke it yet again ...

@misha-kotov misha-kotov changed the title [2.2.0-RC2.2] Static content deploy with multiple locales doesn't do what it is supposed to do [2.2.0-RC2.2] Static content deploy with multiple locales: js-translation.json files are the same Sep 5, 2017
@misha-kotov
Copy link

Thanks for reporting - internal issue is MAGETWO-72301

@misha-kotov misha-kotov added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Sep 5, 2017
@magento-engcom-team magento-engcom-team added 2.2.0-rc2 Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Area: Frontend Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed and removed G1 Passed labels Sep 5, 2017
@magento magento deleted a comment from dmitrii-fediuk Sep 19, 2017
@magento-engcom-team
Copy link
Contributor

@hostep, thank you for your report.
We've created internal ticket(s) MAGETWO-72301 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Sep 25, 2017
@okorshenko
Copy link
Contributor

Will be fixed in 2.2.1

@tadhgbowe
Copy link

Hello.
This is also an issue in 2.1.x. We have a 2.1.7. install and it's messing up big time. We have 6 locales in play. Not pretty.
So our deployment process to staging/live calls "bin/magento deploy:mode:set production".
At some point it calls a function deployStaticContent(...) in module-deploy/Model/Filesystem.php
You'll notice in here the line of code:
$cmd = $this->functionCallPath . 'setup:static-content:deploy '
. implode(' ', $this->getUsedLocales());

So you can see it's appending all the locales to the end of the :deploy. What we've had to do as a workaround is override this class and introduce a foreach performing a setup:static-content:deploy on every locale in the $this->getUsedLocales() array.
It's not pretty but it works. I haven't tested this on 2.2.x sorry.
Hope this helps.
Have a nice day.
Tadhg

@hostep
Copy link
Contributor Author

hostep commented Sep 30, 2017

@tadhgbowe: you can find a better workaround in: #7862, that's the issue for tracking this problem in 2.1.x

@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-82752

@heldchen
Copy link
Contributor

heldchen commented Nov 9, 2017

Will be fixed in 2.2.1

nope - this is not fixed in 2.2.1

magento-team pushed a commit that referenced this issue Nov 13, 2017
@alexdpunkt
Copy link

alexdpunkt commented Dec 5, 2017

Still an issue in 2.2.1

I've been searching for several hours now (well, it's magento, what else would you expect) and finally came up with a solution.

deployment before:
php bin/magento setup:static-content:deploy de_DE en_US cs_CZ

This resulted in 3 equal js-translation.json files, where en_US and cs_CZ also contained the labels of the first translation de_DE

If you do separate deployment calls for each language it works as expected.

php bin/magento setup:static-content:deploy de_DE
php bin/magento setup:static-content:deploy en_US
php bin/magento setup:static-content:deploy cs_CZ

I also made a small shell script which simplifies this process, in case anyone is interested.

deploy.sh

#!/bin/bash

rm -rf pub/static/frontend/
rm -rf pub/static/adminhtml/
rm -rf var/view_processed/

php bin/magento setup:static-content:deploy de_DE
php bin/magento setup:static-content:deploy en_US
php bin/magento setup:static-content:deploy cs_CZ
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

@Blueblazer172
Copy link

still not fixed in 2.2.2

@heldchen
Copy link
Contributor

@Blueblazer172 it does seem to be working with v2.2.2 for our setup using bin/magento setup:static-content:deploy --theme=MyTheme/default de_CH fr_CH

@hostep
Copy link
Contributor Author

hostep commented Dec 29, 2017

Can confirm this issue is fixed in version 2.2.2, closing.

Thanks @wert2all!

@hostep hostep closed this as completed Dec 29, 2017
@tuyennn
Copy link
Member

tuyennn commented Oct 18, 2018

#8508 #9073

@spiilmusic
Copy link

spiilmusic commented Apr 30, 2020

Any news here? Still reproduced in 2.3.x 😕 commit was merged only to 2.2 branch

davidalger added a commit to davidalger/capistrano-magento2 that referenced this issue May 29, 2020
…3 and through 2.2.2 or possible up to but not including 2.3.0

Indicator of being fixed in 2.2.2 and later: magento/magento2#10673 (comment)

Indicator of it being fixed in 2.3.0 and later: magento/magento2#10913

Related to magento/magento2#7862 which is now closed as resolved in 2.2.x somewhere
@chiralium
Copy link

Still reproduced in 2.4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend bug report Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests