PHPackages                             toovalu-github/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. [Localization &amp; i18n](/categories/localization)
4. /
5. toovalu-github/translation-form-bundle

ActiveSymfony-bundle[Localization &amp; i18n](/categories/localization)

toovalu-github/translation-form-bundle
======================================

Translate your doctrine objects easily with some helpers

1.0.0(10mo ago)02.8k↓37.2%MITPHPPHP ^8.1

Since Jul 9Pushed 10mo agoCompare

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

READMEChangelog (1)Dependencies (22)Versions (3)Used By (0)

A2lix Translation Form Bundle
=============================

[](#a2lix-translation-form-bundle)

Translate your doctrine objects easily with some helps

[![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)[![License](https://camo.githubusercontent.com/293705d6a1a7dc82ef90ab4e2bb6ab191d3598ef5916208670e0c570e444447e/68747470733a2f2f706f7365722e707567782e6f72672f61326c69782f7472616e736c6174696f6e2d666f726d2d62756e646c652f6c6963656e7365)](https://packagist.org/packages/a2lix/translation-form-bundle)

[![Total Downloads](https://camo.githubusercontent.com/c1898705f30030caa7fd280d9377041366018ae2ff69a0ed08b63e7b2798ae2d/68747470733a2f2f706f7365722e707567782e6f72672f61326c69782f7472616e736c6174696f6e2d666f726d2d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/a2lix/translation-form-bundle)[![Monthly Downloads](https://camo.githubusercontent.com/efdd7cb791387e6c7b250e8d031a1f73718a353950d3bdd35827870aa78d172b/68747470733a2f2f706f7365722e707567782e6f72672f61326c69782f7472616e736c6174696f6e2d666f726d2d62756e646c652f642f6d6f6e74686c79)](https://packagist.org/packages/a2lix/translation-form-bundle)[![Daily Downloads](https://camo.githubusercontent.com/0da51bde6e42d15f6b9918869bac243294dda0939c54d7f1991edabb35a9c195/68747470733a2f2f706f7365722e707567782e6f72672f61326c69782f7472616e736c6174696f6e2d666f726d2d62756e646c652f642f6461696c79)](https://packagist.org/packages/a2lix/translation-form-bundle)

BranchTools3.x (master)[![Build Status](https://github.com/a2lix/TranslationFormBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/a2lix/TranslationFormBundle/actions/workflows/ci.yml) [![Coverage Status](https://camo.githubusercontent.com/bfb0530106c3a3a9167b2ae69212dbe3a7d4eee7431ee41a49b1c11b71faf0e3/68747470733a2f2f636f6465636f762e696f2f67682f61326c69782f5472616e736c6174696f6e466f726d42756e646c652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/a2lix/TranslationFormBundle/branch/master)Screenshot example
------------------

[](#screenshot-example)

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

Support
-------

[](#support)

- `3.x` depends on [AutoFormBundle](https://github.com/a2lix/AutoFormBundle) and has higher requirements (PHP8.1+, Symfony5.4+/6.3+/7.0+). It is compatible with [KnpLabs](https://github.com/KnpLabs/DoctrineBehaviors#translatable), [A2lix](https://github.com/a2lix/I18nDoctrineBundle) and [Prezent](https://github.com/Prezent/doctrine-translatable-bundle)

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

[](#installation)

Use composer:

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

After the successful installation, add/check the bundle registration:

```
// Symfony >= 4.0 in bundles.php
// ...
A2lix\AutoFormBundle\A2lixAutoFormBundle::class => ['all' => true],
A2lix\TranslationFormBundle\A2lixTranslationFormBundle::class => ['all' => true],
// ...

// Symfony >= 3.4 in AppKernel::registerBundles()
$bundles = array(
// ...
new A2lix\AutoFormBundle\A2lixAutoFormBundle(),
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
// ...
```

Configuration
-------------

[](#configuration)

There is no minimal configuration. Full list of optional parameters:

```
# Symfony >= 4.0. Create a dedicated a2lix.yaml in config/packages with:
# Symfony >= 3.4. Add in your app/config/config.yml:

a2lix_translation_form:
    locale_provider: default       # [1]
    locales: [en, fr, es, de]      # [1-a]
    default_locale: en             # [1-b]
    required_locales: [fr]         # [1-c]
    templating: "@A2lixTranslationForm/bootstrap_4_layout.html.twig"      # [2]
```

1. Custom locale provider service id. Default one relies on \[1-\*\] values:
    - \[1-a\] List of translations locales to display
    - \[1-b\] Default locale
    - \[1-c\] List of required translations locales
2. The default template is Twitter Bootstrap compatible. You can redefine your own here

Usage
-----

[](#usage)

### In a classic formType

[](#in-a-classic-formtype)

```
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
...
$builder->add('translations', TranslationsType::class);
```

### Advanced examples

[](#advanced-examples)

```
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
...
$builder->add('translations', TranslationsType::class, [
    'locales' => ['en', 'fr', 'es', 'de'],   // [1]
    'default_locale' => ['en'],              // [1]
    'required_locales' => ['fr'],            // [1]
    'fields' => [                               // [2]
        'description' => [                         // [3.a]
            'field_type' => 'textarea',                // [4]
            'label' => 'descript.',                    // [4]
            'locale_options' => [                  // [3.b]
                'es' => ['label' => 'descripción'],    // [4]
                'fr' => ['display' => false]           // [4]
            ]
        ]
    ],
    'excluded_fields' => ['details'],           // [2]
    'locale_labels' => [                        // [5]
        'fr' => 'Français',
        'en' => 'English',
    ],
]);
```

1. Optional. If set, override the default value from config.yml
2. Optional. If set, override the default value from config.yml
3. Optional. If set, override the auto configuration of fields
    - \[3.a\] Optional. - For a field, applied to all locales
    - \[3.b\] Optional. - For a specific locale of a field
4. Optional. Common options of symfony forms (max\_length, required, trim, read\_only, constraints, ...), which was added 'field\_type' and 'display'
5. Optional. Set the labels for the translation tabs. Default to the name of the locale. Translation keys can be used here.

Additional
----------

[](#additional)

### TranslationsFormsType

[](#translationsformstype)

A different approach for entities which don't share fields untranslated. No strategy used here, only a locale field in your entity.

```
use A2lix\TranslationFormBundle\Form\Type\TranslationsFormsType;
...
$builder->add('translations', TranslationsFormsType::class, [
    'locales' => ['en', 'fr', 'es', 'de'],   // [1]
    'default_locale' => ['en']               // [1]
    'required_locales' => ['fr'],            // [1]
    'form_type' => ProductMediaType::class,     // [2 - Mandatory]
    'form_options' => [                         // [2bis]
         'context' => 'pdf'
    ]
]);
```

1. Optional. If set, override the default value from config.yml
2. Mandatory. A real form type that you have to do
    - \[2bis\] Optional. - An array of options that you can set to your form

### TranslatedEntityType

[](#translatedentitytype)

Modified version of the native 'entity' symfony form type to translate the label in the current locale by reading translations

```
use A2lix\TranslationFormBundle\Form\Type\TranslatedEntityType;
...
$builder->add('medias', TranslatedEntityType::class, [
    'class' => 'A2lix\DemoTranslationBundle\Entity\Media',   // [1 - Mandatory]
    'translation_property' => 'title',                           // [2 - Mandatory]
    'multiple' => true,                                             // [3]
]);
```

1. Path of the translatable class
2. Property/Method of the translatable class that will be display
3. Common options of the 'entity' Symfony form type (multiple, ...)

### Example

[](#example)

See [Demo Bundle](https://github.com/a2lix/Demo) for more examples.

Contribution help
-----------------

[](#contribution-help)

```
docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) composer install --ignore-platform-reqs
docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) composer run-script phpunit
docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) composer run-script cs-fixer

```

License
-------

[](#license)

This package is available under the [MIT license](LICENSE).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance54

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.2% 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

Unknown

Total

1

Last Release

313d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb73214532700b66c3b4f924cd74219702b060183e671059490fa4eaf3136857?d=identicon)[aurelien-toovalu](/maintainers/aurelien-toovalu)

---

Top Contributors

[![webda2l](https://avatars.githubusercontent.com/u/517753?v=4)](https://github.com/webda2l "webda2l (130 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)")[![craue](https://avatars.githubusercontent.com/u/800119?v=4)](https://github.com/craue "craue (3 commits)")[![rvanlaak](https://avatars.githubusercontent.com/u/2707563?v=4)](https://github.com/rvanlaak "rvanlaak (3 commits)")[![scheb](https://avatars.githubusercontent.com/u/1259952?v=4)](https://github.com/scheb "scheb (2 commits)")[![garak](https://avatars.githubusercontent.com/u/179866?v=4)](https://github.com/garak "garak (2 commits)")[![masseuro](https://avatars.githubusercontent.com/u/131135?v=4)](https://github.com/masseuro "masseuro (2 commits)")[![grizzlylab](https://avatars.githubusercontent.com/u/2612537?v=4)](https://github.com/grizzlylab "grizzlylab (2 commits)")[![mablae](https://avatars.githubusercontent.com/u/389360?v=4)](https://github.com/mablae "mablae (2 commits)")[![lemoinem](https://avatars.githubusercontent.com/u/234992?v=4)](https://github.com/lemoinem "lemoinem (2 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)")[![karrakoliko](https://avatars.githubusercontent.com/u/60247155?v=4)](https://github.com/karrakoliko "karrakoliko (1 commits)")

---

Tags

symfonyknplabsinternationalizationi18ntranslationtranslatabledoctrine2formprezent

###  Code Quality

Static AnalysisPHPStan, Psalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[a2lix/translation-form-bundle

Translate your doctrine objects easily with some helpers

3376.9M38](/packages/a2lix-translation-form-bundle)[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[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)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[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)
