Skip to content

Symfony2 Translation Bundle that supports OneSkyApp.

License

Notifications You must be signed in to change notification settings

partnermarketing/TranslationBundle

Repository files navigation

TranslationBundle

Build Status Scrutinizer Code Quality Code Coverage HHVM Status

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

How to contribute