Felix
Felix

Reputation: 5629

typo3 language chooser issues after choosing new language

Hi in my typo3 8 website I've added a language chooser. Choosing a language works fine, content switches from german to english it works fine content switches properly.

Issue is when I click a link in english version it always falls back to the german link because /en/ is missing in the Link URL

enter image description here

URL in the Browser looks good the en is there, but in the navigation the URL to an page does not conatin en

I use Typo3 8 and realURL

Typoscript:

config {
  sys_language_uid = 0
  language         = de
  locale_all       = de_DE.UTF-8
  htmlTag_langKey  = de
}

config.tx_realurl_enable = 1 

[globalVar = GP:L = 1]
config {
  sys_language_uid = 1
  language         = en
  locale_all       = en_US.UTF-8
  htmlTag_langKey  = en
}
[global]

temp.langMenu = HMENU
    temp.langMenu.special = language
    temp.langMenu.special.value = 0,1
    temp.langMenu.1 = GMENU
    temp.langMenu.1.NO {
    XY = [5.w]+4, [5.h]+4
    transparentColor = #17353e
      backColor = #17353e
    5 = IMAGE
    5.file = fileadmin/design/images/flag_de.gif || fileadmin/design/images/flag_en.gif

 }

    temp.langMenu.1.ACT < lib.langMenu.1.NO
    temp.langMenu.1.USERDEF1 < lib.langMenu.1.NO

    temp.langMenu.1.USERDEF1 = 1
    temp.langMenu.1.USERDEF1.5.file = fileadmin/design/images/flag_de.gif || fileadmin/design/images/flag_en.gif
    temp.langMenu.1.USERDEF1.noLink = 1

RealURL Config:

    <?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
  '_DEFAULT' => 
  array (
    'init' => 
    array (
      'appendMissingSlash' => 'ifNotFile,redirect',
      'emptyUrlReturnValue' => '/',
    ),
    'pagePath' => array(
                'type' => 'user',
                'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
                'spaceCharacter' => '-',
                'languageGetVar' => 'L',
                'expireDays' => 7,
                'rootpage_id' => 1,
                'firstHitPathCache' => 1,
            ),
    'fileName' => 
    array (
      'defaultToHTMLsuffixOnPrev' => 0,
      'acceptHTMLsuffix' => 1,
      'index' => 
      array (
        'print' => 
        array (
          'keyValues' => 
          array (
            'type' => 98,
          ),
        ),
      ),
    ),
    'preVars' => 
    array (
      0 => 
      array (
        'GETvar' => 'L',
                    'valueMap' => array(
                        'de' => '0',
                        'en' => '1',
                        ),
                    'valueDefault' => 'de',
                    # 'noMatch' => 'bypass',
      ),
    ),
  ),
);

What is my fail in this case? Thanks in Advance.

Upvotes: 1

Views: 51

Answers (1)

Paul Beck
Paul Beck

Reputation: 2683

You need to add config.linkVars = L(0-1) to your Typoscript config. This will tell the TYPO3 system to pass this link parameter to each generated url.

Please note that this configuration will only apply to internal links generated by the TYPO3 system itself: For example in menues or when you link another page in the RTE. Absolutely placed links will not be affected by this configuration.

The docs: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#linkvars

Upvotes: 2

Related Questions