PHPackages                             tmi/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. tmi/translation-bundle

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

tmi/translation-bundle
======================

A Symfony bundle that manages translations with Doctrine.

v2.2.0(1mo ago)049MITPHPPHP &gt;=8.4CI passing

Since Sep 9Pushed 1mo agoCompare

[ Source](https://github.com/CreativeNative/translation-bundle)[ Packagist](https://packagist.org/packages/tmi/translation-bundle)[ Docs](https://github.com/CreativeNative/translation-bundle)[ RSS](/packages/tmi-translation-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (43)Versions (28)Used By (0)

TMI Translation Bundle - Doctrine Entity Translations for Symfony
=================================================================

[](#tmi-translation-bundle---doctrine-entity-translations-for-symfony)

[![CI](https://github.com/CreativeNative/translation-bundle/actions/workflows/php.yml/badge.svg)](https://github.com/CreativeNative/translation-bundle/actions/workflows/php.yml)[![codecov](https://camo.githubusercontent.com/5086db7bf0a85c0af7aa7409dd0976443158184f5554861f7c753db73db44d62/68747470733a2f2f636f6465636f762e696f2f6769746875622f43726561746976654e61746976652f7472616e736c6174696f6e2d62756e646c652f67726170682f62616467652e7376673f746f6b656e3d443250584a4c35543259)](https://codecov.io/github/CreativeNative/translation-bundle)[![PHPStan](https://camo.githubusercontent.com/b6d441ad4fe8332cb16c72aa27f22cc685181dfd74ae34964afc92c6c1146b3c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c2532306d61782d627269676874677265656e2e737667)](https://phpstan.org/)[![Type Coverage](https://camo.githubusercontent.com/e8a7ff13d6eb74d1fc66fb4d3dfd12c0d2aeef9f739c8516a3ededb8e575c1e3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74797065253230636f7665726167652d3130302532352d627269676874677265656e2e737667)](https://phpstan.org/)[![Latest Version](https://camo.githubusercontent.com/c8f23889eb28348a65d9cb88b3914d188a04100eafe039a69f2df1e7486bf894/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746d692f7472616e736c6174696f6e2d62756e646c652e737667)](https://packagist.org/packages/tmi/translation-bundle)[![License](https://camo.githubusercontent.com/fad00a03beab8dff7b579064a9d3340fff7354b3a777ef327dfa5e76b08f1cff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746d692f7472616e736c6174696f6e2d62756e646c652e737667)](https://packagist.org/packages/tmi/translation-bundle)[![PHP 8.4+](https://camo.githubusercontent.com/3a1b280ab7672f9ae08c93a083aa42ce8d0c82ff079314d77f5fea924e84927c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342532422d3838393242462e737667)](https://php.net/)[![Symfony 7.3+](https://camo.githubusercontent.com/c9ddfb3f017dd62a7268da5062d39eb9ec96ce46ace4693aadd8a7e432ef6a55/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d372e332532422d3030303030302e737667)](https://symfony.com/)[![Doctrine ORM 3.5+](https://camo.githubusercontent.com/43135007e5f22f0cee1692867eb6f4a911f224be32af7582167c1923cf3766bb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f637472696e652d4f524d253230332e352532422d4646364430302e737667)](https://www.doctrine-project.org/)[![Total Downloads](https://camo.githubusercontent.com/9761598e3358fac533eace18291dedd8a26439aa1bde80439561238fc88d451c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746d692f7472616e736c6174696f6e2d62756e646c652e737667)](https://packagist.org/packages/tmi/translation-bundle)[![GitHub Stars](https://camo.githubusercontent.com/40e1967717745113da56f1e0ab542396f5ef1c5aee93bf04b0006f7ba691fe51/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f43726561746976654e61746976652f7472616e736c6174696f6e2d62756e646c652e7376673f7374796c653d736f6369616c)](https://github.com/CreativeNative/translation-bundle)[![Maintained](https://camo.githubusercontent.com/36f1e45079c8a4187cee4a840f9bd220810bef279ce99b87bdb14ff4d4a68569/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61696e7461696e65642d7965732d627269676874677265656e2e737667)](https://github.com/CreativeNative/translation-bundle)

A modern, high-performance translation bundle for Symfony that stores entity translations **in the same table** as the source entity - no expensive joins, no complex relations.

🚀 Why This Bundle?
------------------

[](#-why-this-bundle)

This bundle solves: **Symfony Doctrine translation**, **entity localization**, **multilingual entities**, **Doctrine translatable**, **Symfony translation bundle**, **database translations**, **entity translations**

### ❌ Traditional Translation Problems:

[](#-traditional-translation-problems)

- **Multiple tables** with complex joins
- **Performance overhead** on translated entities
- **Complex queries** for simple translations
- **Schema changes** required for each new translation

### ✅ Our Solution:

[](#-our-solution)

- **Single table** for all translations
- **No performance penalty** - same query speed as non-translated entities
- **Simple implementation** - just add interface and trait
- **Zero schema changes** when adding new languages

🎯 Key Features
--------------

[](#-key-features)

- **🏷️ Same-table storage** - Translations stored with source entity (no joins needed)
- **⚡ Blazing fast** - No performance overhead on translated entities
- **🔄 Auto-population** - Automatic relation translation handling
- **🎯 Inherited entity support** - Works with complex entity hierarchies
- **🛡️ Type-safe** - Full PHP 8.4 type declarations throughout
- **🧪 100% tested** - Comprehensive test suite with full coverage
- **🤖 AI-ready** - Includes [AI skills](#-ai-assisted-development) for Claude Code and other assistants

🏗️ About This Version
---------------------

[](#️-about-this-version)

This is a **complete refactoring** based on PHP 8.4, Symfony 7.3, and Doctrine ORM 3.5 of the fork from [umanit/translation-bundle](https://github.com/umanit/translation-bundle), implemented with modern development practices and featuring **100% code coverage** with comprehensive test suites.

⚠️ Limitations
--------------

[](#️-limitations)

- **ManyToMany associations** are currently not supported. This includes usage with the `SharedAmongstTranslations` attribute.
- Entities with single-column `unique: true` constraints will trigger a validation error at `cache:warmup` -- use composite constraints (field + locale) instead. See [UPGRADING.md](UPGRADING.md#5-composite-unique-constraint-validation) for the pattern.
- Requires **PHP 8.4+**, **Symfony 7.3+** and **Doctrine ORM 3.5+** (see legacy versions for older support)

📦 Installation
--------------

[](#-installation)

```
composer require tmi/translation-bundle

```

Register the bundle to your `config/bundles.php`.

```
return [
// ...
Tmi\TranslationBundle\TmiTranslationBundle::class => ['all' => true],
];
```

⚙️ Configuration
----------------

[](#️-configuration)

Configure your available locales in framework.yaml and, optionally, additional bundle settings:

```
# config/packages/framework.yaml
framework:
    enabled_locales: ['en_US', 'de_DE', 'it_IT']

# config/packages/tmi_translation.yaml
tmi_translation:
    # default_locale: 'en_US'             # Optional: uses framework.default_locale if not set
    # disabled_firewalls: ['main']        # Optional: disable filter for specific firewalls
    # enable_logging: false               # Optional: enable PSR-3 debug logging
    # copy_source: false                  # Optional: clone source content (true = v1.x behavior)
    # strict_orphan_check: ~              # Optional: throw on orphaned translations. null = auto (on when kernel.debug)
    # unique_locale_variants: false       # Optional: make the (tuuid, locale) index a UNIQUE constraint
```

### Doctrine DBAL Custom Type - TuuidType

[](#doctrine-dbal-custom-type---tuuidtype)

To use the `TuuidType` in your Symfony project, you must register it in your Doctrine configuration:

```
# config/packages/doctrine.yaml
doctrine:
    dbal:
        types:
            tuuid: Tmi\TranslationBundle\Doctrine\Type\TuuidType
```

This ensures that Doctrine recognizes the tuuid type and avoids errors like:

```
Unknown column type "tuuid" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType().
```

🚀 Quick Start
-------------

[](#-quick-start)

### Make your entity translatable

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

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

```
