Score:0

How to translate breadcrumbs block via drupal_block() in twig?

jp flag

I am trying to translate the breadcrumbs block in Drupal 9.3 via Twig Tweak I am loading the block in a twig like so:

{{ drupal_block('system_breadcrumb_block') }}

If I leave it like this, it only returns Home --> Page_name (In english) Even if it is another language selected (de). Is there some way to pass a language parameter to this function? Or somehow to indicate that it should be loading the page titles in the current language?

Score:3
cn flag

I wouldn't try to translate breadcrumbs in Twig. Blocks get the language from the global context and for breadcrumbs it's delegated to the breadcrumb builder which then gets it from the context.

For the most simple case, core path based breadcrumb builder and static page titles, Drupal is using interface translation and you find the translatable string in the translation table after you have used the page the first time.

If you have installed a breadcrumb module or are displaying dynamic page titles you have to add more details to the question.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.