Page 1 of 1

Accept-Language does not work

PostPosted: Fri Mar 20, 2020 3:36 pm
by sandmeteor
Hi,
Does anyone can confirm that settings Accept-Language work in one of the latest version of CEF?
After update from cef 75 to 79 and 80 it stopped working. I did not changed my codes.

Code: Select all
cef_return_value_t CefHandler::OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, CefRefPtr<CefRequestCallback> callback)
{
  CefRequest::HeaderMap hdrMap;
  request->GetHeaderMap(hdrMap);
 
  hdrMap.insert(std::make_pair("Accept-Language", _params.language.toUtf8()));
 
  request->SetHeaderMap(hdrMap);

  return RV_CONTINUE;
}

I can set any custom headers but can not change Accept-Language.

Re: Accept-Language does not work

PostPosted: Mon Oct 05, 2020 2:21 am
by ndesktop
Works for me in 4147.

Re: Accept-Language does not work

PostPosted: Mon Oct 05, 2020 3:31 am
by amaitland

Re: Accept-Language does not work

PostPosted: Mon Nov 09, 2020 4:42 am
by ssaraf
I tried the solution provided here https://bitbucket.org/chromiumembedded/ ... ault-en-us

Setting the accept-language-list using cefsettings like
(&m_cefSettings.accept_language_list).FromWString(L"en-US, ja"); passing all the languages supported by the app overrides the header like
accept.PNG
accept.PNG (18.88 KiB) Viewed 7205 times


which is different from how it was before the commit (https://bitbucket.org/chromiumembedded/ ... e6f9332e87) in version 3904 like
a1.PNG
a1.PNG (11.51 KiB) Viewed 7205 times


Are applications supposed to be setting this header value using accept-language-list to any other value other than english when it is overridden from the application?

Is the Accept-Language header supposed to be set by the browser based on whatever your system language is set to?

Is there something I am missing out to override the header value?

Re: Accept-Language does not work

PostPosted: Mon Nov 09, 2020 12:21 pm
by magreenblatt
@ssaraf The behavior in the first image looks correct. You can set CefSettings.accept_language_list if you want to override the default en-US.

Re: Accept-Language does not work

PostPosted: Mon Mar 04, 2024 6:51 am
by ssaraf
If we use CefSettings.accept_language_list in the latest versions we see half app rendered in the language set and half in the default en-US language. How can we set using language::prefs::kSelectedLanguages ?