0

I'm trying to create a language switch with personal images that makes possible to change the website language in the frontend (I already defined the languages and the alternative language pages). I'm using a snippet from TYPO3 Core Documentation, but it's not working for me, so I must be doing something wrong...I added a marker in my template called LANGUAGE, which corresponds to a DIV in the top right corner of the main container, where would appear some representative flags of the languages available for that page.

Here it is my TS code in the Template:

config.linkVars = L , type
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN

[globalVar = GP:L =0]
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN
config.htmlTag_langKey = en
[global]

[globalVar = GP:L =1]
config.sys_language_uid = 1
config.language = pt
config.locale_all = pt_PT
config.htmlTag_langKey = pt
[global]

[globalVar = GP:L =2]
config.sys_language_uid = 2
config.language = fr
config.locale_all = fr_FR
config.htmlTag_langKey = fr
[global]

[globalVar = GP:L =3]
config.sys_language_uid = 3
config.language = de
config.locale_all = de_DE
config.htmlTag_langKey = de
[global]

page.10.marks.LANGUAGE {

  lib.langMenu = HMENU
  lib.langMenu {
  special = language
  special.value = 0,1,2,3
  special.normalWhenNoLanguage = 0
    1 = GMENU
    1.NO {
     XY = [5.w]+4, [5.h]+4
     backColor = white
     5 = IMAGE
     5.file = fileadmin/Template/images/english.png  || fileadmin/Template/images/portuguese.png  || fileadmin/Template/images/french.png || fileadmin/Template/images/german.png
     5.offset = 2,2
}

}
}
Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

2

Yes, this can't work because you're defining a lib element inside a mark. You must nest your code differently:

lib.langMenu = HMENU
lib.langMenu {
  [all your stuff from the lang menu]
}

and then

page.10.marks.LANGUAGE < lib.langMenu

By the way, if you also define the states USERDEF1 and USERDEF2 and use doNotShowLink = 1, then the link to a language isn't rendered if the page is not available in this language. This can be very helpful when not all your content is translated and you don't want to use fallback:

USERDEF1 = 1
USERDEF1.doNotShowLink = 1

USERDEF2 < .USERDEF1
lorenz
  • 4,538
  • 1
  • 27
  • 45