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

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

elao/form-translation-bundle
============================

Generate translation key for forms

v4.2.0(2y ago)44225.4k↓26%12[1 PRs](https://github.com/Elao/ElaoFormTranslationBundle/pulls)1MITPHPPHP ^7.4|^8.0

Since Jan 28Pushed 2y ago16 watchersCompare

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

READMEChangelog (10)Dependencies (10)Versions (18)Used By (1)

ElaoFormTranslationBundle
=========================

[](#elaoformtranslationbundle)

[![](https://camo.githubusercontent.com/f4e5e02f9730f35a06e7b0b163bc39e7a2fe6f9b63f17a2ff5c3d48e57701a4d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d342e302d626c75652e737667)](https://camo.githubusercontent.com/f4e5e02f9730f35a06e7b0b163bc39e7a2fe6f9b63f17a2ff5c3d48e57701a4d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d342e302d626c75652e737667)[![Build Status](https://camo.githubusercontent.com/55770bdd263c4a73ae3d3b41cf2322d516b7e5d2a798c7b8c57dcbcdd4676315/687474703a2f2f6170692e7472617669732d63692e6f72672f456c616f2f456c616f466f726d5472616e736c6174696f6e42756e646c652e706e67)](http://travis-ci.org/Elao/ElaoFormTranslationBundle)

Description:
------------

[](#description)

This bundle provides a nice way of generating translation keys for form fields in a "logic" way. It is used mainly to generate automatic labels on fields but can be use to build any key.

**For example, in a form `RegisterType` named "register" the key for its field "name" would be `form.register.children.name.label`.**

Another more advanced example would be a field "emails" which is a `collection` of `text` inputs, it'll generate:

- `form.register.children.emails.label`
- `form.register.children.emails.label_add`
- `form.register.children.emails.label_delete`
- `form.register.children.emails.children.prototype.label`

Or in `yml`:

```
form:
    register:
        children:
            emails:
                label:          # add your trans for the fieldset ex: Email
                label_add:      # add your trans for add button ex: Add an email
                label_delete:   # add your trans for remove button ex: Remove an email
                children:
                    prototype:
                        label:  # add your trans for the label of one email field ex: Email address
```

*Note: The keys will only be generated at runtime and won't be dumped when you use `translation:update` yet (we're working on it).*

Installation:
-------------

[](#installation)

Add ElaoFormTranslationBundle to your composer.json:

```
{
    "require": {
        "elao/form-translation-bundle": "3.*"
    }
}
```

Now download the bundle by running the command:

```
$ php composer.phar update elao/form-translation-bundle
```

Register the bundle in the kernel:

```
