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

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

a2lix/translation-form-bundle
=============================

Translate your doctrine objects easily with some helpers

4.0.3(2mo ago)3376.9M↓14.1%13920MITPHPPHP ^8.4CI passing

Since Jul 30Pushed 2mo ago11 watchersCompare

[ Source](https://github.com/a2lix/TranslationFormBundle)[ Packagist](https://packagist.org/packages/a2lix/translation-form-bundle)[ Docs](https://github.com/a2lix/TranslationFormBundle)[ RSS](/packages/a2lix-translation-form-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (54)Versions (52)Used By (20)

A2lix TranslationForm Bundle
============================

[](#a2lix-translationform-bundle)

[![Latest Stable Version](https://camo.githubusercontent.com/efa962a588295f3482463deb7b5788a2d1dbe90120fec07af96ff0b223bac6c5/68747470733a2f2f706f7365722e707567782e6f72672f61326c69782f7472616e736c6174696f6e2d666f726d2d62756e646c652f762f737461626c65)](https://packagist.org/packages/a2lix/translation-form-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/fd2bbb3d8447895d755ecf65e10a02359c651ce8bc7c3f4bbc202478338130e5/68747470733a2f2f706f7365722e707567782e6f72672f61326c69782f7472616e736c6174696f6e2d666f726d2d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/a2lix/translation-form-bundle)[![Total Downloads](https://camo.githubusercontent.com/c1898705f30030caa7fd280d9377041366018ae2ff69a0ed08b63e7b2798ae2d/68747470733a2f2f706f7365722e707567782e6f72672f61326c69782f7472616e736c6174696f6e2d666f726d2d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/a2lix/translation-form-bundle)[![License](https://camo.githubusercontent.com/293705d6a1a7dc82ef90ab4e2bb6ab191d3598ef5916208670e0c570e444447e/68747470733a2f2f706f7365722e707567782e6f72672f61326c69782f7472616e736c6174696f6e2d666f726d2d62756e646c652f6c6963656e7365)](https://packagist.org/packages/a2lix/translation-form-bundle)[![Build Status](https://github.com/a2lix/TranslationFormBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/a2lix/TranslationFormBundle/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/952be5069d6d5c360a9257d5cc86fb2e702cc6c3469a1d4e7979259b311269a9/68747470733a2f2f636f6465636f762e696f2f67682f61326c69782f5472616e736c6174696f6e466f726d42756e646c652f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d6841506f3169534c6162)](https://codecov.io/gh/a2lix/TranslationFormBundle)

A small, flexible Symfony bundle that helps you build forms to manage translations for Doctrine entities. It integrates with common translation strategies (Gedmo Personal Translation and Knp DoctrineBehaviors) and provides form types, helpers and Twig components to make working with multilingual data easier.

Key features

- Easy form handling for translatable entities (Knp &amp; Gedmo strategies).
- Support for one-record-per-locale patterns via `TranslationsFormsType`.
- `TranslatedEntityType` for entity choice labels using translations.
- Centralized locale configuration via `LocaleProvider`.
- Twig helpers and a `LocaleSwitcher` component.

Note

Use [A2lixAutoFormBundle](https://github.com/a2lix/AutoFormBundle) for automatic form generation and customization.

Tip

A complete demonstration is also available at [a2lix/demo](https://github.com/a2lix/Demo).

Screenshot example
------------------

[](#screenshot-example)

[![A2LiX Translation Form Screenshot](/a2lix_translationForm.jpg)](/a2lix_translationForm.jpg)

Installation
------------

[](#installation)

- Install the bundle with Composer:

```
composer require a2lix/translation-form-bundle
```

Basic configuration
-------------------

[](#basic-configuration)

Add a minimal configuration in `config/packages/a2lix.yaml`:

```
a2lix_translation_form:
    enabled_locales: [en, fr, de]   # Optional. Default from framework.enabled_locales
    default_locale: en   # Optional. Default from framework.default_locale
    required_locales: [en]   # Optional. Default []
    # templating: "@A2lixTranslationForm/bootstrap_5_layout.html.twig"
```

If you keep the default setup, the bundle will automatically prepend the chosen form theme (Bootstrap 5 layout by default) into Twig's `form_themes`.

Compatibility: Gedmo &amp; Knp

- [Gedmo PersonalTranslation](https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/doc/translatable.md#personal-translations): Fully supported. When using Gedmo's personal translation mapping, the bundle renders translation fields as separate translation objects and manages creation and removal of `Gedmo` translation entities.
- [KnpDoctrineBehaviors](https://github.com/KnpLabs/DoctrineBehaviors/blob/master/docs/translatable.md): Fully supported. For Knp-style translations (one translation object per locale), fields are bound directly to locale forms.

Usage examples
--------------

[](#usage-examples)

#### TranslationsType (Knp or Gedmo)

[](#translationstype-knp-or-gedmo)

```
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
use Symfony\Component\Form\Extension\Core\Type\FormType;

$builder->add('translations', TranslationsType::class, [
    'translatable_class' => App\Entity\Post::class,
    // Optional:
    // 'locale_labels' => ['en' => 'English', 'fr' => 'Français'],
    // 'theming_granularity' => 'field', // or 'locale_field'
]);
```

#### TranslationsFormsType (one-record-per-locale)

[](#translationsformstype-one-record-per-locale)

```
use A2lix\TranslationFormBundle\Form\Type\TranslationsFormsType;

$builder->add('medias', TranslationsFormsType::class, [
    'form_type' => App\Form\CompanyMediaType::class,
    'form_options' => [
        'data_class' => App\Entity\CompanyMediaLocale::class,
    ],
]);
```

#### TranslatedEntityType (entity choices with translation labels)

[](#translatedentitytype-entity-choices-with-translation-labels)

```
use A2lix\TranslationFormBundle\Form\Type\TranslatedEntityType;

$builder->add('category', TranslatedEntityType::class, [
    'class' => App\Entity\Category::class,
    'translation_property' => 'title',
]);
```

#### Locale selection widget

[](#locale-selection-widget)

```
use A2lix\TranslationFormBundle\Form\Type\TranslationsLocalesSelectorType;

$builder->add('locales', TranslationsLocalesSelectorType::class, [
    // uses the bundle's LocaleProvider to populate choices
]);
```

Twig helpers &amp; components
-----------------------------

[](#twig-helpers--components)

Locale rendering function:

```
{{ locale_render('en') }}                     {# -> 'English' (localized) #}
{{ locale_render('en', 'locale_upper') }}     {# -> 'EN' #}
{{ locale_render('fr', 'locale_name_title') }}{# -> 'Français' #}
```

LocaleSwitcher component:

```
{# Render basic badges #}

{# Render dropdown #}

```

LocaleProvider
--------------

[](#localeprovider)

The bundle centralizes locale configuration through a `LocaleProviderInterface`. By default, `SimpleLocaleProvider` is registered and configured from bundle settings. You can replace it with your own service by changing `locale_provider` in the bundle configuration.

Integration with AutoFormBundle
-------------------------------

[](#integration-with-autoformbundle)

This bundle integrates cleanly with `a2lix/auto-form-bundle`. When using `AutoType` with translatable entities, `TranslationsType` and `TranslationsFormsType` can be automatically configured and rendered based on entity metadata and bundle options.

License
-------

[](#license)

This package is available under the MIT license — see the LICENSE file.

###  Health Score

76

—

ExcellentBetter than 100% of packages

Maintenance84

Actively maintained with recent releases

Popularity66

Solid adoption and visibility

Community44

Growing community involvement

Maturity94

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 61.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~99 days

Recently: every ~151 days

Total

51

Last Release

81d ago

Major Versions

1.x-dev → 2.2.02018-02-26

2.4.1 → 3.0.0-beta.12018-04-03

2.4.2 → 3.0.22018-10-04

2.x-dev → 3.0.32019-06-20

3.x-dev → 4.0.02025-12-10

PHP version history (5 changes)2.3.0PHP ^5.4 || ^7.0

3.0.0-beta.1PHP ^7.1.3

3.0.7PHP &gt;=7.2

3.2.2PHP ^8.1

4.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ea80b64b7094cfdba2423bc828bb3bdef0a8e4a569d2c600723885ce5fc9b4b?d=identicon)[a2lix](/maintainers/a2lix)

---

Top Contributors

[![webda2l](https://avatars.githubusercontent.com/u/517753?v=4)](https://github.com/webda2l "webda2l (135 commits)")[![jordisala1991](https://avatars.githubusercontent.com/u/1137485?v=4)](https://github.com/jordisala1991 "jordisala1991 (33 commits)")[![tchapi](https://avatars.githubusercontent.com/u/1944007?v=4)](https://github.com/tchapi "tchapi (7 commits)")[![tristanbes](https://avatars.githubusercontent.com/u/346010?v=4)](https://github.com/tristanbes "tristanbes (5 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (4 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (3 commits)")[![rvanlaak](https://avatars.githubusercontent.com/u/2707563?v=4)](https://github.com/rvanlaak "rvanlaak (3 commits)")[![craue](https://avatars.githubusercontent.com/u/800119?v=4)](https://github.com/craue "craue (3 commits)")[![mablae](https://avatars.githubusercontent.com/u/389360?v=4)](https://github.com/mablae "mablae (2 commits)")[![scheb](https://avatars.githubusercontent.com/u/1259952?v=4)](https://github.com/scheb "scheb (2 commits)")[![lemoinem](https://avatars.githubusercontent.com/u/234992?v=4)](https://github.com/lemoinem "lemoinem (2 commits)")[![garak](https://avatars.githubusercontent.com/u/179866?v=4)](https://github.com/garak "garak (2 commits)")[![grizzlylab](https://avatars.githubusercontent.com/u/2612537?v=4)](https://github.com/grizzlylab "grizzlylab (2 commits)")[![rodrigobb](https://avatars.githubusercontent.com/u/1637465?v=4)](https://github.com/rodrigobb "rodrigobb (1 commits)")[![sophie-mulard](https://avatars.githubusercontent.com/u/22291441?v=4)](https://github.com/sophie-mulard "sophie-mulard (1 commits)")[![tobias-93](https://avatars.githubusercontent.com/u/3901745?v=4)](https://github.com/tobias-93 "tobias-93 (1 commits)")[![Videl](https://avatars.githubusercontent.com/u/123554?v=4)](https://github.com/Videl "Videl (1 commits)")[![welcoMattic](https://avatars.githubusercontent.com/u/773875?v=4)](https://github.com/welcoMattic "welcoMattic (1 commits)")[![cedriclombardot](https://avatars.githubusercontent.com/u/651484?v=4)](https://github.com/cedriclombardot "cedriclombardot (1 commits)")[![Holicz](https://avatars.githubusercontent.com/u/7330572?v=4)](https://github.com/Holicz "Holicz (1 commits)")

---

Tags

bundledoctrinephpsymfonysymfony-bundlesymfony-formtranslationsymfonyknplabsinternationalizationi18ntranslationgedmotranslatabledoctrine2formprezent

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/a2lix-translation-form-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/a2lix-translation-form-bundle/health.svg)](https://phpackages.com/packages/a2lix-translation-form-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
