TYPO3: language dependent variable that is hard-coded in a Fluid template
multilingual, typo3, typo3-7.6.x, typoscript
Solution
I'd recommend to use language identifiers for the constants instead:
myextension.configuration {
general {
slogan {
# cat=myextension/general/05; type=string; label=Website Slogan in default language.
default = website slogan in main language
# cat=myextension/general/06; type=string; label=Website Slogan in second language.
second = website slogan in second language
# cat=myextension/general/07; type=string; label=Website Slogan in third language.
third = website slogan in third language
}
}
}
Then move the condition to the setup:
page = PAGE
page {
# Page Main template
10 = FLUIDTEMPLATE
10 {
variables {
# slogan
slogan = TEXT
slogan.value = {$myextension.configuration.general.slogan.default}
}
}
}
[globalVar = GP:L=1]
page.10.variables.slogan.value = {$myextension.configuration.general.slogan.second}
[end]
[globalVar = GP:L=2]
page.10.variables.slogan.value = {$myextension.configuration.general.slogan.third}
[end]
Problem
I have a multilingual site built with TYPO3 V7.6.18. It uses a slogan which should remain editable but different for three languages. This is a variable that is hard-coded in the Fluid templates. For variables of this kind I use a file `Configuration/TypoScript/constants.ts` where I define the variable that can be edited (`WEB -> Template -> Constant Editor`) and used: ``` #--------------------------------------------------------------------- # constants.ts #--------------------------------------------------------------------- # customsubcategory=general=General Setup myextension.configuration { general { # cat=myextension/general/05; type=string; label=Website Slogan. slogan= website slogan in main language } } [globalVar = GP:L=1] myextension.configuration.general.slogan = website slogan in second language [end] [globalVar = GP:L=2] myextension.configuration.general.slogan = website slogan in third language [end] ``` I then bind the variable in `Configuration/TypoScript/setup.ts` for use: ``` #--------------------------------------------------------------------- # setup.ts #--------------------------------------------------------------------- page = PAGE page { # Page Main template 10 = FLUIDTEMPLATE 10 { variables { # slogan slogan = TEXT slogan.value = {$myextension.configuration.general.slogan} } } } ``` This code works, but only the slogan in the main language is editable ... Any solution to make the slogans editable in the other two languages?