What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi, does anyone know a good way to add a locale to Zed, but not to Yves? (Use Case is the Store shou
Hi, does anyone know a good way to add a locale to Zed, but not to Yves? (Use Case is the Store should only be available in German, but there are non german speaking people working in the project and in Zed - so meaning just the translations of Zed UI, no "real" store locale). It seems to be much more complicated then it should be
Comments
-
We have our translation for Zed here:
Zed/Translator/data//en_GB.csv and then execute these commands:
docker/sdk console translator:clean-cache
docker/sdk console translator:generate-cache0 -
thx, I'll try that. But it seems that the error is thrown as the locale is not defined in the store config
0 -
giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 π§π»βπ - Cadet
U can add dynmically the "en_US" or "en_GB" as locale for Zed in stores.php if APPLICATION env is ZED... then u have only in ZED also the en locale and not in Yves..
0 -
giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 π§π»βπ - Cadet
smth so... i just write here the code.. u have of course adapt it...
$isZed = defined('APPLICATION') ? (APPLICATION === 'ZED' ? true : false) : false; if ($isZed === true) { //the first locale is the default $stores['YOUR_STORE']['locales'] = array_merge([ 'en' => 'en_US', ], $stores['YOUR_STORE']['locales']); }
0 -
@UL65CH0MC thx, this seems to be the best approach so far. Only downside is probably having required fields for localizable fields in en_US, then. But maybe that would be ok since the long term goal is definitely to extend the system for the international market
0 -
Did any of you solve that?
Get rid of the necessary fields for English, if the shop is and will be only German (or what ever)?0 -
@U02JWPGK5CZ the clean solution would probably be to decouple the translation of zed from the actual store locales and would require some changes in the core modules. A workaround I currently want to investigate, is to add an additional config for allowed locales for Zed.
0 -
from my testing yesterday:
0 -
I tested just commenting out the following line: vendor/spryker/kernel/src/Spryker/Shared/Kernel/Store.php:333
Then it actually works as intended (but of course we are missing an important check now for the correct locales).
what is working:
β’ store config has only de_DE
β’ But now basically any locale can be set without an exception
β’ translations in Zed are in en_US (if en_US is configured for the user)
β’ localizable required fields in forms are generated from store config (so only for de_DE)
what is not working
β’ missing the check that only configured locales can be used
β¦ So we would need an additional config where locales can be configured, that should be available in zed
β¦ In \Spryker\Shared\Kernel\Store::setCurrentLocale the locale check must be extended by checking for application context = ZED and then merge the additional locales from the new configuration (to add en_US locale)
β’ Locale can be used, but not selected in the user configuration (since the dropdown is loaded from the store config locales)
β¦ So when the locales are loaded for the locale dropdown in user configuration, it has to be extended by the additional locales from the new config
Iβm still seeing a general problem with that approach since the setCurrentLocale is by design intended to only allow locales from the store config. So this could introduce problems in future updates of the store logic.0 -
just fyi if anyone has the same problem: This approach also has been disproved. Reasoning:
0 -
we approached this issue by trying to extend the
Spryker\Shared\Kernel\Store
, by adding a specific ZED specific locale(s).However, we found the major issue: Store.php is a Singleton, which uses Store::getInstance() static method for itβs instantiation.
If we would just create a
Pyz\Shared\Kernel\Store
, this would not change the underlying implementation, as all the places that call\Spryker\Shared\Kernel\Store::getInstance()
would still call the underlying Spryker implementation without any modifications to the ZED specific locale.
The sollution would be to override all the places where\Spryker\Shared\Kernel\Store::getInstance()
method is called to\Pyz\Shared\Kernel\Store::getInstance()
to avoid any potential issues.
If we search the whole Project forStore::getInstance()
, we get 146 results. This would mean the work would be quite time-intensive and error prone.0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random