TranslationBundle is a translation component supporting supporting different translation adapters -- by default, OneSky.
The existing adapters are:
- OneSky
When you're developing you should add all translation keys into a file under app/Resources/base-translations
.
When you pull translations those will be placed in Symfony 2 standard directory for translations app/Resources/translations
.
The directory structure should be similar to the one in base-translations
directory, but all files will have
an extension to the name.
e.g.
base-translations/hello_world.yml
After translation will become:
translations/hello_world.en_GB.yml
translations/hello_world.pt_PT.yml
...
in your parameters.yml
parameters:
locale: en_GB # Symfony2 locale configuration
partnermarketing_translation.base_language: %locale%
partnermarketing_translation.supported_languages: [%locale%, pt_PT]
partnermarketing_translation.one_sky.project_id: 123
partnermarketing_translation.one_sky.api_key: yourOneskyKey
partnermarketing_translation.one_sky.api_secret: youroneskysecret
See documentation in Symfony 2.
$translator = $this->get('translator');
$translator->trans('your_key');
app/console partnermarketing:translations:push_base_translations
This will pull all latest translations into app/Resources/translations
.
If base language translations were changed their values will be updated in app/Resources/base-translations
.
app/console partnermarketing:translations:pull_translations
Since phpunit
is a dependency you can run tests using:
vendor/bin/phpunit