http-accept-language

Why does Symfony ignore the browsers locale-setting (HTTP-Request Accept-Language Header)?

落花浮王杯 提交于 2020-01-01 07:53:46
问题 i am currently trying to enable the translator in Symfony 2.0. Symfony is ignoring the Accept-Language Header variable and is using default_locale (and when that is not defined the fallback). My request looks like: Accept-Language de-DE,de;q=0.8,en-us;q=0.5,en;q=0.3 but $this->getRequest()->getLocale(); gets me en with that same request. Can somebody tell me what may be wrong? Yes, I have tried to clear the cache and deleting my cookies (omnomnom) :) 回答1: This is the expected behaviour.

How to add custom Accept-Languages to Chrome for pseudolocalization testing?

扶醉桌前 提交于 2019-12-28 08:08:35
问题 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

How to add custom Accept-Languages to Chrome for pseudolocalization testing?

佐手、 提交于 2019-12-28 08:08:11
问题 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

Which is the most seo-friendly way to detect browser language and redirect 301 to home page

北城以北 提交于 2019-12-24 16:42:59
问题 I have a multi-language page, I want to detect client browser's language then make a 301 home page or other thing. but I am not sure which way is better for seo. I do not know web spider like which one? Or other way? <?php $LG=$_SERVER['HTTP_ACCEPT_LANGUAGE']; if (preg_match('/^[zZ][hH]/', $LG)) { header("HTTP/1.1 301 Moved Permanently"); header("Location: http://mydomain.com/cn/"); exit();} //jump to chinese version else { header("HTTP/1.1 301 Moved Permanently"); header("Location: http:/

Does the order of the languages matter in the HTTP Accept-language field?

自作多情 提交于 2019-12-23 16:19:14
问题 I was wondering if the order of the actual languages in the Accept-language matters. For example, if our HTTP GET message contained the header: Accept-Language: en-us, en-gb;q=0.2, en;q=0.3, fr, fr-ch, da, fi ...would the browser prefer Traditional French (fr) over Swiss French (fr-ch) even though they both have no Relative Quality Factor q mentioned, and hence would be 1. 回答1: No, the ordering does not matter. 回答2: When I implemented this, I used a stable sort so that values with the same

Change the language of a site using a button

自闭症网瘾萝莉.ら 提交于 2019-12-13 01:14:00
问题 Hi I want as the title says change the language of the site using a button but this without altering the url mywebsite.com (Without doing mywebsite.com?lang=es ) by just changing PHP variables in this code: $xlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); if($xlang == "es") { $g_lang = "es"; } else if ($xlang == "en") { $g_lang = "en"; } else { $g_lang = "en"; } And then using this button <a class="langx" href="#"></a> Change the language without altering the url Is there a way to do

cUrl set language header

吃可爱长大的小学妹 提交于 2019-12-12 09:36:20
问题 How can I set a language header for my cURL request? e.g. now I get the homepage of facebook.com in dutch, probably because my server is in the Netherlands / default language send by headers?.. I prefer english before dutch in this case so I tried to set an httpheader in curl but I make no sense? What do I do wrong or what should I have to set? (zend notation) CURLOPT_HTTPHEADER => 'Accept-Language: en-US;q=0.6,en;q=0.4', Thanks in advance! 回答1: I arrived at this page looking for a way to

Accept Language list

时光怂恿深爱的人放手 提交于 2019-12-09 08:35:30
问题 I would like to react to the Accept_Language that a browser sends to a website. Does anybody know where I can get a reliable list of all available Accept_Languages that the browser might send to a website? Thank you very much! 回答1: IANA Language Subtag Registry page This is the official location where you will find all subtags available for use in language tags. W3 said it's the authoritative list . Plus, at the link below, there is a lot more information to be had, including descriptions and

htaccess Redirect only if the HTTP referrer does NOT equal something

≡放荡痞女 提交于 2019-12-08 01:22:31
问题 I have the following rules working to redirect chinese users to the chinese language version of the site: RewriteCond %{HTTP:Accept-Language} ^zh [NC] RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://ch.example.com/$1 [L,R=301] RewriteCond %{HTTP:Accept-Language} ^zh [NC] RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://ch.example.com/$1 [L,R=301] This works great. However, there is a link that is supposed to take them back to the english

Why does Symfony ignore the browsers locale-setting (HTTP-Request Accept-Language Header)?

耗尽温柔 提交于 2019-12-03 23:22:16
i am currently trying to enable the translator in Symfony 2.0. Symfony is ignoring the Accept-Language Header variable and is using default_locale (and when that is not defined the fallback). My request looks like: Accept-Language de-DE,de;q=0.8,en-us;q=0.5,en;q=0.3 but $this->getRequest()->getLocale(); gets me en with that same request. Can somebody tell me what may be wrong? Yes, I have tried to clear the cache and deleting my cookies (omnomnom) :) Carlos Granados This is the expected behaviour. Symfony does not by default use the Accept Language header and instead relies on the symfony