简体   繁体   中英

typo3 display language switcher

I'm trying to create a language switcher. I've found few examples but can't make It work.

For example I tried to use that code in TS:

  lib.languageMenu = HMENU
  lib.languageMenu {
  special = language
  special.value = 0,1

 1 = TMENU
 1 {
wrap = <ul class="langMenu">|</ul>
noBlur = 1
NO = 1
NO {
  linkWrap = <li class="menu-item normal">|</li>

  stdWrap.override = English || Deutsch
  stdWrap.htmlSpecialChars = 1
}

ACT < .NO
ACT {
  doNotLinkIt = 1
  linkWrap = <li class="menu-item active">|</li>
}

# NO + Translation doesn't exist
USERDEF1 < .NO
USERDEF1.doNotLinkIt = 1

# ACT + Translation doesn't exist
USERDEF2 < .ACT
USERDEF2.doNotLinkIt = 1
 }
}

I created an <ul class="langMenu"> in my header.html, which is in partials, but It's empty. What Am I missing, how can I make It visible ?

typo3模板

Try by changing <f:cObject typoscriptObjectPath="lib.languageMenu" />

With:

<!-- ###LANGNAV### Start -->

<!-- ###LANGNAV### End -->

Then check into TS to find where "subparts" is and add:

LANGNAV < lib.languageMenu

This should be it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM