Documentation » Translation

5. Translate your custom actions in SonataAdmin »

« 3. Translate Doctrine ORM models

4. Translate PHPCR models

Doctrine PHPCR ODM handles translations natively so you don’t need to install anything else.

4.1. Implement the TranslatableInterface

Todo do so SonataTranslationBundle brings the Sonata\TranslationBundle\Model\Phpcr\TranslatableInterface you can implement.

4.2. Define translatable Fields

Please check the Doctrine PHPCR ODM documentation how you can define your fields you want to translate.

4.3. Advanced Configuration

If you already followed Installation, you just have to pay attention to PHPCR fallback configuration.

So if you configured SonataTranslation like this :

  • YAML
    # config/packages/sonata_translation.yaml
        locales: [fr, en, it, nl, es]

Then you should configure doctrine_phpcr.odm.locales for the same list.

  • YAML
    # config/packages/doctrine_phpcr.yaml
                fr: [en, it]
                en: []
                it: [fr, en]
                nl: [en]
                es: [en, fr, it]

Found a typo? Something is wrong in this documentation? Just fork and edit it!