Translations
The components write their texts in English and translate them with the trans filter, in the domain twig+intl-icu: the label of the close button of an alert, the text of the buttons of a carousel, and so on. The messages of their errors are in the domain errors.
| Text | Domain |
|---|---|
The texts of the components (Close, Previous, Next, Actions, Logo, …) |
twig+intl-icu |
| The messages of the errors of a component | errors |
The Spanish translations are the catalogues of the package, in resources/translations: twig+intl-icu.es.php and errors+intl-icu.es.php.
Giving the Catalogues to the Translator
- In Symfony, the directory
resources/translationsis a path of the translator (see Symfony). - In Derafu,
Derafu\TwigComponents\Translation\TwigTranslationResourceProvidergives it to the translator, with the tagderafu_translation.resource_provider, asderafu/translationexplains. The services file of the package already has it (see Derafu).
Without a translator, the texts are the English ones.
The Errors
An error of a component is a translatable exception, Derafu\TwigComponents\Exception\TwigComponentException. It names the component and says what is wrong, and both are translated:
| Language | Message |
|---|---|
| English | Component block-accordion: Item title is required. |
| Spanish | Componente block-accordion: El título del ítem es obligatorio. |
The Texts Are Checked
The tests of the package audit the messages of the code and the texts of the templates, with the tools of derafu/translation: a text of a component without its translation, a translation that nothing uses, or an exception that is not translatable makes them fail.