Questions related to the Accept Language request header field of HTTP
Questions tagged [http-accept-language]
99 questions
0
votes
0 answers
django locale can't translate depend on accept-language
Here is my settings
LANGUAGES = (
('zh_CN', u'简体中文'),
('en-us', u'English'),
)
LANGUAGE_CODE = 'en-us'
USE_I18N = True
USE_L10N = True
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
…

月牙天冲
- 59
- 3
0
votes
0 answers
How to set culture in Web API 2 compatible with async/await?
I have a REST service that generates string messages with currencies and dates, so I need the right culture to be set up. Messages are produced in different steps that runs between asynchronous operations.
Web API will set the culture coming in the…

vtortola
- 34,709
- 29
- 161
- 263
0
votes
1 answer
JAX-RS Accept header param compatibality
If the Accept header param string has multiple media types that are acceptable such as:
text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
How to find if the media type is compatible with a single MediaType object?
If the Accept header contains a…

Talespin_Kit
- 20,830
- 29
- 89
- 135
0
votes
3 answers
Merge lines which don't match a regex
I have a file which contains logs from the web; a simplified version of it is as follows:
en-GB,en-US;q=0.8,en jsdjpksdkskd;lkskd;
en-GB,en-US;q=0.8,en jsdjpksdkskd;lkskd;
en-GB,en-US;q=0.8,en …

Amine Jaidi
- 55
- 4
0
votes
0 answers
Accept-Language of CURLOPT_HTTPHEADER does not work
cUrl set language header
I was trying to get the source code of Facebook's homepage by using cURL, but it was all Chinese due to the location of my server host. For this reason, I added Accept-Language of CURLOPT_HTTPHEADER to change the language…

Banana Code
- 759
- 1
- 12
- 28
0
votes
1 answer
Content-Language for multilingual API
How should I set up my API so that it can return resources in all languages instead of just one language?
Example of response:
{
"id": 1,
"name_en-CA": "Routes",
"name_fr-CA": "Circuits",
"active": true,
"type": "A",
"effective_from":…

rink.attendant.6
- 44,500
- 61
- 101
- 156
0
votes
2 answers
PHP: If URL doesn't have parameter, redirect to URL with it
How can I redirect requests to http(s)//domain.tld/WHATEVER.php to http(s)//domain.tld/WHATEVER.php?lang= in PHP?
So, if you visit a URL already with a lang parameter, fine, do nothing. If the…

MultiformeIngegno
- 6,959
- 15
- 60
- 119
0
votes
1 answer
C# - changing Registry settings doesn't work
I tried to change the OS's language preferences.
And indeed, when I go to Control Panel I see my changes.
However, it doesn't really change something.
Only when I go manually and change it in the Control Panel it changes it.
Those settings will…

M. Jason
- 11
- 4
0
votes
1 answer
htaccess language detection efficient code
On my website I'd love to redirect visitors who speak italian (their language browser is italian) to /it/ and all other languages to /en/
I come up with the following code:
#redirect to /it for italian lang
RewriteCond %{HTTP_HOST} ^domain\.net$…

Ivan Climb Messina
- 11
- 2
0
votes
1 answer
HTTP header `Accept-Language` : Should servers use it strictly or just as a preference?
I wonder how servers should use HTTP header "Accept Language" in case the server has the requested resource but not in the language specified. Should the server return an error of any kind (404, or "resource not found", etc) or success but resource…

nacho4d
- 43,720
- 45
- 157
- 240
0
votes
1 answer
Grails i18n: Setting Accept-Language header
According to Grails' internationalization doc, i18n is accomplished by either:
Setting an Accept-Language header in the request; or
Tacking on a lang query string param
I'm opting for the former, because its more HTTP compliant and, frankly, I…

smeeb
- 27,777
- 57
- 250
- 447
0
votes
1 answer
will Accept Http Headers digest any other formats other than the one specified?
Per my understanding:
the Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the…

eagertoLearn
- 9,772
- 23
- 80
- 122
0
votes
2 answers
php multilanguage: language redirecting
I have been searching for a while, but can't seem to find the correct way to achieve this:
For creating a multilanguage(2) website, I was thinking of using the following folder structure:
DOMAIN
www.domain.com/index.php
NL-folder
…

PSZ_Code
- 1,015
- 10
- 29
0
votes
1 answer
.htaccess language switch with path
I have the following rule:
RewriteRule ^(de|en)/(.*)$ index.php [L]
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^$ /de/ [L,R=301]
RewriteRule ^$ /en/ [L,R=301]
domain.tld redirects to domain.tld/{lng}/
How to let domain.tld/news…

DjangoSi
- 395
- 2
- 4
- 16
0
votes
2 answers
Tower : Localizing with an unanticipated dictionary
I'm working with the Tower library for i18n and l10n in my web application.
I have the problem of having to localize "just-in-time", i.e with an unanticipated dictionary, and in particular unanticipated supported locales.
I receive HTTP request,…

Valentin Waeselynck
- 5,950
- 26
- 43