Reputation: 77
I have a problem with Typo3 9.4 (and I have to admit that this is the first Typo3 9 page with multiple languages that I try to set up):
I want to have a content fallback to the default language if there is no content in the selected language. This is my TypoScript:
config {
linkVars = L
sys_language_uid = 0
language = en
locale_all = en_US.UTF-8
sys_language_overlay = 1
htmlTag_setParams = lang="en" dir="ltr" class="no-js en-selected"
}
[globalVar = GP:L = 1]
config {
sys_language_uid = 1
sys_language_mode = content_fallback;0
language = de
locale_all = de_DE.UTF-8
htmlTag_setParams = lang="de" dir="ltr" class="no-js de-selected"
}
[global]
[globalVar = GP:L = 2]
config {
sys_language_uid = 2
sys_language_mode = content_fallback;0
language = es
locale_all = es_ES.UTF-8
htmlTag_setParams = lang="es" dir="ltr" class="no-js es-selected"
}
[global]
The languages are also defiend in the Site Management. Here's the resulting config.yaml:
rootPageId: 1
base: /
baseVariants: { }
languages:
-
languageId: '0'
title: English
navigationTitle: English
base: /
locale: en_US.UTF-8
iso-639-1: en
hreflang: en-US
direction: ''
typo3Language: default
flag: global
enabled: true
-
languageId: '1'
title: Deutsch
navigationTitle: Deutsch
base: /de/
locale: de_DE.UTF-8
iso-639-1: de
hreflang: de-DE
direction: ''
typo3Language: de
flag: de
fallbackType: fallback
fallbacks: '0'
enabled: true
-
languageId: '2'
title: Spanisch
navigationTitle: Spanisch
base: /es/
locale: es-ES.UTF-8
iso-639-1: es
hreflang: es-ES
direction: ''
typo3Language: default
flag: es
fallbackType: fallback
fallbacks: '0'
enabled: true
errorHandling: { }
routes: { }
My Homepage has content in english, german and spanisch are empty. But when I change to german I have no (english) content on the page. Interesting are two points: The menu is in german, so the alternate language is recognized, but in the html source code the html-tag looks like this:
<html lang="en" dir="ltr" class="no-js en-selected">
But this was defined as default. I think, the condition doesn't have any effect. Any Idea what's wrong in my thinking or coding?
Upvotes: 1
Views: 2480
Reputation: 11
I'm just upgrading my website from 8.7.x to 9.5.x. As far as I understand, you don't need your TypoScript part at all. All settings for language fallback are done within the site configuration. There are still two bugs in TYPO3 9.5.x (I only tried these versions) connected to the language fallback:
Upvotes: 1
Reputation: 1880
Linkvar L is no longer supported in typo3 9.5 so you need to change your condition from
[globalVar = GP:L = 2]
to
#condition on localE in site management language tab
[siteLanguage = locale = de_DE.UTF-8]
site management yaml files looks ok
Upvotes: 0