johnode
johnode

Reputation: 740

TYPO3: show/hide specific menu items depending on current language

TYPO3 version 6.1

My page structure:

root
  page1
    subpage1-1
    subpage_only_for_fr_1-2
    subpage_only_for_de_1-3
  page2
    subpage2-1
    subpage2-2

My menu structure is the same (except root item):

  page1
    subpage1-1
    subpage_only_for_fr_1-2
    subpage_only_for_de_1-3
  page2
    subpage2-1
    subpage2-2

My menu TS is:

LEFTNAV = HMENU
LEFTNAV {
    1 = TMENU
    1 {
        wrap = <ul>|</ul>
        NO = 1
        NO {
            wrapItemAndSub = <li>|</li>
            stdWrap.field = title
        }
        ACT = 1
        ACT {
            wrapItemAndSub = <li class="active">|</li>
            stdWrap.field = title
        }
    }
    2 < .1
}

I have an one additional language for my site (default = deutsch, additional = french):

[globalVar=GP:L=0]
  config.sys_language_uid = 0
  config.language = de
[global]
[globalVar=GP:L=2]
  config.sys_language_uid = 2
  config.language = fr
[global]

I want to show/hide some pages in my menu depending on current language.

For example, if user switch language to French, i want to show page subpage_only_for_fr_1-2 in menu and hide subpage_only_for_de_1-3. And vice verca.

How can i accomplish that?

Upvotes: 0

Views: 3841

Answers (1)

johnode
johnode

Reputation: 740

Solved! Here is the simple solution:

Just need to check out fields under the Language section on Behaviour tab (when eyou edit page):

Language
Localization 

 Hide default translation of page
 Hide page if no translation for current language exists 

1) For fields that i need only in Deutsch language, i make checkbox "Hide page if no translation for current language exists" active. Note: you shouldn't add any translations for them in french.

2) For fields that i need only in French, i make checkbox "Hide default translation of page" active. Because it is default language.

And TYPO3 will be hide/show needed pages depending on current language correctly!

Upvotes: 3

Related Questions