@@ -14,9 +14,6 @@ language.
14
14
* The intended value for ` LocaleRegion ` is in the format of ` language[-country] ` where ` language ` is the
15
15
2-letter code from [ ISO 639] ( https://www.iso.org/iso-639-language-codes.html ) and ` country ` is the
16
16
2-letter code from [ ISO 3166] ( https://www.iso.org/standard/72482.html ) .
17
- * By default, the ` LocaleRegion ` will be set as the value for the Limited option in the browser.
18
- That means that if the OS region and the display language share the same language code,
19
- like 'en-GB' and 'en-US', the value will be set to the OS region.
20
17
21
18
# Examples
22
19
``` cpp
@@ -51,22 +48,36 @@ public CreateWebView2Controller(IntPtr parentWindow)
51
48
``` cpp
52
49
[uuid(0c9a374f-20c3-4e3c-a640-67b78a7e0a48), object, pointer_default(unique)]
53
50
interface ICoreWebView2StagingControllerOptions : IUnknown {
54
- /// Interface for locale region that is updated through the ControllerOptions
55
- /// API.
56
- /// The default region for WebView. It applies to browser UI such as
51
+ /// The default region for the WebView2. It applies to JavaScript API
52
+ /// Intl.DateTimeFormat() which affects string formatting like
57
53
/// in the time/date formats. The intended locale value is in the format of
58
54
/// ` language[-country] ` where ` language ` is the 2-letter code from [ ISO
59
55
/// 639] ( https://www.iso.org/iso-639-language-codes.html ) and ` country ` is the
60
56
/// 2-letter code from [ ISO 3166] ( https://www.iso.org/standard/72482.html ) .
61
57
///
58
+ /// This property will update the environment creation. This is global and immutable,
59
+ /// so changes will not be reflected in the existing webviews. They will need to closed
60
+ /// and reopened in order to see the changes reflected from using the new creation environment.
61
+ ///
62
62
/// Validation is done on the V8 engine to match on the closest locale
63
63
/// from the passed in locale region value. For example, passing in "en_gb"
64
64
/// will reflect the "en-GB" locale in V8.
65
65
/// If V8 cannot find any matching locale on the input value, it will default
66
66
/// to the display language as the locale.
67
67
///
68
- /// The Windows API ` GetLocaleInfoEx ` can be used if the LocaleRegion value
69
- /// is always set to match the OS region
68
+ /// The default value for LocaleRegion will be depend on the WebView2 language
69
+ /// and OS region. If the language portions of the WebView2 language and OS Region
70
+ /// match, then it will use the OS region. Otherwise, it will use the WebView2
71
+ /// language.
72
+ /// | ** OS Region** | ** WebView2 Language** | ** Default WebView2 LocaleRegion** |
73
+ /// |-----------|-------------------|-------------------------------|
74
+ /// | en-GB | en-US | en-GB |
75
+ /// | es-MX | en-US | en-US |
76
+ /// | en-US | en-GB | en-US |
77
+ /// The default value can be reset using the empty string.
78
+ ///
79
+ /// Use OS specific APIs to determine the OS region to use with this property
80
+ /// if you want to match the OS. For example:
70
81
///
71
82
/// ```cpp
72
83
/// int LanguageCodeBufferSize =
@@ -78,15 +89,19 @@ interface ICoreWebView2StagingControllerOptions : IUnknown {
78
89
/// wcstombs(buffer.get(), w_language_code, LanguageCodeBufferSize);
79
90
/// delete[ ] w_language_code;
80
91
/// return buffer;
81
- /// ```
92
+ /// ```
82
93
///
94
+ /// ```c#
95
+ /// var geographicRegion = new Windows.Globalization.GeographicRegion();
96
+ /// var regionCode = geographicRegion.CodeTwoLetter;
97
+ /// ```
83
98
/// The caller must free the returned string with ` CoTaskMemFree ` . See
84
99
/// [ API Conventions] ( /microsoft-edge/webview2/concepts/win32-api-conventions#strings ) .
85
100
/// \snippet AppWindow.cpp RegionLocaleSetting
86
101
87
102
[ propget] HRESULT LocaleRegion([ out, retval] LPWSTR* locale);
88
103
89
- /// Sets the ` Region ` property.
104
+ /// Sets the ` LocaleRegion ` property.
90
105
91
106
[ propput] HRESULT LocaleRegion([ in] LPCWSTR locale);
92
107
}
0 commit comments