Skip to content

Commit cdf93ac

Browse files
committed
addressed comments
1 parent e8814c1 commit cdf93ac

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

specs/LocaleRegion.md

+25-10
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ language.
1414
* The intended value for `LocaleRegion` is in the format of `language[-country]` where `language` is the
1515
2-letter code from [ISO 639](https://www.iso.org/iso-639-language-codes.html) and `country` is the
1616
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.
2017

2118
# Examples
2219
```cpp
@@ -51,22 +48,36 @@ public CreateWebView2Controller(IntPtr parentWindow)
5148
```cpp
5249
[uuid(0c9a374f-20c3-4e3c-a640-67b78a7e0a48), object, pointer_default(unique)]
5350
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
5753
/// in the time/date formats. The intended locale value is in the format of
5854
/// `language[-country]` where `language` is the 2-letter code from [ISO
5955
/// 639](https://www.iso.org/iso-639-language-codes.html) and `country` is the
6056
/// 2-letter code from [ISO 3166](https://www.iso.org/standard/72482.html).
6157
///
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+
///
6262
/// Validation is done on the V8 engine to match on the closest locale
6363
/// from the passed in locale region value. For example, passing in "en_gb"
6464
/// will reflect the "en-GB" locale in V8.
6565
/// If V8 cannot find any matching locale on the input value, it will default
6666
/// to the display language as the locale.
6767
///
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:
7081
///
7182
/// ```cpp
7283
/// int LanguageCodeBufferSize =
@@ -78,15 +89,19 @@ interface ICoreWebView2StagingControllerOptions : IUnknown {
7889
/// wcstombs(buffer.get(), w_language_code, LanguageCodeBufferSize);
7990
/// delete[] w_language_code;
8091
/// return buffer;
81-
/// ```
92+
/// ```
8293
///
94+
/// ```c#
95+
/// var geographicRegion = new Windows.Globalization.GeographicRegion();
96+
/// var regionCode = geographicRegion.CodeTwoLetter;
97+
/// ```
8398
/// The caller must free the returned string with `CoTaskMemFree`. See
8499
/// [API Conventions](/microsoft-edge/webview2/concepts/win32-api-conventions#strings).
85100
/// \snippet AppWindow.cpp RegionLocaleSetting
86101
// MSOWNERS: [email protected]
87102
[propget] HRESULT LocaleRegion([out, retval] LPWSTR* locale);
88103

89-
/// Sets the `Region` property.
104+
/// Sets the `LocaleRegion` property.
90105
// MSOWNERS: [email protected]
91106
[propput] HRESULT LocaleRegion([in] LPCWSTR locale);
92107
}

0 commit comments

Comments
 (0)