Bug #14665
closedConditional branch not working with sys_language_uid
0%
Description
If switching language with HTTP_HOST (Domain-switching) without &L Parameter:
###################
#Language Detection #
###################
[globalString = HTTP_HOST = www.mydomain.com]
config.sys_language_uid = 1
config.language = en
config.locale_all = en_EN
[global]
and conditional branch with this:
[globalVar = TSFE:sys_language_uid = 1]
mycode
[end]
is not working, because $TSFE->sys_language is not yet updated.
I found out that $TSFE->config['config']['sys_language'] is always updated with the correct language setting.
So I tried to this condition:
[globalVar = TSFE:config|config|sys_language_uid = 1]
mycode
[end]
I noticed that the first call is not working but the following calls are working. So I was forced to triple check all language with conditional branches like this:
1. english setting without &L-Parameter
2. german with &L-Parameter
3. english setting with &L-Parameter
in this order and for all language setting in my page. I couldn't found a solution yet. Altough I was digging really deep into the codes. :)
(issue imported from #M973)
Updated by old_chihoang over 19 years ago
[globalVar = TSFE:config|config|sys_language_uid = 1]
mycode
[end]
is not working at all either.
I noticed that the first call is not working but the following calls are working
is definitely wrong!
here another ts:
#Sprachvariabeln default setzen
config.sys_language_uid = 0
config.language = de
config.locale_all = german
- Sprachparameter in Abhängigkeit der URL setzen
[globalString = HTTP_HOST= *.com]
config.sys_language_uid =1
config.language = en
config.locale_all = en {$mylangvar} = 1
[global]
- Sprachparameter in Abhängigkeit des Parameters L setzen
[globalVar = GP:L=1]
config.sys_language_uid =1
config.language = en
config.locale_all = en
[global]
[globalVar = GP:L=0]
config.sys_language_uid = 0
config.language = de
config.locale_all = german
[global]
- temp-Variable zum Drucken
temp.PRINT = COA
temp.PRINT.10 = TEXT
temp.PRINT.10.value =Seite Drucken
...
#Nur zum Test wird die Sprach-id ausgegeben - das funktioniert
temp.PRINT.20 = TEXT
temp.PRINT.20.data = TSFE:sys_language_uid
temp.PRINT.20.wrap = --Sprach-id: | --
#Abfrage, wenn Sprach-id 1, dann schreibe Print funktioniert nicht, da anscheinend ein Bug
[globalVar= TSFE:sys_language_uid =1]
temp.PRINT.10.value = Print
[global]
My conclusion: its just impossible to check sys_language_uid with globalVars, because parsing of globalVars is before parsing of config array! So domainchecking is not very easy atm. Using stdWrap.data = TSFE:sys_language_uid is working but useless.
Updated by old_chihoang over 19 years ago
Final solution for domainswitching:
in the constants:
- Sprachparameter in Abhängigkeit der URL setzen oder L-Parameter setzen (language var from http_host or L-parameter)
mylangvar = 0
[globalString = HTTP_HOST= *.com]
mylangvar = 1
[global]
[globalVar = GP:L=1]
mylangvar = 1
[global]
usw.
in the setup:
[globalVar = LIT:1 = {$mylangvar}]
das was eben sprachabhängig gemacht werden muss
(condition for english)
[global]
This bug can be closed now. Thanks to aga.
Updated by Michael Stucki over 19 years ago
Hmm. I think the only way around this problem is to hack t3lib_matchcondition inside of the getGP_ENV_TSFE() function. However it seems that this condition was never needed before.
Since you already found a workaround for your case, I'll close this bug.
Summary: Bug exists bug is not going to be fixed.