TYPO3 Create Links And Respect Language Of Target Page (Fluid, Typolink)
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 "<f:link.page 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 <f:link.page> 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
- → Best practice usage of i18n language code to identify language and region?
- → How to show a page in different languages?
- → Nuxt and i18n: Google showing mixed language results
- → How to tell search engines about localized versions of the website when using Firebase Hosting i18n rewrites?
- → How to format numbers depending on current language with Laravel
- → How to put value(data) into html attribute with ReactJS and ReactIntl
- → react, i18n, redux and react router configuration
- → Vue.js with Vuex, and custom components, @click method outputs undefined
- → How to use _ in mako rendering template with i18n?
- → Laravel and Vuejs - how do I do with Translations
- → Struggling with iLib
- → Floating Point Number parsing: Is there a Catch All algorithm?
- → Localising date format descriptors