---
title: "Translations"
description: "Translations"
type: "docs"
category: "doc"
tags: []
authors: [Anonymous]
date: "2026-10-20"
last_update: "2026-10-20"
time_minutes: 2
draft: false
unlisted: false
url: "https://www.derafu.dev/docs/ui/twig-components/translations"
---

# 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/translations` is a path of the translator (see [Symfony](symfony#the-translations)).
- **In Derafu**, `Derafu\TwigComponents\Translation\TwigTranslationResourceProvider` gives it to the translator, with the tag `derafu_translation.resource_provider`, as [`derafu/translation`](https://www.derafu.dev/docs/core/translation) explains. The services file of the package already has it (see [Derafu](derafu#with-the-container)).

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`](https://www.derafu.dev/docs/core/translation/lint): a text of a component without its translation, a translation that nothing uses, or an exception that is not translatable makes them fail.



---
Last updated on 20/10/2026

