intl-locales-supported

Utility to help you polyfill the Node.js runtime when the Intl APIs are missing, or if the built-in Intl is missing locale data that you need.

BSD-3-Clause 42 个版本
安装
npm install intl-locales-supported
yarn add intl-locales-supported
pnpm add intl-locales-supported
bun add intl-locales-supported
README

intl-locales-supported

Utility to help you determine if your runtime has modern Intl API & locales support. This specifically checks for Intl.NumberFormat, Intl.PluralRules & Intl.RelativeTimeFormat and is being used by react-intl.

npm Version size

Usage

const areIntlLocalesSupported = require('intl-locales-supported');

const localesMyAppSupports = [
  /* list locales here */
];

// Determine if the built-in `Intl` has the locale data we need.
if (
  !areIntlLocalesSupported(localesMyAppSupports, [
    Intl.PluralRules,
    Intl.RelativeTimeFormat,
  ])
) {
  // `Intl` exists, but it doesn't have the data we need, so load the
  // polyfill and replace the constructors we need with the polyfill's.
  require('@formatjs/intl-pluralrules/polyfill');
  require('@formatjs/intl-pluralrules/locale-data/de'); // Load de

  require('@formatjs/intl-relativetimeformat/polyfill');
  require('@formatjs/intl-relativetimeformat/locale-data/de'); // Load de
}
版本列表
1.8.12 2020-07-03
1.8.11 2020-07-01
1.8.10 2020-05-27
1.8.9 2020-05-25
1.8.8 2020-05-05
1.8.7 2020-04-28
1.8.6 2020-04-24
1.8.5 2020-04-14
1.8.4 2019-11-26
1.8.3 2019-11-25
1.8.2 2019-11-21
1.8.1 2019-11-20
1.8.0 2019-10-30
1.6.0 2019-10-01
1.5.0 2019-09-20
1.4.8 2019-09-13
1.4.7 2019-09-03
1.4.6 2019-09-03
1.4.5 2019-08-12
1.4.4 2019-08-11
1.4.3 2019-08-06
1.4.2 2019-07-23
1.4.0 2019-07-12
1.3.4 2019-07-09
1.3.3 2019-07-09
1.3.2 2019-07-05
1.3.1 2019-07-02
1.3.0 2019-07-02
1.2.1 2019-07-01
1.2.0 2019-06-27
1.1.2 2019-06-18
1.1.1 2019-06-18
1.1.0 2019-06-12
1.0.10 2019-06-03
1.0.9 2019-06-03
1.0.8 2019-06-03
1.0.6 2019-05-31
1.0.5 2019-05-28
1.0.3 2019-05-28
1.0.2 2019-05-26
1.0.1 2019-05-18
1.0.0 2015-05-30