简体   繁体   中英

How to change default language of Web Browser control

I have a trouble with a WPF application. The application uses a web browser to display a certain page (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". 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)));
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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