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

  • 26.0.0
  • Source
  • npm
  • Socket score

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

cldr-data-npm

Npm module for Unicode CLDR JSON data

Usage

On the package.json of your i18n library, define which CLDR versions it's compatible with.

"dependencies": {
  "cldr-data": ">26"
}

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 of cldr.js.

Cldr = require("cldrjs")
cldr = require("cldr-data");

Cldr.load(cldr("supplemental/plurals"));

function Pluralize(locale) {
  locale = new Cldr(locale);

  // Your awesome pluralization logic
  pluralForm = doAwesomeStuffWith(
    locale.supplemental("plurals-type-cardinal/{language}")
  );

  return pluralForm;
}

License

MIT © Rafael Xavier de Souza

Keywords

FAQs

Package last updated on 24 Sep 2014

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