@phensley/cldr-types

Types shared among packages in the @phensley/cldr library


Keywords
arbitrary-precision, cldr, decimal, globalize, i18n, internationalization, language, locale, localization, math, messageformat, pluralization, timezone, typescript, unicode
License
Apache-2.0
Install
npm install @phensley/cldr-types@1.3.3

Documentation

cldr-engine

Internationalization in Typescript with Unicode CLDR, batteries included

build codecov npm version

Documentation

The documentation is mostly complete but under development in advance of a 1.0 release.

Demonstration

Status

The project is currently BETA. Working on stabilizing the public API and feature set for an initial 1.0 release.

Install

Install the NPM package:

npm install --save @phensley/cldr

# or

yarn add @phensley/cldr

Pacakge Naming

Packages with the cldr-* prefix represent pieces of the larger library and are designed to work together. The @phensley/cldr package pulls in the full functionality of the library.

Packages without the cldr-* prefix can be used in an application individually without pulling in the larger core library. You can use any of the packages @phensley/decimal, @phensley/messageformat, @phensley/plurals, and @phensley/timezone on their own.

Features

Goals

  • Support a broad set of CLDR features in the browser "out of the box".
  • Support all scripts and regions for a language in a single compact resource pack.
  • Resolve the CLDR data size and dimensionality problems.
    • In the case of English: ~40MB of JSON for 105 locales is compressed to a 194KB resource pack (44KB gzip), a factor of approx. 200:1 uncompressed, 1000:1 with gzip compression.
  • No additional library dependencies required.
  • No custom extraction of CLDR data or precompilation of formatters required.
  • Correctness and consistency across browsers and Javascript runtime environments.
  • Provide type-safety, reducing programming errors.
  • No familiarity with CLDR structure is required for developers to use this library.
  • High performance.
  • Arbitrary precision decimal math, to achieve the same accuracy in the browser as on the server.

Rationale

I needed a library that included as much CLDR functionality as possible, while still meeting all of my requirements for performance, static and runtime code size, simplicity of integration, etc

I'm gradually comparing this library with current alternatives here.

License

Copyright 2018-present Patrick Hensley

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Affiliation

This project is not affiliated with the Unicode Inc. or the Unicode CLDR project.