CoreWebView2ControllerOptions.LocaleRegion Property

Definition

Manages the value of the controller's locale region.

public string LocaleRegion { get; set; }
member this.LocaleRegion : string with get, set
Public Property LocaleRegion As String

Property Value

Remarks

The LocaleRegion property is to specify the default locale region. It sets the default locale for all Intl JavaScript APIs and other JavaScript APIs that depend on it, namely Intl.DateTimeFormat() which affects string formatting like in the time/date formats.The intended locale value is in the format of BCP 47 Language Tags. More information can be found from IETF BCP47. The default value for LocaleRegion will be depend on the WebView2 language and OS region. If the language portions of the WebView2 language and OS region match, then it will use the OS region. Otherwise, it will use the WebView2 language.

OS RegionWebView2 LanguageDefault WebView2 LocaleRegion
en-GBen-USen-GB
es-MXen-USen-US
en-USen-GBen-US
You can set the LocaleRegion to the empty string to get the default LocaleRegion value. Use OS specific APIs to determine the OS region to use with this property if you always want to match with the OS region. For example:
CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
return cultureInfo.Name

Applies to