This bundle integrates the prezent/doctrine-translatable extension in Symfony2.
This bundle requires Symfony 2.2+.
Tell Composer to install the bundle:
$ php composer.phar require prezent/doctrine-translatable-bundle
Enable this bundle in your kernel
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Prezent\Doctrine\TranslatableBundle\PrezentDoctrineTranslatableBundle(),
);
}
You can optionlly configure the fallback locale (default: en). The current locale is automatically set from the current Request. It defaults to the fallback_locale which you can configure in your config.yml.
prezent_doctrine_translatable:
fallback_locale: en
Please refer to the doctrine-translatable documentation on how to use the translatable extension.
You can use the a2lix/TranslationFormBundle to integrate the translatable extension into your own forms and into your Sonata Admin backend. For this to work, you must add the following method to your translatable entities:
public static function getTranslationEntityClass()
{
return 'Your\Translation\Class';
}
For more information, see the A2LiX TranslationForm documentation. Follow the examples for the KnpDoctrineExtensions and other indexBy strategies.