Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
intl-schematic
Advanced tools
A tiny library (3kb, zero-dependency) that allows to localize and format strings while sparingly using the browser-standard [`Intl` API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).
A tiny library (3kb, zero-dependency) that allows to localize and format strings while sparingly using the browser-standard Intl
API.
Key features include:
I've grown frustrated with current implementations of popular l10n/i18n libraries, many of which:
Intl
),This library will try to avoid these common pitfalls, while retaining a small size and good performance.
This library will not support:
Comprehensive documentation is in progress.
See a simplified example below and don't be afraid to take a look into the sources to find out more.
const en = {
"hello": "Hello, World!",
"hello-name": name => `Hello, ${name}!`
};
const getDocument = () => en;
const getLocale = () => new Intl.Locale('en')
t()
)import { createTranslator } from 'intl-schematic';
const t = createTranslator(getDocument, getLocale);
console.log(t('hello')); // `Hello, World!`
console.log(t('hello-name', ['Bob'])); // `Hello, Bob!`
These allow to use standard Intl features,
like DateTimeFormat
or PluralRules
.
import { createTranslator } from 'intl-schematic';
import { defaultPlugins } from 'intl-schematic/plugins';
import { defaultProcessors } from 'intl-schematic/processors';
const getDocument = () => ({
price: {
processor: { number: "" },
parameter: { // Intl.NumberFormat options
style: "currency",
currency: "USD",
currencyDisplay: "symbol",
trailingZeroDisplay: "stripIfInteger"
},
input: 0 // fallback
}
});
const t = createTranslator(getDocument, getLocale, {
plugins: defaultPlugins,
processors: defaultProcessors,
});
console.log(t('price', 123)); // "US$123"
FAQs
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Raiondesu/intl-schematic/main/logo/Dark%20Logo.svg"> <source media="(prefers-color-scheme: light)" srcset="https://raw.github
The npm package intl-schematic receives a total of 127 weekly downloads. As such, intl-schematic popularity was classified as not popular.
We found that intl-schematic demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.