In twig we can use {{ 'Hello Earth.'|t }} to mark this text as translatable (so i added several of these to my custom twig template). But if i have multiple languages, where can i actually add translation to 'Hello Earth' for other languages? I cannot find it in admin. For example i tried to enable 'Interface Translation' module in MULTILINGUAL section, then i cleared all cache, then i go to Configuration -> User interface translation but i don't see my strings in the list! Please help!

Comments

joelpittet’s picture

Version: 8.0.0-beta10 » 8.0.0
Component: user interface text » language system
Issue tags: +i18n, +translation

Not sure off-hand but moving to hopefully a better component for the maintainer of this subsystem to help with.

The only thing I do know is that twig translation is no different than t() calls, so if you know where to fix one you know the other.

plach’s picture

Component: language system » locale.module
Issue tags: -twig string translation +D8MI, +language-interface, +Twig

Did you install additional languages? If so, you should access the page where the string to be translated is displayed, and switch to a page language different from English. Once you have done that it should be available at:

http://example.org/admin/config/regional/translate

plach’s picture

Berdir’s picture

Status: Active » Fixed

Closing this, no response in a very long time and was answered.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

robertoperuzzo’s picture

Hi there,

I re-opened this issue because I'm facing something similar in D8.7.8.

I have this twig tag {{ 'Our Offer'|t }} in my custom block--my-custom-block.html.twig, I load the page where block is placed in different languages, but I don't see string 'Our Offer' in /admin/config/regional/translate.

Additional languages are installed, it seems there something wrong with enabled custom sub-theme translation.

Berdir’s picture

> Additional languages are installed, it seems there something wrong with enabled custom sub-theme translation.

That is extremely unlikely. In the end, this is just translated to PHP code, either it runs or it doesn't. Are you sure that you cleared all caches and that your template is really used? If you change the string to something else, does it show?

Also, commenting on a closed ticket is not a good idea, you should ask for support in a new support ticket, the forum, Slack, Drupal Answers or a similar place.

drugan’s picture

Version: 8.0.0 » 10.0.x-dev

Anyone who encountered this issue you must ,,see,, a rendered twig template at least once before you'd get strings in the template available in User interface translation.

My issue was with the Drupal Commerce order receipt template which I struggled to translate via UI but its strings have become available for translation only after the very first order receipt was sent to a customer.