Skip to content

Commit e8814c1

Browse files
committed
adding the updated .idl documentation
1 parent 3d650ce commit e8814c1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

specs/LocaleRegion.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public CreateWebView2Controller(IntPtr parentWindow)
5050
# API Details
5151
```cpp
5252
[uuid(0c9a374f-20c3-4e3c-a640-67b78a7e0a48), object, pointer_default(unique)]
53-
interface ICoreWebView2ControllerOptions : IUnknown {
53+
interface ICoreWebView2StagingControllerOptions : IUnknown {
5454
/// Interface for locale region that is updated through the ControllerOptions
5555
/// API.
5656
/// The default region for WebView. It applies to browser UI such as
@@ -65,6 +65,21 @@ interface ICoreWebView2ControllerOptions : IUnknown {
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
70+
///
71+
/// ```cpp
72+
/// int LanguageCodeBufferSize =
73+
/// ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, nullptr, 0);
74+
/// std::unique_ptr<char[]> buffer(new char[LanguageCodeBufferSize]);
75+
/// WCHAR* w_language_code = new WCHAR[LanguageCodeBufferSize];
76+
/// ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, w_language_code,
77+
/// LanguageCodeBufferSize);
78+
/// wcstombs(buffer.get(), w_language_code, LanguageCodeBufferSize);
79+
/// delete[] w_language_code;
80+
/// return buffer;
81+
/// ```
82+
///
6883
/// The caller must free the returned string with `CoTaskMemFree`. See
6984
/// [API Conventions](/microsoft-edge/webview2/concepts/win32-api-conventions#strings).
7085
/// \snippet AppWindow.cpp RegionLocaleSetting

0 commit comments

Comments
 (0)