3.0.10
This release only adds a small feature to allow customisable labels for translation
Add translatable locale labels (#365)
Documentation for this feature
You may now set labels for each tab by adding a locale_labels
array to the TranslationsType
form type, like so:
$form = $this->factory->createBuilder(FormType::class, new Product())
->add('translations', TranslationsType::class, [
'locale_labels' => [
'fr' => 'Français',
'en' => 'English',
],
])
->add('save', SubmitType::class)
->getForm()
;
If a label is not set here (in this examplen de
for instance), its value will default to null and the previous behaviour will kick-in (the template with capitalize the locale name).
Hence, this does not introduce any breaking change and no change of defaults, and seems perfectly safe.
As the trans
filter is used in the templates, you can also use translation keys directly here:
$form = $this->factory->createBuilder(FormType::class, new Product())
->add('translations', TranslationsType::class, [
'locale_labels' => [
'fr' => 'admin.language.fr.tab_title',
'en' => 'admin.language.en.tab_title',
],
])
->add('save', SubmitType::class)
->getForm()
;
See also: https://a2lix.fr/bundles/translation-form/3.x.html#bundle-usage