PHPackages                             umanit/translation-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. umanit/translation-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

umanit/translation-bundle
=========================

Manages Doctrine translations

3.0.3(5mo ago)87.5k8[1 issues](https://github.com/umanit/translation-bundle/issues)[1 PRs](https://github.com/umanit/translation-bundle/pulls)MITPHPPHP &gt;=8.0CI failing

Since Jun 16Pushed 5mo ago14 watchersCompare

[ Source](https://github.com/umanit/translation-bundle)[ Packagist](https://packagist.org/packages/umanit/translation-bundle)[ Docs](https://github.com/umanit/translation-bundle)[ RSS](/packages/umanit-translation-bundle/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (8)Dependencies (11)Versions (26)Used By (0)

Translation Bundle
==================

[](#translation-bundle)

This bundle intends to ease Doctrine entity translations. Unlike most translations libraries, every translation is stored in the same table as the source entity.

Features
--------

[](#features)

- Add translations without changing existing entities
- Translation fields are stored in the same table (no expensive joins)
- Supports inherited entities
- Handle more than just text fields
- Integration with Sonata and EasyAdmin
- Auto-population of translated relations

Install
-------

[](#install)

```
composer require umanit/translation-bundle

```

Register the bundle to your `app/AppKernel.php` if it's not done automatically.

```
    new Umanit\TranslationBundle\UmanitTranslationBundle(),
```

Configure your available locales and, optionally, the default one:

```
umanit_translation:
  locales: [en, fr, ja]
  default_locale: en
```

That's it!

### Integration with Sonata Admin

[](#integration-with-sonata-admin)

You will need to add extra stylesheets and JavaScript to your admin interface:

```
sonata_admin:
  assets:
    extra_stylesheets:
      - 'bundles/umanittranslation/css/admin-sonata.css'
    extra_javascripts:
      - 'bundles/umanittranslation/js/admin-filters.js'
```

Usage
-----

[](#usage)

### Make your entity translatable

[](#make-your-entity-translatable)

Implement `Umanit\TranslationBundle\Doctrine\TranslatableInterface` and use the trait `Umanit\TranslationBundle\Doctrine\ModelTranslatableTrait`on an entity you want to make translatable.

```
