Installations
npm install @phensley/cldr-core
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
22.10.0
NPM Version
10.9.0
Statistics
49 Stars
1,714 Commits
3 Forks
5 Watching
12 Branches
2 Contributors
Updated on 15 Nov 2024
Languages
TypeScript (98.03%)
Python (1.34%)
JavaScript (0.28%)
Shell (0.18%)
HTML (0.16%)
Total Downloads
Cumulative downloads
Total Downloads
191,567
Last day
-3.7%
129
Compared to previous day
Last week
24.1%
792
Compared to previous week
Last month
-41.7%
2,748
Compared to previous month
Last year
8.1%
56,563
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
10
cldr-engine
Internationalization in Typescript with Unicode CLDR, batteries included.
Links
- Documentation on the library API and usage.
- CodeSandbox example can be used to experiment, report bugs, etc.
- Demonstration app provides an example using React and Redux. (source code)
Install
Install the NPM package:
1npm install --save @phensley/cldr
Using Yarn:
1yarn add @phensley/cldr
Versioning
This project follows semantic versioning:
PATCH
- Bug fixes
- Backwards-compatible
- Resource pack compatibility maintained (packs from
1.0.0
are guaranteed to work for all1.0.*
versions)
MINOR
- New features
- Backwards-compatible
- Internal schema breaking changes (applications must load resource packs from the same
major.minor
version) - CLDR data upgrades which maintain backwards-compatibility
MAJOR
- Public API breaking changes
- CLDR data upgrades which change break API compatibility (unit deprecation / renaming, etc)
Features
- Implementation folows the CLDR specification supporting CLDR version 45.0.0
- 391 modern locales
- Compact resource packs containing all scripts and regions for a given language
- Language tag parsing, locale resolution, and distance-based enhanced language matching for improved locale fallback
- Fast, compact, and extensible ICU message formatting
- Both string and parts formatting for flexible markup styling
- Date time, date interval, and relative time formatting
- Full IANA and CLDR timezone support covering the full range of IANA timezone untils, automatic handling of deprecated timezone identifiers and aliases
- Gregorian, ISO-8601, Japanese, Persian and Buddhist calendars.
- Date formatting using flexible skeleton-based pattern matching
- Date addition, date subtraction, date differencing and "field of visual difference" calculation
- Cardinal and ordinal pluralization rules
- Decimal numbers, currencies, units, and unit sequence formatting, with 184 different units
- Arbitrary precision decimal math
- Display names for languages, scripts, regions, currencies, units, calendar fields, etc
- List formatting, measurement system, character order, and line order information
- Optional Unit conversion package to convert quantities between CLDR units
Package 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 independent of the rest of the library:
package | size | dependencies |
---|---|---|
@phensley/cldr-utils | ||
@phensley/decimal | ||
@phensley/language-tag | ||
@phensley/locale | size includes language-tag package | |
@phensley/locale-matcher | size includes locale and language-tag packages | |
@phensley/messageformat | size includes cldr-utils , decimal , and plurals packages | |
@phensley/plurals | size includes decimal package | |
@phensley/timezone | size includes cldr-utils package | |
@phensley/unit-converter | size includes cldr-utils and decimal packages |
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: ~49MB of JSON for 106 locales is compressed to a 227KB resource pack (42KB gzip), a factor of approx. 220:1 uncompressed, 1200: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, Node.js, and other Javascript ES5 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.
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.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
14 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/build-test.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/phensley/cldr-engine/build-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/phensley/cldr-engine/build-test.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/build-test.yml:27
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
4.4
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More