简体   繁体   English

C#WebBrowser控件全球化

[英]C# WebBrowser Control Globalization

I am making an application in C# using the WebBrowser control. 我正在使用WebBrowser控件在C#中创建应用程序。 Problem is i am not from an english speaking country and that control seams to send an english language instead of Current Culture. 问题是我不是来自讲英语的国家,而是控制缝发送了英语而不是当前的文化。

So for example, sites like google will always show up in english instead of portuguese, as it appears in IE, FF, Chrome or Opera. 因此,例如,像google这样的网站将始终以英语而不是葡萄牙语显示,因为它出现在IE,FF,Chrome或Opera中。

Is there a way to change that control's page request culture to the current system's culture, or any arbitrary culture for that matter? 有没有办法将控件的页面请求区域性更改为当前系统的区域性,或针对此问题的任意区域性?

I've tried various means to solve this problem with little success. 我尝试了各种方法来解决此问题,但收效甚微。

The Accept-Language header seems to be hard-wired to use the culture configured in the user's Internet Settings. Accept-Language标头似乎很难使用用户Internet设置中配置的区域性。 If you supply a value in the additionalHeaders parameter to WebBrowser.Navigate, this value will be overridden. 如果您在WebHeader.Navigate的AdditionalHeaders参数中提供一个值,则该值将被覆盖。

If you change this, your WebBrowser control should send the correct language. 如果更改此设置,则WebBrowser控件应发送正确的语言。

I've also found a registry setting: HKEY_CURRENT_USER/Software/Microsoft/Internet Explorer/International/AcceptLanguage 我还找到了一个注册表设置:HKEY_CURRENT_USER / Software / Microsoft / Internet Explorer / International / AcceptLanguage

Changing this registry setting should also modify the WebBrowser control's Accept-Language header. 更改此注册表设置还应该修改WebBrowser控件的Accept-Language标头。

Unfortunately in my case, I want to be able to override the setting in a particular instance of the WebBrowser control and not modify global settings which may be used by other applications. 不幸的是,对于我而言,我希望能够在WebBrowser控件的特定实例中覆盖该设置,而不希望修改其他应用程序可能使用的全局设置。 So this approach is of no use. 因此,这种方法没有用。 However, perhaps it will help you. 但是,也许会对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM