MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
424 stars 51 forks source link

[Feature]: Input HTML elements such as date picker should be localizable rather than rely on OS region #4339

Open tubs-coder opened 5 months ago

tubs-coder commented 5 months ago

Describe the feature/enhancement you need

For the history behind this request, please see https://github.com/MicrosoftEdge/WebView2Feedback/issues/4204.

Currently Webview2 content can be localized via many different mechanisms:

None of these mechanisms fully influence how Input HTML elements are rendered and this often falls back to the OS Region.

I would like the capability to be able to specify the locale used for all my web content including date pickers.

The scenario/use case where you would use this feature

The specific scenario/gap is with sub locales.

Configuration

Requirement

I want to launch Webview2 content that is uniformly English United States (en-US). This is for consistency across multiple physical sites.

Expected Outcome

Date/Time Pickers and other HTML components should display in the mm/dd/yyyy US format

Current Outcome

Date/Time Pickers and other HTML component will always display in the dd/mm/yyyy AU format. None of the existing mechanisms influence this.

Workaround

Unfortunately the only workaround is to avoid using Input HTML tags and to use custom web components (not ideal!)

How important is this request to you?

Impactful. My app's user experience would be significantly compromised without it.

Suggested implementation

While the spec recommends that the locale of these components should be defined by the lang attribute (https://html.spec.whatwg.org/multipage/dom.html#language), this is not how Chromium and (all?) other browsers work.

Other Chromium based browsers (such as Opera) have this as a browser setting. This seems like a good approach to me and the existing Language in ICoreWebView2EnvironmentOptions feels like the right mechanism to control this (until Chromium and other browsers drift towards the spec).

What does your app do? Is there a pending deadline for this request?

What does your app do?

The App helps teams model scheduling scenarios, data/files are shared across teams throughout the world and a consistent/configurable locale for confusing areas such as Date is required.

tubs-coder commented 2 months ago

Happy to create a basic project the exhibits the behavior if it is helpful?

srwei commented 2 months ago

Hi @tubs-coder, thanks for creating this issue. Would you mind creating a basic project with this behavior, and provide screenshot(s) of the affected locales? Thanks.