Score:0

How to get language prefix in URL for terms without translation?

gu flag

I have a multilingual website with taxonomy vocabulary, which terms are not translatable (company names).

But each term has translated meta tags and paths, depending on the selected site language.

For example, term paths:

  • /vocab-name/term-name (default, english)
  • /de/vocab-name/term-name
  • /es/vocab-name/term-name
  • /it/vocab-name/term-name
  • etc

I can access all of them, metatags are displayed in the correct language.

/vocab-name/ is a view page, listing all terms.

But in all node reference fields or Views, I can get only the default English link to it. It makes sense, because there are no actual translations.

Tried different settings in Views, nothing helped. Either I get English links, or no links at all.

But, as I said, I don't really need translations. There is nothing to translate. Names are not translatable. But, even if I wanted, I'm too lazy to translate like 10,000 terms. But I need to show correct links for the current language. Is it possible to do?

I can try to use hook_views_pre_render(ViewExecutable $view) to alter Views rows and render URLs to terms by myself, but what can I do with node reference fields?

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.