composer install
and install Magento using bin/magento setup:install
bin/magento deploy:mode:set developer
composer require honl/magento2-nl-nl
)bin/magento setup:upgrade
bin/magento deploy:mode:set production
(notice it only deployed the en_US locale, but this is understandable)bin/magento setup:static-content:deploy nl_NL
We can probably change the locale before switching to production mode, but this is kind of unexpected. When we deploy a new webshop, we immediately switch it to production mode on the server and then start configuring it in the backend, and now this is no longer possible for the Locale option. This feels like a bug to me?
This is probably behavior introduced by the new pipeline deployment feature of 2.2, but it's still very confusing.
In the devdocs this is mentioned:
You can change the Admin locale only to languages used by deployed themes
&
As discussed previously, any configuration setting in config.php or env.php is locked and cannot be edited in the Admin.
Those statements seem to contradict each other. When you export the configuration to config.php
you can no longer change the setting in the backend, yet, it is stated that you can still change the locale to the deployed locale's.
And in my example above, I hadn't even exported the configuration to config.php
and it still wasn't possible to change the locale in the backend, even though the locale's were deployed.
I don't know what the problem is here:
It's all really confusing, so there must be something wrong I suppose ...
This is still happening in 2.2.0-RC2.2 btw.
Hi @hostep you are correct - these changes are related to pipeline deployment. First thing I want to point out is that the following statement
You can change the Admin locale only to languages used by deployed themes
refers to the locale of the Admin interface, not the storefront locale. Admin interface locale can be changed from top-right corner in Admin > admin > Account Settings. You'll see that you can change between the deployed locales.
Regardless, disabling changing of the locale in Admin Panel in production mode was a change made on purpose. The recommendation is to configure your websites/stores/storeviews/locales ahead of time, along with theme settings, and then start the process of deployment. This way all needed assets will be deployed according to how you have configured the above. In your case, if you designated a website/storeview for the nl_NL locale before switching to production, those assets would've been deployed for you.
We specifically discourage resource-taxing operations such as static-content deploy and compilation once you're in production mode since they can significantly degrade the performance of the live site and/or cause downtime.
Despite the above, you have several options to make this specific change outside of the Admin panel. One is using environment variables, another one is using the config:set CLI command (path = general/locale/code).
I'm also working with @jcalcaben to make this more clear in the docs.
Thanks for the clarification!
We will have to review our entire workflow for setting up new projects, because of the new pipeline deployment of Magento 2.2, but that's ok.
Should I close the issue, or should we wait for the updated documentation?
There's a lot to the new pipeline deployment flow (as you can probably tell from the docs), some mental shifts too, but we're confident in the end it's all for the better. Let me know if you have other questions. If you don't mind I'll close the issue for now - and I'll ping you when doc updates are done.
PS of course a 3rd work-around for the above is switching back to dev mode, configuring locales, and then going into production again (might take more time).
Actually, if you open your browser inspector e remove the disabled
attribute from the Locale select you can change the locale and save :open_mouth:
@slackerzz I dont know what to thing about this. I mean it works like a charm. I didnt even think about it.
Magento in a nutshell...... .... .. . . . :tada: :rocket:
:hankey:
@misha-kotov and why are you taking that kind of decision instead of us? If we want to make locale change in a production website, that's our call, not yours. We are responsible of our own deployment pipeline and strategy, not you.
We specifically discourage resource-taxing operations such as static-content deploy and compilation once you're in production mode since they can significantly degrade the performance of the live site and/or cause downtime.
Here you are not _discouraging_. You are _preventing_. Juste discourage things in the documentation but don't remove features from our hands just because you have opinions. The website I build from Magento is my product, not yours.
@ericmorand: you can change it on production, just not using the admin interface. But you can do it using cli, for example bin/magento config:set --scope=store --scope-code={storeview-code} general/locale/code fr_FR
.
And I believe you can also add it in your app/etc/env.php
file when you save configuration in there (but I have no experience with that yet).
@slackerzz Do not do this, unless you control the install fully and can use CLI. We are on a managed magento install without SSH access and just by doing the locale change in production mode brakes the modified website (I could restore using a snapshot, but still). You also need to run setup:static-content:deploy
probably.
Most helpful comment
Actually, if you open your browser inspector e remove the
disabled
attribute from the Locale select you can change the locale and save :open_mouth: