Questions tagged [http-accept-language]

Questions related to the Accept Language request header field of HTTP

99 questions
2
votes
2 answers

Headless chrome does not send Accept-Language header

In testing headless chrome I have noticed that it does not transmit the Accept-Language header entry. I have confirmed that it does get sent when there is a visible browser window. Is there a reason for this and does chrome have an option to…
Matt W
  • 11,753
  • 25
  • 118
  • 215
2
votes
1 answer

How to fake HTTP_ACCEPT_LANGUAGE in RSpec controller tests?

I recently added some new code to a before_action in my ApplicationController: class ApplicationController < ActionController::Base before_action :set_locale def set_locale I18n.locale = (session[:locale] || params[:locale] ||…
Tintin81
  • 9,821
  • 20
  • 85
  • 178
2
votes
1 answer

Honour the locale requested in the HTTP request using JAX RS

Im trying to find a way to honour the locale for the response depending on the Accept-Language header on the request. Im using Jersey implementation. This would be for the Restful side of the application. We already have it covered for the…
allegjdm93
  • 592
  • 6
  • 24
2
votes
1 answer

HtmlUnit: Request website from server in a specific language

I am looking for a clean/simple way in HtmlUnit to request a webpage from a server in a specific language. To do this i have been trying to request "bankofamerica.com" for their homepage in spanish instead of english. This is what i have done so…
Chiseled
  • 2,280
  • 8
  • 33
  • 59
2
votes
1 answer

Http web request Accept and Expect difference

I have been writing a C# program to deal with and send web requests and they seem to be working as intended, however I have in my code the following two headers within my HttpWebRequest: request.Accept = "application/xml"; request.Expect =…
Ben Maxfield
  • 635
  • 7
  • 21
2
votes
1 answer

htaccess Redirect only if the HTTP referrer does NOT equal something

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 ^(.*)$…
1
vote
2 answers

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

I have a multi-languagepage, 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?
cj333
  • 2,547
  • 20
  • 67
  • 110
1
vote
0 answers

How to react to a malformed Accept-Language header?

How should a server react to a malformed Accept-Language header that doesn't conform to RFC 9110? Should it return a 400 Bad Request or should it ignore the header? I would tend to return a 400 error, but since it is just a preference, maybe it…
1
vote
1 answer

A list of "language_LOCALE" as well as accepted languages by country?

I'm looking for a list of countries with their main language(s) as well as Accept-Languages ones. For instance: { "south africa": { country_code: za, lang: en_ZA, accept_languages: [en_ZA, zu_ZA, af_ZA] }, "....." } Is there any…
1
vote
1 answer

Requesting JSON file with `Accept: application/json` giving `resource cannot be displayed` error

I'm trying to fetch a JSON file from a well-known endpoint (json.schemastore.org) using @actions/http-client. I'm getting an error with that client, and the same error trying the request with cURL: $ curl --header "Accept: application/json"…
webstackdev
  • 850
  • 15
  • 23
1
vote
0 answers

PHP how to get full names form month, day in language from browser

I want to show the names of days and month in the language the browser provides. So I can set the language using setlocale, like : setlocale(LC_ALL, 'nl_NL') Then the names are all in dutch. And I can get the browser language with:…
1
vote
1 answer

Notranslate for some languages

I have a website which I manually translated in five languages, adding the button to choose the preferred one. My problem is that sometimes Chrome offers a Translate this page option for the user's language or, depending on the settings,…
user13442212
1
vote
0 answers

$_SERVER['HTTP_ACCEPT_LANGUAGE'] behaves as static PHP

I'm trying to make a multilingual page, my intention is to redirect the user to the specific page depend on his language (in case the cookie is not setup if the cookie exists because the user selected previously the language I'll ignore this block)…
1
vote
1 answer

Getting language/country name from accept-language in Ruby on Rails

I'm attempting to gather some analytics based off of the user's accept-language header. It would be very helpful to turn "en-US,en;q=0.8" into English (United States). The only way I've really seen is using I18n and putting the name in the yaml…
Tom Prats
  • 7,364
  • 9
  • 47
  • 77
1
vote
1 answer

What is wrong when i try to post String with scandinavian characters from Android to Php, like ÅÄÖ

I can't find any reason why my scandinavian characters passed to php isn't shown and stored correctly. When I use my web application, scandinavian characters works correctly with php and database. If i write message to database from webapp and load…
EspeH
  • 1,308
  • 2
  • 16
  • 34