TYPO3 v6中的语言切换 [英] Language switching in TYPO3 v6

查看:100
本文介绍了TYPO3 v6中的语言切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按预期,切换fontend-language对我不起作用.到目前为止,我所做的事情:

Switching the fontend-language does not work for me as expected. What I have done so far:

在根页面上,我创建了两种网站语言,德语和英语:

At the root page, I created two website-languages, german and english:

在印刷模板中,我添加了以下设置,发现其中大部分分散在网络上:

In the typoscript template I added the following setup, I found most of this scattered around the web:

config {
  tx_realurl_enable = 1
  simulateStaticDocuments = 0
  sys_language_uid = 0
  language = de
  locale_all = de_DE
  htmlTag_langKey = de
  linkVars := addToList(L)
  uniqueLinkVars = 1
  sys_language_mode = content_fallback
  sys_language_overlay = 1
}

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

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

在页面上,我为页面创建了新的翻译并添加了一些内容.

At a page, I created a new translation for the page and added some content.

左侧是填充有lorem ipsum的标准语言(在本例中为德语).右侧是新语言(英语),其中充满了一些不同的内容,只是为了看到一些效果.

On the left is the standard language (in this case german) filled with lorem ipsum. On the right is the new language (english) filled with some different content just to see some effect.

现在,当我单击英文栏上方的小预览图标时,将我带到index.php?id=3&L=2,这表示已添加L=2.但是网站上的内容仍然是标准(德语/lorem ipsum)内容.我在哪里做错了?

Now, when I click the little preview icon above the english column, it takes me to index.php?id=3&L=2, which indicates that L=2 is added. But the content on the website is still the standard (german/lorem ipsum) content. Where did I do wrong?

另外:我在前端添加了一个菜单,以允许用户在语言之间进行切换:

Also: I added a menu to the frontend to let the user switch between languages:

  languageMenu = HMENU
  languageMenu {
    special = language
    special.value = 0,2
    1 = TMENU
    1 {
      wrap = <ul id="language"> | </ul>
      NO = 1
      NO {
        wrapItemAndSub = <li> | </li>
        stdWrap.override = deutsch || english
      }
      ACT < .NO
      ACT {
        ATagParams = class="active"
      }
    }
  }

与realurl结合使用时,结果如下:

In combination with realurl, this results in urls like so:

德语:/startseite/ 英文:/2/home/

  1. 是否可以使用deen之类的参数代替语言的数字?
  2. 如何确保URL始终包含德语或英语参数?
  3. /startseite/上时,相应的链接为class="active",但是在/2/home/上,没有链接被标记为活动.怎么解决?
  1. Is it possible to use params like de and en instead of numbers for the languages?
  2. How can I ensure that the url always contains either the german or the english language parameter?
  3. When on /startseite/, the corresponding link gets class="active", but on /2/home/, no link is marked as active. How could that be fixed?

TYPO3和多语言似乎是一个令人困惑的话题,我希望你们中的一些人可以回答我的一些问题.预先感谢!

TYPO3 and multilanguage seems to be a confusing topic, I hope some of you can answer some of my questions. Thanks in advance!

在这种情况下,以防其他人遇到相同的问题:

Here it is in case anyone else has the same problem:

设置:

config {
  tx_realurl_enable = 1
  simulateStaticDocuments = 0
  sys_language_uid = 0
  language = de
  locale_all = de_DE
  htmlTag_langKey = de
  linkVars := addToList(L)
  uniqueLinkVars = 1
  sys_language_mode = content_fallback
  sys_language_overlay = 1
}

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

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

[...]

  languageMenu = HMENU
  languageMenu {
    special = language
    special.value = 0,2
    1 = TMENU
    1 {
      wrap = <ul id="language"> | </ul>
      NO = 1
      NO {
        wrapItemAndSub = <li> | </li>
        stdWrap.override = deutsch || english
      }
      ACT < .NO
      ACT {
        ATagParams = class="active"
      }
    }
  }

RealUrl conf:

RealUrl conf:

    'preVars' => 
    array(
      0 => 
      array(
        'GETvar' => 'L',
        'valueMap' => 
        array(
          'de' => '0',
          'en' => '2',
        ),
        'valueDefault' => 'de'
      ),
    ),

推荐答案

1)+ 2) 在您的realURL配置中使用valueMap:

1) + 2) Use valueMap in your realURL configuration:

   'preVars' =>
      array(
       0 =>
          array(
            'GETvar' => 'L',
            'valueMap' =>
              array(
                'de' => '0',                    
                'en' => '2'
              ),
          )
      )

3)尝试使您的L参数与sys_language_uid保持同步. 因此,对于英语使用:

3) Try to keep your L param in sync with the sys_language_uid. So for englisch use:

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

这篇关于TYPO3 v6中的语言切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆