Search code examples
symfonylocalesonata-admin

Symfony + sonata + translation : You have requested a non-existent parameter "locale"


New to symfony i installed Sonata composer require sonata-project/admin-bundle and translator service composer require symfony/translation

As desciribed on symfony manual (manual) I added

    # config/packages/framework.yaml

framework:
    translator: { fallbacks: ['%locale%'] }

but when I make a php bin/console cache:clear i get the error

*In ParameterBag.php line 100:

You have requested a non-existent parameter "locale".*

Thank you for your help,


Solution

  • to solve add in services.yaml:

    parameters:
        locale: 'en' (en -> english, it -> italian ecc..)
    

    and in framework.yaml

    framework:
        default_locale: '%locale%'
        translator:
            fallbacks:
                - '%locale%'