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.
@cloudflare/intl-core
Advanced tools
@cloudflare/intl-core
This package provides core utilities for i18n.
$ npm install @cloudflare/intl-core
This is a wrapper around the functions of Polyglot.
The main benefit it provides is that it stores various instances of Polyglot for each locale in order to be able to locate translations which are not found in target locale but are found in English locale.
import Translator from '@cloudfalre/intl-core';
const phrases = {
phrase_key: 'phrase_value',
second_phrase: 'second_value'
};
const germanPhrases = {
phrase_key: 'german_value'
};
const translator = new Translator({
phrases
});
translator.locale(ESupportedLocales.de_DE);
translator.extend(germanPhrases);
translator.t('phrase_key'); //returns german_value since it's found for the german locale
translator.t('second_phrase'); //returns second_value since it was not found in german locale but was found in English locale
This is a function which takes an object mapping each locale
to a function
returning a Promise which resolves to the catalog of phrases for that locale
.
The main usecase for this is to provide a way to asynchronously load phrases
based on locale
. You can include an index.ts
file inside your locale
directory with the following content:
import { makeLoadPhrases, ESupportedLocales } from '@cloudflare/intl-core';
const loadPhrases = makeLoadPhrases({
[ESupportedLocales.en_US]: () => import('./en-US/phrases.json')
//...other locales
});
export default loadPhrases;
FAQs
Unknown package
The npm package @cloudflare/intl-core receives a total of 5,056 weekly downloads. As such, @cloudflare/intl-core popularity was classified as popular.
We found that @cloudflare/intl-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.