3

I know that with bin/magento setup:static-content:deploy en_US en_GB I can generate the static content for the above two locales.

How can I look up which locales are actively being used by a store (Imagine someone gave you ssh logins to a store you don't know which locales are used)?

So effectively I am looking for command XXX which should produce en_US en_GB (ideally something that is supported on 2.1)

3 Answers 3

2

Provided the locales have been previously deployed this works:
ls pub/static/adminhtml/Magento/backend/
but is not guaranteed to be there/complete and does not account for the frontend potentially having themes and different locales for each.

EDIT: slightly better option:

user@host:/var/www$ find pub/static -maxdepth 4 -mindepth 4 -type d
pub/static/frontend/Magento/luma/ca_ES
pub/static/frontend/Magento/luma/en_US
pub/static/frontend/Magento/blank/ca_ES
pub/static/adminhtml/Magento/backend/de_DE
pub/static/adminhtml/Magento/backend/ca_ES
pub/static/adminhtml/Magento/backend/en_US
2

from your root folder, run this command:

php ./bin/magento config:show general/locale/code

that should show you what locale has been configured across your websites/ store view

3
  • Thanks for the suggestion. I think it's a good option for M2.2+ but is not included in M2.1. Since the command only outputs the default scope I would now need a command to list all the scope codes. Commented Feb 16, 2018 at 3:32
  • One unusual case I think it would miss is, if admin users have selected a locale for their account which is not used in the frontend. Commented Feb 16, 2018 at 3:33
  • 1
    Oh right, I wasn't aware the command is not available on 2.1. But hopefully this helps a bit if you ever run into this on post 2.2
    – user63793
    Commented Feb 16, 2018 at 4:14
0

You can do this reliably in Magento 2.1 onwards with GetPageSpeed n98-magerun2 commands, e.g.:

n98-magerun2 deploy:locale:active
#> en_US en_GB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.