Hi,
Motivation:
The purpose of this discussion is to discuss whether displayed data of form elements (#title, #description) created using form API should be translated by default.
Description:
In short, why not convert this :
$form['foo'] = array(
'#type' => 'foo',
'#title' => $this->t('FooBar'),
'#description' => $this->t('Description for the FooBar element.')
);
to
$form['foo'] = array(
'#type' => 'foo',
'#title' => 'FooBar',
'#description' => 'Description for the FooBar element.'
);
Because #title and #descripion are made to be displayed on screen they have to be translatable. Why requiring developper to explicitely remind to translate it when it could be translated automatically for him ?
Impact:
- DX: As a developper, you don't have to remind this $this->t('')
addition to those fields. Plus, second code looks cleaner for not having boilerplate repeated code.
- UX: As a user, you won't have to open an issue and wait simply because the module's dev have forgotten on field to be translatable. This would reduce the number of issue plus the time waiting for next module release until this is included as a fix.
Additionnal information:
I do understand that this is such a basic consideration that a debate probably already have happened. I could not find it on issue list, but this is not an intention to open a troll debate ! I a newbie at core contribution, please excuse me if it not the proper way to do so.