Using CefSharp.Wpf, you are creating a WPF application that displays web pages.
I tried to change the CefSharp Locale to Japanese, and I set it to Locale and LocalesDirPath in CefSettings as follows, but I cannot change it to the default en-US.
CefSettings settings=newCefSettings();
settings.Locale="ja-JP";
settings.LocalesDirPath=System.AppDomain.CurrentDomain.BaseDirectory+"locales";
Also, I tried to add Accept-Language to Header by referring to the following site, but when I checked the contents of Header after adding it, Accept-Language was not added to Header.
https://github.com/cefsharp/CefSharp/issues/231
public CefReturnValue OnBeforeResourceLoad (IWebBrowser browser, IRrequest request, pool isMainFrame)
{
request.Headers.Add("Accept-Language", "ja-JP";
for (inti=0;i<request.Headers.Count;i++)
{
// Accept-Language settings are not included
Console.WriteLine(request.Headers[i].ToString());
}
return CefReturnValue.Continue;
}
CefSharp.Wpf is using version 41 from NuGet in Visual Studio 2015.
The operating system is Windows 8.1 64-bit.
If anyone understands, please take good care of me.
I checked CefSharp's latest CefSettings.h and found that
virtual property String^AcceptLanguageList
was added.CefSharp of V41.0.0 obtained from NuGet has not been implemented yet, so it has not been verified to work, but I think that setting this up will probably change the locale.
c# wpf
I solved myself.
In the latest CefCharp 57.0.0, by executing the following code for the ChromiumWebBrowser instance instead of CefSettings, we were able to change the language to Japanese and change the website display to Japanese.
cefbrowser.BrowserSettings.AcceptLanguageList="ja-JP";
I didn't know how to do it myself, so I searched and found myself here
settings.AcceptLanguageList="ja-JP"
settings.Locale="ja"
I was able to change the language context menu to Japanese above.
© 2024 OneMinuteCode. All rights reserved.