Unfortunatelly in my case I cannot uncheck Locale setting, it is disabled. Could you please give me some help how to associate english language to English store. Thx
-
What is your users role? if you are not login with admin then check roles and permission– Birjitsinh ZalaJan 4, 2018 at 4:58
5 Answers
This can happen when your site is production mode because if the locale is changed and there has been no static content generated for that locale there will be no assets available. The frontend would request assets from a location that would not exist and all styles and scripts would 404, which obviously isn't ideal.
You can see the disabling happening here: https://github.com/magento/magento2/blob/2.2.6/app/code/Magento/Backend/etc/adminhtml/di.xml#L149-L155. The class ConcealInProductionWithoutScdOnDemand
is disabling the field if "Static Content On Demand" is not enabled (I'm not exactly sure where this feature is enabled if I'm honest) preventing you from potentially breaking the site.
If you are sure you have static content succesfully generated for the locale you're changing to either change this via one of these methods:
- Change the value using the CLI with
bin/magento config:set
- Change the value directly in the DB
- Force the value using devtools in the browser
For me, I'll need to introduce the change at the start of my deploy process. It's up to you to establish when to change the value based on your process.
-
1To add to the conversation: to deploy static content for a specific language, do the following
bin/magento setup:static-content:deploy [language code: xx_XX]
e.g.bin/magento setup:static-content:deploy nl_NL en_US
will deploy for Dutch and English (US) languages. It didn't fix the issue of the locale not being available though. I changed it using devtools and removeddisabled="disabled"
attribute from the input field. Then clicked save. Done! :) Nov 4, 2019 at 7:30
Change to developer mode using bellow command, change your settings, save, and back to production, and deploy again using your new locals.
change to developer
php bin/magento deploy:mode:set developer --skip-compilation
back to productin
php bin/magento deploy:mode:set production --skip-compilation
deploy (exemple)
php bin/magento setup:static-content:deploy en_GB
-
Warning: include(/home/ecommerce/magento/releases/20190308150254/vendor/composer/../../generated/code/Magento/Framework/App/ResourceConnection/Proxy.php): failed to open stream: No such file or directory in (...)/vendor/composer/ClassLoader.php on line 444 after executing:
php bin/magento deploy:mode:set production --skip-compilation
– dudzioMar 8, 2019 at 15:20
So far I didn't go deep and debug the cause. But as quick workaround you can use your browser's developer console and remove the "disabled" attribute from the checkbox "Use Website". This allows you to uncheck it, select a locale and save the configuration.
This does not solve the problem itself, but worked for me to set the locale.
-
1As you are unlikely to change locale setting on a production environment often I find this a good solution. Kudos– ZankarSep 14, 2020 at 9:42
-
As from the documentation the locale settings become locked once you dump (or manually add) the config to the app/etc/config.php
file, e.g.
'system' => [
'default' => [
'general' => [
'locale' => [
'code' => 'en_US'
]
],
]
]
To change the locale of a store you'd need something like the following where ke_swa
is the store
'system' => [
'default' => [ ... ],
'stores' => [
'ke_swa' => [
'general' => [
'locale' => [
'code' => 'sw_KE'
]
]
]
]
]
The question is similar to this one
There may be some JS error possibly. You need to delete you pub/static folder and regenerate the static files. As you see in screen-shot, I'm able to make change in locale of my English store
-
-
@vitoriodachef because it's not correct. Clearing the pub/static folder won't make any difference to the problem OP was having.– jsims281Jul 29, 2019 at 9:47