Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 使用浏览器语言设置设置语言(rlmp_语言检测)_Typo3_Typo3 6.2.x_Language Detection - Fatal编程技术网

Typo3 使用浏览器语言设置设置语言(rlmp_语言检测)

Typo3 使用浏览器语言设置设置语言(rlmp_语言检测),typo3,typo3-6.2.x,language-detection,Typo3,Typo3 6.2.x,Language Detection,我尝试在我的typo3 6.2一个树页面中自动设置语言 在我的设置中,我使用RealURL将语言添加到URL中,我使用默认的L参数。我不为语言使用ISO代码,但我使用静态的信息表来设置ISO代码。对于语言切换,我尝试使用扩展rlmp\u language\u detection,但它不起作用 我的语言配置(typo3name,官方ISO代码-与静态信息表格一起选择,ID-用于L参数) 默认值,-,0 恩,jp,恩,1 嗯,我们,嗯,2 jp,ja,3 我的插件打字脚本: plugin.tx_

我尝试在我的typo3 6.2一个树页面中自动设置语言

在我的设置中,我使用RealURL将语言添加到URL中,我使用默认的
L
参数。我不为语言使用ISO代码,但我使用静态的信息表来设置ISO代码。对于语言切换,我尝试使用扩展
rlmp\u language\u detection
,但它不起作用

我的语言配置(typo3name,官方ISO代码-与静态信息表格一起选择,ID-用于L参数)

  • 默认值,-,0
  • 恩,jp,恩,1
  • 嗯,我们,嗯,2
  • jp,ja,3
我的插件打字脚本:

plugin.tx_rlmplanguagedetection_pi1 {
   useOneTreeMethod = 1
   defaultLang = en
}
我的langauges打字稿:

config {
sys_language_uid = 0
language = en
locale_all = en-eu
}

[globalVar = GP:L = 1]
config {
sys_language_uid = 1
language = en
locale_all = en-us
}
[global]

[globalVar = GP:L = 2]
config {
sys_language_uid = 2
language = en
locale_all = en-jp
}
[global]

[globalVar = GP:L = 3]
config {
sys_language_uid = 3
language = jp
locale_all = jp-jp
}
[global]
为了测试它,我将我的第一个语言设置为日语,当我请求根页面时,它位于我的请求头中:

Accept-Language:ja,de-DE;q=0.8,de;q=0.6,en-US;q=0.4,en;q=0.2
说:


但是根本没有设置
L
参数,因此我得到默认语言。

我建议使用.htaccess重定向浏览器接受语言。这样,您就不用为了重定向而加载整个TYPO3实例

根据您使用realurl的天气情况,它将如下所示:

RewriteCond %{HTTP:Accept-Language} ^en-us [NC]
RewriteRule ^$ /en-us/ [L,R=307]

RewriteCond %{HTTP:Accept-Language} ^ja [NC]
RewriteRule ^$ /jp/ [L,R=307]

RewriteCond %{HTTP:Accept-Language} ^en-gb [NC]
RewriteRule ^$ /en-eu/ [L,R=307]
但我不知道如何瞄准en jp

在我们的网站上,我们使用307作为状态代码,因此浏览器将始终查找初始页面(以防结构发生变化),而且它不会影响SEO

我也遇到过同样的问题: 我是如何让它一步一步地工作的:

1步: 安装
static\u info\u tables
请小心,它应该是DB utf-8字符集,在拉丁语中1(在我的情况下)不起作用

2步: istall
rlmp\u语言检测

3步: 检查您的服务器上是否安装了
php geoip
php模块,如果没有安装Ext:
ml\u geoip
或以任何方式安装它

4步 在TS模板中包括静态模板

5步

请不要忘记在基线页面树中选择玩具郎的ISO代码

6步 TS设置-在所有lang配置之后添加此设置

plugin.tx_rlmplanguagedetection_pi1 {
   # this mean that you hav ejust one tree pages for all lang, for multi trees look manual
   useOneTreeMethod = 1 

   #important - this your website sys_language default
   defaultLang = ru 

   # use -1 when you wont to test redirect, after change to 0
   cookieLifetime = -1 

   # you defind which method will be used for redirect browser or ip, better testing just with one
   testOrder = browser,ip

  # we can config aliases like "code = lang1, lang2"
  languageAliases >
  languageAliases {
    ua = uk,en
    en = en
    ru = ru,en
  }

  #we can country codes dependencies "country code = lang"
  countryCodeToLanguageCode >
  countryCodeToLanguageCode {
    ua = uk
    us = en
    gb = en
    nz = en
    au = en
    ie = en
    ca = en
    by = ru
  }

  #this just limit input params array
  limitToLanguages = ru,uk,en 

}

# ok just after all we include ext to page, on ts begining you shoud to have "page = PAGE" just check
page.1007 = < plugin.tx_rlmplanguagedetection_pi1
plugin.tx\u rlmplanguagedetection\u pi1{
#这意味着,对于所有语言,您只有一个树页面,对于多个树,请参阅手册
useOneTreeMethod=1
#重要信息-这是您的网站系统默认语言
defaultLang=ru
#更改为0后,如果您不想测试重定向,请使用-1
cookieLifetime=-1
#您定义了用于重定向浏览器或ip的方法,只需一个就可以更好地进行测试
testOrder=浏览器,ip
#我们可以配置别名,如“code=lang1,lang2”
语言别名>
语言别名{
ua=英国,英国
恩=恩
ru=ru,en
}
#我们可以使用国家代码依赖项“国家代码=语言”
countryCodeToLanguageCode>
countryCodeToLanguageCode{
ua=英国
美国=欧洲
gb=en
新西兰=欧洲
au=en
ie=en
ca=en
by=ru
}
#这只是限制输入参数数组
limitToLanguages=ru、uk、en
}
#好的,在我们将ext包括到page之后,在ts开始时,您应该有“page=page”检查一下
page.1007=
您的意思是当您使用导航时,您没有
l
参数?@Fixus我调用页面时没有
l
参数。(当我添加一个
L
-参数时,我得到了正确的语言-但想法是这会自动工作)当您设置
L
参数时,它是否在导航中呈现?“我的意思是你们能用正确的语言在页面上导航吗?”Fixus很抱歉回答晚了。是的,翻译很有效。只是检测/重定向而已。谢谢您的帮助。看来我现在要这样做了。你知道我怎么做默认重定向吗?就像Accept language中的第一种语言没有修复任何规则一样?此解决方案可能存在问题,因为它会将我重定向到本地化页面,即使我选择了默认语言,因为默认语言首页位于/。
plugin.tx_rlmplanguagedetection_pi1 {
   # this mean that you hav ejust one tree pages for all lang, for multi trees look manual
   useOneTreeMethod = 1 

   #important - this your website sys_language default
   defaultLang = ru 

   # use -1 when you wont to test redirect, after change to 0
   cookieLifetime = -1 

   # you defind which method will be used for redirect browser or ip, better testing just with one
   testOrder = browser,ip

  # we can config aliases like "code = lang1, lang2"
  languageAliases >
  languageAliases {
    ua = uk,en
    en = en
    ru = ru,en
  }

  #we can country codes dependencies "country code = lang"
  countryCodeToLanguageCode >
  countryCodeToLanguageCode {
    ua = uk
    us = en
    gb = en
    nz = en
    au = en
    ie = en
    ca = en
    by = ru
  }

  #this just limit input params array
  limitToLanguages = ru,uk,en 

}

# ok just after all we include ext to page, on ts begining you shoud to have "page = PAGE" just check
page.1007 = < plugin.tx_rlmplanguagedetection_pi1