TypoScript condition based on language - TYPO3 ver

2019-08-27 22:45发布

I'm currently upgrading a site from version 7 to version 9.

I have a small TypoScript object that shows different content depending on the page language selected:

lib.myTSO = TEXT
lib.myTSO.value (
    <p>Hello World</p>
)
[globalVar = GP:L =1]
    lib.myTSO = TEXT
    lib.myTSO.value (
        <p>Hello World in a different language</p>
    )
[global]

This worked, in version 7 & 8 but no longer appears to be working in version 9. I assume its the way in which I'm calling the language variable?

Thanks again,

标签: typo3-9.x
1条回答
迷人小祖宗
2楼-- · 2019-08-27 23:15

Matching against your locale set in site configuration should work:

[siteLanguage("locale") == "en_US.UTF-8"]
   lib.myTSO = TEXT
   lib.myTSO.value (
        <p>Hello World in a different language</p>
    )
[global]

Reference: https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/SiteHandling/UseSiteInConditions.html

In Constants only this seems to work as of TYPO3 9.5.1

[siteLanguage = locale = en_US.UTF-8]
constantFoo = Bar
[global]
查看更多
登录 后发表回答