8000 Intl.Locale · Issue #106 · tc39/ecma402 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Intl.Locale #106
Closed
Closed
@zbraniecki

Description

@zbraniecki

This is the second spin-off from #68.

Proposing a new class Intl.Locale which creates objects with a list of extension keys used by any of the formatters and with toString method which produces a BCP47 locale string with relevant extension keys.

Examples:

let locale = new Intl.Locale('en-US');
locale.toString(); // 'en-US'
locale.calendar; // undefined
let locale = new Intl.Locale('en-US', {
  ca: 'buddhist'
});
locale.toString(); // 'en-US-u-ca-buddhist'
locale.calendar; // 'buddhist'
let locale = new Intl.Locale('en-US-u-ca-buddhist');
locale.toString(); // 'en-US-u-ca-buddhist'
locale.calendar; // 'buddhist'
let locale = new Intl.Locale('en-US-u-ca-buddhist', {
  ca: 'gregory'
});
locale.toString(); // 'en-US-u-ca-gregory'
locale.calendar; // 'gregory'
let locale = new Intl.Locale('en-US-u-ca-buddhist', {
  ca: 'gregory'
});
locale.toString(); // 'en-US-u-ca-gregory'
locale.calendar; // 'gregory'

Proposed list of supported extension keys and their option key names:

  • ca-- calendar
  • nu -- numberingSystem
  • hc -- hourCycle
  • tz -- timeZone
  • cu -- currency
  • co -- collation
  • kn -- numeric
  • kf -- caseFirst

Looking for feedback

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: localeComponent: locale identifierss: in progressStatus: the issue has an active proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0