Closed Bug 1681357 Opened 5 years ago Closed 5 years ago

[ja] Word order of date/time is broken in ja build on Windows10 Japanese languages

Categories

(Core :: Internationalization: Localization, defect)

Firefox 85
Desktop
Windows 10
defect

Tracking

()

RESOLVED FIXED
85 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox83 --- unaffected
firefox84 --- unaffected
firefox85 + fixed

People

(Reporter: alice0775, Assigned: dminor)

References

(Regression)

Details

(Keywords: intl, nightly-community, regression)

Attachments

(3 files)

[Tracking Requested - why for this release]: Word order of date/time is broken in ja build

Windows10 Japanese language.

Steps to reproduce:

  1. Start Nightly85 ja build
  2. Open Library > Import and Backup > Restore

Steps to reproduce:

  1. Start Nightly85 ja build
  2. Open any page (e.g. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions )
  3. Ctrl+I Page Info
  4. See Modified: row

Actual Results:
Nightly85.0a1(Buildid 20201208094500): 水曜日, 09 12月 2020 02:54:10

Expected Results:
Firefox83.0: 2020年12月9日 2:53:15

Regression window:
(though, the good build renders garbled characters, see Bug 1681251)
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=eeee2b548e51eaad256f018fadaf1cc10e55c479&tochange=1a164819adefcdb42bdba8a24976b62ee8d03c80

Has Regression Range: --- → yes
Has STR: --- → yes
Regressed by: 1635561

Evaluate the following js in Browser console

(new Services.intl.DateTimeFormat(undefined, {
    dateStyle: "long",
    timeStyle: "long",
  })).format(new Date("2020-12-08 21:00:05"));

Latest Nightly ja build returns: "火曜日, 08 12月 2020 21:00:05"
Firefox83.0 ja build returns "2020年12月8日 21:00:05"

The same thing is happening in English. (I'm testing in Thunderbird, but it will be the same.)

What was "8 December 2020, 21:00:05 GMT+13" is now "2020 December 8 21:00:05 GMT+13".

Blocks: 1681306

The regression is caused by the change to how we handle undefined as a locale value.

Before bug 1635561, we would run the argument via a helper function that would populate it from regionalPrefsLocales. Now, we pass the undefined through expecting the DefaultLocale in JS Context to pick it up (DefaultLocale is also set to regionalPrefsLocales).

The issue is that in case of DateTimeFormat, when used with dateStyle/timeStyle we first call OsPreferences asking for the best pattern for the style. And we pass the locale based on the argument passed to the constructor.

In case the argument is undefined, we negotiate it against supportedLocalesOf, still get nothing, and then call:

osPrefs.getDateTimePattern(
  osPrefs.dateTimeFormatStyleLong,
  osPrefs.dateTimeFormatStyleLong,
  undefined
);

which returns "y MMMM d h:mm:ss a z".

Two ways to fix it that I can see are:

  1. Fix OSPreferences to use regionalPrefsLocales if the locales argument is empty
  2. Fix the MozIntl to do:
       class MozDateTimeFormat extends DateTimeFormat {
-        constructor(locales, options, ...args) {
+        constructor(locales = Services.locale.regionalPrefsLocales, options, ...args) {
           let resolvedLocales = DateTimeFormat.supportedLocalesOf(locales);

The former feels broader, but the latter is easier. Your call Dan.

Flags: needinfo?(dminor)

Thanks for investigating!

Assignee: nobody → dminor
Flags: needinfo?(dminor)
Pushed by dminor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/916ecdd8cf9a Use regional prefs locale if locale is not specified in GetDateTimePattern; r=zbraniecki
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: