Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocaleRegion API #3027

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
adding the updated .idl documentation
srwei committed Nov 3, 2022
commit e8814c1738d69b72f219f7f0b98918c557cf4612
17 changes: 16 additions & 1 deletion specs/LocaleRegion.md
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ public CreateWebView2Controller(IntPtr parentWindow)
# API Details
```cpp
[uuid(0c9a374f-20c3-4e3c-a640-67b78a7e0a48), object, pointer_default(unique)]
interface ICoreWebView2ControllerOptions : IUnknown {
interface ICoreWebView2StagingControllerOptions : IUnknown {
/// Interface for locale region that is updated through the ControllerOptions
/// API.
/// The default region for WebView. It applies to browser UI such as
@@ -65,6 +65,21 @@ interface ICoreWebView2ControllerOptions : IUnknown {
/// If V8 cannot find any matching locale on the input value, it will default
/// to the display language as the locale.
///
/// The Windows API `GetLocaleInfoEx` can be used if the LocaleRegion value
/// is always set to match the OS region
///
/// ```cpp
/// int LanguageCodeBufferSize =
/// ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, nullptr, 0);
/// std::unique_ptr<char[]> buffer(new char[LanguageCodeBufferSize]);
/// WCHAR* w_language_code = new WCHAR[LanguageCodeBufferSize];
/// ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, w_language_code,
/// LanguageCodeBufferSize);
/// wcstombs(buffer.get(), w_language_code, LanguageCodeBufferSize);
/// delete[] w_language_code;
/// return buffer;
/// ```
///
/// The caller must free the returned string with `CoTaskMemFree`. See
/// [API Conventions](/microsoft-edge/webview2/concepts/win32-api-conventions#strings).
/// \snippet AppWindow.cpp RegionLocaleSetting