rvalin / translation-bundle
a Symfony Bundle to update translation
1.0.8
2019-02-26 21:19 UTC
Requires
- php: >=5.3.9
README
RValinTranslationBundle provide an easy way to update translation in symfony (2 -> 4).
It allow user to update translation directly from the page.
Warning
This bundle update your translations files.
For this reason, I recommend to use it only in dev or to use lexikTranslationBundle.
Installation
- Use Composer to download the library
composer require rvalin/translation-bundle
- Then add the RValinTranslationBundle to your application kernel:
// app/AppKernel.php public function registerBundles() { return array( // ... new RValin\MigrationBundle\RValinTranslationBundle(), // ... ); }
- Then update your config (optional)
Default config:
r_valin_translation:
dumpers_config: []
updaters: ['file']
role: 'ROLE_UPDATE_TRANSLATION'
allowed_domains: []
allowed_bundles: []
This config will use the default config of Symfony to generate translations files.
If you want to customize the dumb set the config you want with dumpers_config.
Exemple for yml files.
r_valin_translation:
dumpers_config:
yml:
as_tree: true
LexikTranslationBundle
If you use lexikTranslationBundle you just need to add this service:
rvalin.translation.updater.lexik_translation:
class: RValin\TranslationBundle\Updater\LexikTranslationUpdater
arguments: ['@lexik_translation.translation_storage', '@lexik_translation.trans_unit.manager']
tags:
- { name: rvalin.translation.updater, alias: 'lexik_translation' }
And change your config to use this updater:
r_valin_translation:
updaters: ['lexik_translation']
You can use both file and lexik_translation updater if you want to.