Intl.NumberFormat fails to format volume units
Categories
(Core :: JavaScript: Internationalization API, defect, P3)
Tracking
()
People
(Reporter: er.yd.dev, Unassigned)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0
Steps to reproduce:
Ran new Intl.NumberFormat("en-GB", { style: 'unit', unit: 'liter' }).format(1) in console for all units reported by Intl.supportedValuesOf("unit").
Actual results:
fluid-ounce, gallon, liter, milliliter fail regardless of unitDisplay value. They fail with error message Uncaught Error: internal error while computing Intl data. It seems that what the units have in common is that they're the only volume units that are supported.
Expected results:
The units should be formatted correctly as before. Also, deciliter is missing.
The error has been confirmed to occur on Firefox 147.0 and Firefox Developer Edition 147.0b9. Other versions have not yet been tested.
Comment 1•5 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::JavaScript: Internationalization API' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•2 days ago
|
||
This is strange, because we actually test that all CLDR available units which are well-formed according to ECMA-402 are supported: https://searchfox.org/firefox-main/source/js/src/tests/non262/Intl/NumberFormat/unit-well-formed.js.
Can you provide additional information about your system (OS, CPU, locale)? Are you using FIrefox packages from Mozilla or from your OS package system?
Is there a way to find error logs to share as well? The error message is a bit cryptic.
Using Firefox from NixOS packages: https://search.nixos.org/packages?channel=unstable&show=firefox&query=firefox
Can confirm it affects Firefox 147.0.1 and Firefox Developer Edition 148.0b3 also.
System info
Operating System: NixOS 26.05
KDE Plasma Version: 6.5.5
KDE Frameworks Version: 6.22.0
Qt Version: 6.10.1
Kernel Version: 6.18.6 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 32 GiB of RAM (31,3 GiB usable)
Graphics Processor: AMD Radeon RX 7900 XT
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C84
System Version: 1.0
Comment 4•2 days ago
|
||
The internal error while computing Intl data error is thrown when an error code was returned after calling an ICU4C library function. So there's most likely some issue involving ICU. Does Nix use the system ICU version instead of the ICU sources included in the Firefox tree? If they use the system ICU version, they may be missing some patches to workaround bugs in the ICU 78 release. For ICU 78.2, we had to add four patches:
- https://searchfox.org/firefox-main/source/intl/icu-patches/bug-2000225-ICU-23262-missing-resource-error-for-iso8601-era.diff
- https://searchfox.org/firefox-main/source/intl/icu-patches/bug-2000225-ICU-23264-increase-measure-unit-capacity.diff
- https://searchfox.org/firefox-main/source/intl/icu-patches/bug-2002735-ICU-23277-coptic-single-era.diff
- https://searchfox.org/firefox-main/source/intl/icu-patches/bug-2010411-patch-cldr-hv-en-root.diff
There was another patch for the initial ICU 78.1 release, but that one could be removed when ICU 78.2 was released:
I guess the error you're seeing is because of https://unicode-org.atlassian.net/browse/ICU-23264. The Nix packages for ICU probably need to be updated to include similar patches like the ones we're using in FIrefox.
Updated•2 days ago
|
I must admit I have no idea. I don't see ICU mentioned in the Nix source: https://github.com/NixOS/nixpkgs/tree/nixos-unstable/pkgs/applications/networking/browsers/firefox
So I assume it uses the system version in that case, but I don't know how to verify. Maybe the maintainers of the package would know? They are listed in the package entry details https://search.nixos.org/packages?channel=unstable&show=firefox&query=firefox
Is it likely the error will be fixed in upstream ICU anytime soon?
Comment 6•22 hours ago
|
||
(In reply to er.yd.dev from comment #5)
I must admit I have no idea. I don't see ICU mentioned in the Nix source: https://github.com/NixOS/nixpkgs/tree/nixos-unstable/pkgs/applications/networking/browsers/firefox
IIUC, the Nix "firefox" package depends on the "buildMozillaMach" package, which sets --with-system-icu:
- https://github.com/NixOS/nixpkgs/blob/88bbdb44d03832ca040831ca9e943eadf8cd0041/pkgs/applications/networking/browsers/firefox/packages/firefox.nix#L7
- https://github.com/NixOS/nixpkgs/blob/88bbdb44d03832ca040831ca9e943eadf8cd0041/pkgs/build-support/build-mozilla-mach/default.nix
So I assume it uses the system version in that case, but I don't know how to verify. Maybe the maintainers of the package would know? They are listed in the package entry details https://search.nixos.org/packages?channel=unstable&show=firefox&query=firefox
I've filed https://github.com/NixOS/nixpkgs/issues/484824, hopefully that helps to fix this issue on the Nix side.
Is it likely the error will be fixed in upstream ICU anytime soon?
I'm not sure if there's going to be another ICU patch release, so maybe the bugs won't get fixed before ICU 79, which should get released around April.
Comment 7•17 hours ago
|
||
We're going to use the vendored ICU library as tracking so many patches across various buildMozillaMach consumers is a nuisance.
Description
•