Search code examples
localizationconsoleakeneo

In Akeneo 2.1, how can I get a list of active locales?


I am creating a console Command in Akeneo 2.1, but I'm trying to get a list of active locales. How can I get this?


Solution

  • The LocaleRepository provide a getActivatedLocales method which exactly do that. You can find it here

    The locale repository code is pim_catalog.repository.locale and you can get the service in your command by calling $this->getContainer()->get('pim_enrich.repository.locale'); (if your command is container aware of course).

    Here is an example of a container aware command: Query help command