如何将自定义接受语言添加到Chrome进行伪本地化测试? [英] How to add custom Accept-Languages to Chrome for pseudolocalization testing?
问题描述
我正在测试伪本地化
我可以配置Internet Explorer自定义接受语言:
- 点击常规标签,然后点击工具,互联网选项语言
- 在语言首选项对话框中,点击添加。用户定义的语言
qps-ploc
(即伪(基本)语言环境) >
现在,当Internet Explorer发出http请求时,接受语言将以 qpc-ploc
:
GET https://stackoverflow.com/ HTTP / 1.1
接受:application / x-ms-ap plic,image / jpeg,application / xaml + xml,image / gif,image / pjpeg,application / x-ms-xbap,* / *
Accept-Language:qps-ploc,en-US; q = 0.5
用户代理:Mozilla / 4.0(兼容; MSIE 7.0; Windows NT 6.1; WOW64;三叉戟/ 5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Accept-Encoding:gzip,deflate
连接:Keep-Alive
Host:stackoverflow.com
我如何对Chrome执行相同的更改?到Firefox?
更新
还应该指出,Internet Explorer 尊重我的Windows偏好设置。我的Windows配置为使用伪(基本) qps-ploc
语言环境。默认情况下Internet Explorer使用它。
Google Chrome 忽略我的Windows偏好设置,而是决定请求 en-US
和 en
语言:
GET https: //stackoverflow.com/ HTTP / 1.1
Host:stackoverflow.com
连接:keep-alive
Cache-Control:max-age = 0
User-Agent:Mozilla / 5.0(Windows NT 6.1; WOW64)AppleWebKit / 535.1(KHTML,如Gecko)Chrome / 13.0.782.220 Safari / 535.1
接受:text / html,application / xhtml + xml,application / xml; q = 0.9,* /*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:zh-CN,en; q = 0.8
Accept-Charset:ISO-8859-1, utf-8; q = 0.7,*; q = 0.3
< h2>在Firefox中
使用 about:config
$ b
(截图中qps-ploc中存在拼写错误,但您肯定会明白)
< h2>在Chrome中
( 编辑:参考评论以避免Chrome覆盖新版本中的设置。 i>)
编辑文件 C:\ Users \ USERNAME\AppData\Local\Google\Chrome\User Data \Default\Preferences
,并添加:
{...
intl:{
accept_languages:qps-ploc,en-us,en
},
...
}
例如:
i am testing pseudo-localization of a web-site.
i can configure Internet Explorer to have custom accept languages:
- Click Tools, Internet Options
- On the General tab click Languages
- In the Language Preferences dialog click Add.
- Enter a user-defined language of
qps-ploc
(i.e. the Pseudo (Base) locale) - Click OK
Now when Internet Explorer issues an http request, the accept languages will lead with qpc-ploc
:
GET https://stackoverflow.com/ HTTP/1.1
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*
Accept-Language: qps-ploc,en-US;q=0.5
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: stackoverflow.com
How do i perform the same change to Chrome? To Firefox?
Update
It should also be noted that Internet Explorer honors my Windows preferences. My Windows is configured to use Pseudo (Base) qps-ploc
locale. By default Internet Explorer uses it.
Google Chrome ignores my Windows preferences, deciding instead to request en-US
and en
language:
GET https://stackoverflow.com/ HTTP/1.1
Host: stackoverflow.com
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
In Firefox
Use about:config
(There is a typo in qps-ploc in the screenshots, but you surely get the idea)
In Chrome
(Edit: refer to the comments for ways to avoid Chrome override the setting in new versions.)
Edit the file C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data\Default\Preferences
, and add:
{ ...
"intl": {
"accept_languages": "qps-ploc,en-us,en"
},
...
}
For example:
这篇关于如何将自定义接受语言添加到Chrome进行伪本地化测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!