I've created a custom module, that uses templates with hard coded strings. I've created the .pot
and .po
files and included them my module's YML file. The Twig tempatles translate those strings using the |t
operator. This works fine.
Now I've run into a problem: My module offers button to book
an accommodation, which clashes with Drupal's book
(to read) module. In the german translation those two words are completely different.
I've got two questions:
- How to I provide a translation for the
book
verb in my module, in a way that it doesn't clash with the book module. - How to I use the tell Twig to use the correct
book
string from my module?
E.g. this template code
First I want to {{ 'book'|t('context_accomodation') }} a hotel room and when I arrive I want to read a {{ 'book'|t('context_reading') }}
should render in english
First I want to book
a hotel room and when I arrive I want to read a book
and should render in german
First I want to buchen
a hotel room and when I arrive I want to read a Buch