toLocaleTimeString not using android system locale settings
Reported by
karl.wig...@gmail.com,
Oct 16
|
|||||||
Issue descriptionDevice name: Android 9.0 (Google Play) Emulator Image Android version: 9.0 WebView version (from system settings -> Apps -> Android System WebView): Chrome Webview, at least since v66 Application: WebView Browser Tester Application version: URL: https://dachenstein.at/timestamptest.html Steps to reproduce: (1) Set the device to German Language and using 24h Clock (2) Open the document in WebView Browser Tester Expected result: First and second line in the resulting document should be the same. Ie the current time formatted in a 24h clock, for instance "17:38:32", third line should show the system locale (for instance "de-DE") Actual result: First line is formatted using "en" locale, regardless of system settings, ie "5:38:32 PM". Second line is formatted using the correct locale "17:38:32". Third line shows the system locale (for instance "de-DE") The test site shows the bug using `new Date().toLocaleTimeString()` for the first line `new Date().toLocaleTimeString(navigator.language)` for the second line The same site works as expected if opened in Google Chrome on the same device with the same settings.
,
Oct 17
@ karl.wiggisser: On testing in chrome browser with webview version as #69.0.3497.100 observing 17:38:32 on both first and second line. Could you please provide sample apk to check this step-2. Screencast would help in further triaging of this issue. Thanks!
,
Oct 17
,
Oct 17
@chelamcherla@chromium.org Thanks for your answer .. Yes, it works in Chrome itself, but not in apps which use a webview. Attached please find a simple apk, which only consists of a webview. On start the testurl is loaded. The app is built as debug and the webview is also inspectable via chrome. MinTargetVersion 19, CompileTargetVersion 28 Also find attached a screenshot how this looks on my device (HTC 11 life, Oreo 8.1 (android one)) As you can see, the device clock in the statusbar is set to 24h, the navigator locale is set to de-AT, but nonetheless, toLocaleTimeString returns a en-US formatted string.
,
Oct 17
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 17
This issue is also reproducible with all of the later virtual images provided by the Android SDK. I tried for API 26, 27, and 28. So if you setup a virtual device with one of these images and switch to german language, you can open the WebView Shell app provided by Google and load the given url. Please see attached sceenshot.
,
Oct 17
Please see also the attached screencast on a freshly setup emulator image (Android Pie) using the default Chrome 66, which comes with this image. First I open the testsite with default (en-US) settings. After the system language is changed to german and the english language is completely removed from the settings, the WebView accepts german as navigator.locale, but does not use this locale for formatting toLocaleTimeString(). The behaviour also remains after a cold reboot of the image.
,
Oct 18
Tested the issue in Android and able to reproduce the issue. Steps Followed: 1. Changed language to German 2. Opened attached apk file and observed difference in first and second line. Attaching screencast for reference. Chrome versions tested: 64.0.3240.0, 72.0.3584.0 OS: Android 8.0.0 Android Devices: Nexus 6p Observations: 1. From webview version 60 to 63 apk closed immediately on opening 2. This issue reproducible from Webview 64 onwards. As this issue is seen from M-64, considering this issue as Non-Regession issue and marking as Untriaged. Thanks!
,
Oct 19
Thanks for the report. It's a good find. Looks like this is the bug in multiprocess webview which shipped in Android 8. We fail to set the icu default locale in the renderer process, which is what toLocaleTimeString() uses if no locale is passed in. Fix: https://chromium-review.googlesource.com/c/chromium/src/+/1292396
,
Oct 19
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/13d3a82271aff7c6476afab4d4ab8dca7eb02dce commit 13d3a82271aff7c6476afab4d4ab8dca7eb02dce Author: Bo Liu <boliu@chromium.org> Date: Fri Oct 19 23:22:02 2018 aw: Set icu locale in renderers Bug: 895871 Change-Id: Idb6d382891affa99a4976e3e8b83efd1b437e5b6 Reviewed-on: https://chromium-review.googlesource.com/c/1292396 Reviewed-by: Changwan Ryu <changwan@chromium.org> Commit-Queue: Bo <boliu@chromium.org> Cr-Commit-Position: refs/heads/master@{#601353} [modify] https://crrev.com/13d3a82271aff7c6476afab4d4ab8dca7eb02dce/android_webview/lib/aw_main_delegate.cc
,
Oct 19
Fix will be in M72
,
Nov 5
Verified on latest 72 on Nexus 6P/OPM1.180608.001, issue mentioned in #0 is no longer reproducible ie First and second line in the resulting document should be the same. Ie the current time formatted in a 24h clock,
,
Nov 26
|
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by chelamcherla@chromium.org
, Oct 17