Skip to content

Question: Have you considered using ECMAScript's Intl NumberFormat extension? #2

@renoirb

Description

@renoirb

Maybe what I'm going to say is overkill, maybe you haven't thought about it.

Hi,

Seeing your project made me wonder if ECMAScript's Intl/NumberFormat extensions do actually support Roman Numeral system natively.

For instance, we can get Thai numbers using the following method;

const someNumber = 123
let localeName = 'th-TH-u-nu-thai'
console.log((someNumber).toLocaleString(localeName)); // ๑๒๓
const localeName = 'ar-EG' // Arab from 
console.log((someNumber).toLocaleString(localeName)); // ١٢٣

Issue is just to find the proper notation.

I've had a quick search and a polyfill do make reference to "roman", in common/bcp47/number.xml and there is a notation to add Unicode numeral (see also u-extension) that should match foo-bar-u-nu-roman.

Meaning it might be possible to get roman numerals as easily as it is to get Hindi, or Hant numbers from Intl natively in the ECMAScript runtime engine (see locale identification, Number.toLocaleString()).

What are your thoughts about this?

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions