Accept-Language not working

Think CEF could benefit from a new feature or capability? Discuss CEF feature requests here.

Accept-Language not working

Postby mauro » Fri Nov 11, 2016 6:15 am

I'm using CHEF version 45


I set

ChromiumWB.BrowserSettings.AcceptLanguageList = "it-IT";
ChromiumWB.RequestHandler = new RequestHandler();

and then i ridefine

RequestHandler

class RequestHandler : IRequestHandler
{


public bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect)
{
return false;
}



public bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture)
{
return false;
}


public bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url)
{
return false;
}



public bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, IRequestCallback callback)
{
return true;
}



public bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback)
{
return false;
}



public CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback)
{
var headers = request.Headers;
headers.Add("Accept-Language", "it-IT");
request.Headers = headers;

return CefReturnValue.Continue;
}

public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
{
return false;
}

public void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath)
{

}

public void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status)
{

}



public void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser)
{

}

public void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, ref string newUrl)
{

}

public bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response)
{
return false;
}
}



but i see context menu (right mouse botton) in english

Any suggest?
mauro
Newbie
 
Posts: 4
Joined: Fri Nov 11, 2016 6:10 am

Re: Accept-Language not working

Postby magreenblatt » Fri Nov 11, 2016 11:25 am

Context menu language is controlled by CefSettings.locale. See documentation on that parameter.
magreenblatt
Site Admin
 
Posts: 9839
Joined: Fri May 29, 2009 6:57 pm

Re: Accept-Language not working

Postby mauro » Mon Nov 14, 2016 3:10 am

I use

CefSettings set = new CefSettings();
set.Locale = "it-IT";
CefSharp.Cef.Initialize(set);


it works fine

thanks
mauro
Newbie
 
Posts: 4
Joined: Fri Nov 11, 2016 6:10 am

Re: Accept-Language not working

Postby mauro » Mon Nov 14, 2016 3:16 am

To add a new menu' item on the right mouse?


I have to redifine IContextMenuHandler??


If I want to call CTRL SHIFT V when can I do?

thanks
mauro
Newbie
 
Posts: 4
Joined: Fri Nov 11, 2016 6:10 am

Re: Accept-Language not working

Postby magreenblatt » Mon Nov 14, 2016 9:56 am

mauro wrote:To add a new menu' item on the right mouse?


I have to redifine IContextMenuHandler??


If I want to call CTRL SHIFT V when can I do?

thanks

You should ask on a support forum for CefSharp.
magreenblatt
Site Admin
 
Posts: 9839
Joined: Fri May 29, 2009 6:57 pm


Return to Feature Request Forum

Who is online

Users browsing this forum: No registered users and 2 guests