Provide a TranslationWrapper which can create missing translations for you
Enable/disbale creation over config.
Normalize translationkeys
Decorate Missing Keys
Use your own customized Creator
Currently only YML Translation-Creator shipped in the Bundle
-
Add IbrowsTranslationHelperBundle in your composer.json:
{ "require": { "ibrows/translation-helper-bundle": "~1.0", } }
-
Now tell composer to download the bundle by running the command:
$ php composer.phar update ibrows/translation-helper-bundle
Composer will install the bundle to your project's
ibrows/translation-helper-bundle
directory. ( PSR-4 ) -
Add the bundle to your
AppKernel
class// app/AppKernerl.php public function registerBundles() { $bundles = array( // ... new \Ibrows\TranslationHelperBundle\IbrowsTranslationHelperBundle(), // ... ); // ... }
-
Sample Configuration
ibrows_translation_helper: translator: normalize: true create: true creator: ibrows_translation_helper.defaultcreator decorate: !!!%s ignoreDomains: [] deleteCache: false creator: format: yml path: %kernel.root_dir%/../src/Ibrows/SampleBundle/Resources/translations decorate: ___%s backup: false ucFirst: false
Use this in your form_div_default_layout.html.twig
{% extends 'form_div_layout.html.twig' %}
{% use '@IbrowsTranslationHelper/form_div_layout_trans_fix.html.twig' %}
And use this for SonataAdmin
sonata_doctrine_orm_admin:
entity_manager: ~
templates:
form:
- 'IbrowsTranslationHelperBundle::form_admin_fields.html.twig'
sonata_admin:
templates:
filter: IbrowsTranslationHelperBundle::form_admin_fields.html.twig