partnermarketing/translation-bundle

A translation component supporting different translation adapters -- by default, OneSky.

0.8.1 2015-11-26 11:20 UTC

This package is not auto-updated.

Last update: 2024-12-21 17:53:49 UTC


README

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