Git Product home page Git Product logo

Comments (3)

Josh-Cena avatar Josh-Cena commented on June 21, 2024

There are two things wrong here:

  1. numberingSystem should be an option of the constructor, not an option of format.
  2. The only way to test whether Intl supports an option is to query resolvedOptions. Otherwise, the output may simply be due to lack of data.

Here's the output:

image

Therefore Firefox 75 does support numberingSystem. It's just that ar-EG data did not have the nu-latn combination.

from browser-compat-data.

EdgarPl avatar EdgarPl commented on June 21, 2024
  1. My apologies, I've corrected the screenshot in testing steps to match the actual steps used.
  2. I see, that makes sense. Is there any way to detect which numberingSystems are supported beyond checking the resolved options after trying to apply them?
    Locale accessor numberingSystems returns ["arab"] on browsers that resolve the numberingSystem: "latn" option which seems to me like it contradicts the notes here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#numberingsystem
    Win/Chrome 125:
    Screenshot 2024-06-12 160604

from browser-compat-data.

Josh-Cena avatar Josh-Cena commented on June 21, 2024

@EdgarPl

Locale#numberingSystems returns the list of numbering systems that are commonly used in the locale. It doesn't necessarily mean the formatter only supports using those particular combinations (I could be wrong but that's my interpretation). When the doc says "For a list of supported numbering system types" it means to refer to the complete table for all values that are considered valid.

Is there any way to detect which numberingSystems are supported beyond checking the resolved options after trying to apply them?

I'm not sure either, as I'm not an expert on the CLDR data format. In fact, I believe it may be a non-issue in the latest browser version, because the data uses templates that gets filled in with any numbering system you want. For example, ar-EG with the hanidec (Positional decimal system using Chinese number ideographs as digits) numbering system is an obviously nonsensical combination, but Chrome formats it anyway:

new Intl.NumberFormat("ar-EG", { numberingSystem: "hanidec" }).format(1234)
// 一,二三四

resolvedOptions also doesn't indicate whether data is available. You may specify a non-sensical combination that doesn't have data, which will cause fallback when calling format, but this fallback won't be reflected by any other means.

from browser-compat-data.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.