Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
cldr-plurals
Advanced tools
CLDR.js provides logic from the Unicode Common Locale Data Repository. Currently, the only functionality it provides is the pluralization rules.
Usage:
CLDR.pluralForm(0, 'en'); // => 'other'
CLDR.pluralForm(1, 'en-US'); // => 'one'
CLDR.pluralForm(2.383, 'fr'); // => 'other'
CLDR.pluralForm(1, 'zh'); // => 'other'
CLDR.pluralForm(26, 'uk'); // => 'many'
If you set CLDR.defaultLanguage
then the second argument is optional:
CLDR.defaultLanguage = 'pl';
CLDR.pluralForm(22); // => 'few'
Though CLDR.js doens't provide an I18n framework, you can use this logic as part of yours. For example, you might write the following:
CLDR.defaultLanguage = 'en';
var translations = {
'en': {
'widget': {
'one': 'one widget',
'other': '{{count}} widgets'
}
},
'jp': {
'widget': {
'other': '{{count}} ウィジェット'
}
}
};
function pluralize(key, count, language) {
var form = CLDR.pluralForm(count),
language = language || CLDR.defaultLanguage;
return translations[language][key][form];
}
FAQs
Common Locale Data Repository Pluralization Logic
The npm package cldr-plurals receives a total of 8 weekly downloads. As such, cldr-plurals popularity was classified as not popular.
We found that cldr-plurals demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.