简体   繁体   English

如何更改Web浏览器控件的默认语言

[英]How to change default language of Web Browser control

I have a trouble with a WPF application. 我对WPF应用程序有麻烦。 The application uses a web browser to display a certain page (Internet Explorer). 该应用程序使用Web浏览器显示特定页面(Internet Explorer)。 The problem is the inner browser of the application shows the page always with a language configuration in English, regardless of the configuration of the browser. 问题是应用程序的内部浏览器始终以英语配置语言显示页面,而与浏览器的配置无关。 When Im testing the application, It takes the language features of the browser; 我在测试应用程序时会采用浏览器的语言功能; but before it compiles it changes and uses English language. 但在编译之前会进行更改并使用英语。

Is there a way to change the default language? 有没有办法更改默认语言? How can I set it to use the language defined in the browser? 如何设置它以使用浏览器中定义的语言?

I don't understand fine your problem, but WPF is known that ignores the "culture". 我不明白您的问题,但众所周知WPF忽略了“文化”。 I solve with this trick: 我用这个技巧解决:

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
    }

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

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