Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cldr-data

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cldr-data

Npm module for Unicode CLDR JSON data

  • 25.0.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
48K
decreased by-15.49%
Maintainers
1
Weekly downloads
 
Created
Source

Npm's cldr-data

Npm module for Unicode CLDR JSON data.

Goal

  • Allow i18n libraries to define CLDR data as versioned "peer" dependency.
  • Provide tools to assist (in other words, ease the pain) on fetching the data.

Bonus goals

Usage

On the package.json of your i18n library, define its CLDR data dependency. compatible with.

"peerDependencies": {
  "cldr-data": ">=25"
}

On your library, access CLDR JSON data using require("cldr-data").

cldr = require("cldr-data");

function Pluralize(locale) {
  var plurals = cldr("supplemental/plurals");
  var language = extractLanguageFrom(locale);

  // Your awesome pluralization logic
  pluralForm = doAwesomeStuffWith(
    plurals.supplemental["plurals-type-cardinal"][language]
  );

  return pluralForm;
}

For your convinience, use cldr-data in conjunction with cldr.js. You can find more details switching to the Foo Number Format Library Example or Application Example branches.

Locale coverage

By default, the locale coverage installed is core, which Unicode defines as the top tier languages and is equivalent to the json.zip content. There exists two solutions to get the full coverage: either by setting the environmental variable CLDR_COVERAGE to full or define the coverage in your package.json.

Environmental variable

In this example we are installing cldr-data by setting the CLDR_COVERAGE to full:

$ CLDR_COVERAGE=full npm install
package.json

Define your coverage by setting the property cldr-data-coverage in your `package.json:

{
  ...
  "cldr-data-coverage": "full",
  ...
}

License

MIT © Rafael Xavier de Souza

Keywords

FAQs

Package last updated on 24 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc