DotNetBrowser allows configuring Chromium engine with specified language (two letter code from ISO-639 e.g. "en", "de", "it", etc). The language will be used for UI text messages localization (e.g. text on the web page that's displayed when Chromium failed to load URL).


By default, Chromium engine is configured to use .NET application language that can be received from theCultureInfo.CurrentUICulture.Name property. To configure Chromium engine with .NET application language, DotNetBrowser extracts the language from theCultureInfo.CurrentUICulture.Name property and passes it to Chromium engine via the --lang Chromium switcher.


If you need to change this default behavior, then you can configure Chromium engine directly with specified language via Chromium--lang switcher. Here are examples that show how Chromium engine will display localized text on the Navigation Failed web page:


MainWindow.xaml

<Window x:Class="ChromiumLanguageSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wpf="clr-namespace:DotNetBrowser.WPF;assembly=DotNetBrowser"
        Title="MainWindow" Height="350" Width="525" >
    <Grid Name="mainLayout">
        <wpf:WPFBrowserView  Name="browserView" URL="http://123.nonexisting.url"/>
    </Grid>
</Window>


Configure Chromium with the English language (en):

C# 

MainWindow.xaml.cs

using DotNetBrowser;
using DotNetBrowser.WPF;
using System;
using System.Windows;

namespace ChromiumLanguageSample
{

   /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            BrowserPreferences.SetChromiumSwitches("--lang=en");
            InitializeComponent();
        }
    }
}

VB.NET 

MainWindow.xaml.vb

Imports DotNetBrowser

Namespace ChromiumLanguageSample
    Class MainWindow
        Inherits Window

        Sub New()
            BrowserPreferences.SetChromiumSwitches("--lang=en")
            InitializeComponent()
        End Sub
    End Class
End Namespace



Configure Chromium with the German language (de):

C# 

MainWindow.xaml.cs

using DotNetBrowser;
using DotNetBrowser.WPF;
using System;
using System.Windows;

namespace ChromiumLanguageSample
{

   /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            BrowserPreferences.SetChromiumSwitches("--lang=de");
            InitializeComponent();
        }
    }
}

VB.NET 

MainWindow.xaml.vb

Imports DotNetBrowser

Namespace ChromiumLanguageSample
    Class MainWindow
        Inherits Window

        Sub New()
            BrowserPreferences.SetChromiumSwitches("--lang=de")
            InitializeComponent()
        End Sub
    End Class
End Namespace