TypoScript condition based on language - TYPO3 version 9

纵然是瞬间 提交于 2019-12-11 19:47:55

问题


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,


回答1:


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]


来源:https://stackoverflow.com/questions/53170154/typoscript-condition-based-on-language-typo3-version-9

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!