partnermarketing / translation-bundle
A translation component supporting different translation adapters -- by default, OneSky.
Installs: 2 635
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 19
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
- onesky/api-library-php5: ~1.0
- symfony/filesystem: ^2.7
Requires (Dev)
- johnkary/phpunit-speedtrap: dev-master
- phpunit/phpunit: >=3.7
- symfony/symfony: 2.*
README
TranslationBundle is a translation component supporting supporting different translation adapters -- by default, OneSky.
The existing adapters are:
- OneSky
Workflow
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
...
How to configure
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
How to use
See documentation in Symfony 2.
$translator = $this->get('translator'); $translator->trans('your_key');
How to push translations
app/console partnermarketing:translations:push_base_translations
How to pull 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
How to run tests
Since phpunit
is a dependency you can run tests using:
vendor/bin/phpunit