symfony/symfony-docs — Issue #812: Translator configuration
Author: awildeep
Created: 2011-10-29 18:20:43+00:00
State: open

Hey all,

I was just trying to play around with the translator (at this point just trying to get FOSUserBundle translating properly).

FOSUserBundle is installed, and working when translations are not enabled. However when I add:

#app/config/config.yml
framework:
translator: ~

I get this error:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
The child node "secret" at path "framework" must be configured.

Okay, this seems logical enough so I add a reference to my secret value in my ini:

#app/config/config.yml
framework:
translator: ~
secret: %secret%

Now I end up with another error:

[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "templating.engines".

Checking the docs on the translator at http://symfony.com/doc/current/book/translation.html I see no references to needed a framework.secret value, or anything about configuring the templating.engines values.

I ended up using:

framework:
translator: { fallback: en }
secret: %secret%
templating: { engines: ['twig'] }

This final configuration value was not easy to come up with without some searching on my part. Namely the value for twig (which I ended up finding via http://symfony.com/doc/2.0/book/templating.html).

I think it should also be noted that the documentation at http://symfony.com/doc/2.0/book/templating.html does not tell users that they will also need to configure their secret value.

## Recommendations:

* I think Symfony2 should ship with the default values already in the app/config/config.yml for framework.secret, and framework.templating.engines. (But this is something best discussed in a symfony/symfony issue not here).
* The documentation for http://symfony.com/doc/current/book/translation.html should also mention needing framework.secret, and framework.templating.engines defined.
* The documentation for http://symfony.com/doc/2.0/book/templating.html should also mention needing framework.secret defined.