1

Here is the case. My config.yml contains fallowing set:

...
framework:
    #esi:             ~
    translator:      { fallbacks: ["%locale%"] }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    ...

I am trying to access value of default_locale in my controller with:

...
$this->container->getParameter('framework.default_locale');
...

But it wont work... Any idea why it prompts me that this value is not defined?

Regards

DevWL
  • 17,345
  • 6
  • 90
  • 86

1 Answers1

0

Try $this->container->getParameter('locale');

locale must be defined in parameters.yml

  • but in your config is defined that default_locale = locale(default_locale: "%locale%") so if you want get default_locale it is the same as locale – user3234484 Jun 04 '15 at 15:19