TYPO3 Create Links And Respect Language Of Target Page (Fluid, Typolink)

- 1 answer

we have a webpage, where not all pages are translated. So many pages are only available in english and some special pages (country landing pages) are translated to various languages.

From these special translated pages I want to create links automatically converted to the default languages if the target page is not translated.

In menus (HMENU) "protectLvar = 1" works fine for me.

But how can I achieve this in normal typolinks or fluid "< uid="..."> without manually dealing with the language ?

I'm on typo3 9.5.

Sample: I have the following polish URL:

All the links from this page should go to "/en/subpage-xy/" because the above page is the only page translated to "pl". But actually all links go to "/pl/subpage-xy/" regardless if pages are translated to "pl".

The content-fallback mode leads to displaying english content under a /pl/-URL. I don`t want to change the fallback mode - I only want the links to be created to available language of the target page.

Is this possible ? Many thanks for any hints.



I think that you can't achieve what you want with default behavior.

I suggest you to wrote your own view helper based on <> and in that view helper, you can check with a request in the DB if the page exist for the current language and switch to English if that's not the case.

I guess that you can also generate the link with typoscript with condition over page existence in current language but it's more tricky.

You have a sample here : check if current page is translated