Giovanni Dreas
Giovanni Dreas

Reputation: 1

Frontend Language menu with Typo3

I'm creating a simple website using TYPO3 CMS (version 6.2.13), and I want to add a Language Menu to switch the frontend language. Default language is English and the only extra language is Slovak.

This is what I've done until now:

I created two website language at the root page (i'm actually using only Slovak, because Default should be considered as English). https://i.sstatic.net/kN6Mh.jpg
I also created a new translation (Slovak) for the page. https://i.sstatic.net/6D76F.jpg

My template configuration (i modified the Introduction Package, i didn't create a new template) is this:

config {
  absRefPrefix = auto
  no_cache = {$config.no_cache}
  uniqueLinkVars = 1
  pageTitleFirst = 1
  linkVars = L
  prefixLocalAnchors = {$config.prefixLocalAnchors}
  renderCharset = utf-8
  metaCharset = utf-8
  doctype = html5
  removeDefaultJS = {$config.removeDefaultJS}
  inlineStyle2TempFile = 1
  admPanel = {$config.admPanel}
  debug = 0
  cache_period = 86400
  sendCacheHeaders = 0
  intTarget =
  extTarget =
  disablePrefixComment = 1
  index_enable = 1
  index_externals = 1
  headerComment = {$config.headerComment}

  // Enable RealUrl
  tx_realurl_enable = 1
  simulateStaticDocuments = 0

  // Disable Image Upscaling
  noScaleUp = 1

  // Language Settings
  sys_language_uid = 0
  sys_language_overlay = 1
  sys_language_mode = content_fallback
  language = en
  locale_all = en_US.UTF-8
  htmlTag_setParams = lang="en" dir="ltr" class="no-js"

  // Compression and Concatenation of CSS and JS Files
  compressJs = {$config.compressJs}
  compressCss = {$config.compressCss}
  concatenateJs = {$config.concatenateJs}
  concatenateCss = {$config.concatenateCss}
}

[globalVar = GP:L = 2]
  config {
    sys_language_uid = 5
    language = Slovak
    locale_all = sk_SK.UTF-8
    htmlTag_setParams = lang="sk" dir="ltr" class="no-js" 
  }
[global]

This is my language-menu code:

20 = HMENU
20 {
  special = language
  special.value = 0, 2
  special.normalWhenNoLanguage = 0
  wrap =
  1 = TMENU
  1 {
    noBlur = 1
    NO = 1
    NO {
      linkWrap = <li>|</li>
      stdWrap.override = English || Slovak
      doNotLinkIt = 1
      stdWrap {
        typolink {
          parameter.data = page:uid
          additionalParams = &L=0 || &L=2
          ATagParams = hreflang="en-GB" || hreflang="sk-SK"
          addQueryString = 1
          addQueryString.exclude = L,id,cHash,no_cache
          addQueryString.method = GET
          useCacheHash = 1
          no_cache = 0
        }
      }
    }

    ACT < .NO
    ACT.linkWrap = <li class="active">|</li>
    #### NO TRANSLATION AVAILABLE STATES ####
    USERDEF1 < .NO
    USERDEF1 {
      linkWrap = <li class="text-muted">|</li>
      stdWrap.typolink >
    }

  }
}

wrap = <ul id="language_menu" class="language-menu">|</ul>

Now, I have a problem: in the switch language menu in the frontend I can't select Slovak (text-muted). English appear to be the only selectionable language. But when i manually enter the URL of the Slovak page (sitename/sk/), i can see the Slovak page with the Slovak content, so the problem (i guess) it's the menu, not the page. Anyone can help me? Do you need extra information to find a solution?

P.S. If I've added useless information or missed important things, I'm sorry, I'm really a newbie.

Upvotes: 0

Views: 923

Answers (1)

rob-ot
rob-ot

Reputation: 1264

disable realUrl (config.tx_realurl_enable = 0 ) and clear your general cache. Then try out what your language menu really does ( index.php?id=1&L=2 would switch the language).

You also have addQueryString.exclude = L,id,cHash,no_cache in your menu. What suggest you 'removed' the L (Language) parameter

Upvotes: 1

Related Questions