
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
i18next-sprintf-postprocessor
Advanced tools
This is a i18next postProcessor enabling sprintf usage for translations.
Source can be loaded via npm, bower or downloaded from this repo.
# npm package
$ npm install i18next-sprintf-postprocessor
# bower
$ bower install i18next-sprintf-postprocessor
Wiring up:
import i18next from 'i18next';
import sprintf from 'i18next-sprintf-postprocessor';
i18next
.use(sprintf)
.init(i18nextOptions);
// given loaded resources
// translation: {
// key1: 'The first 4 letters of the english alphabet are: %s, %s, %s and %s',
// key2: 'Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s',
// key3: 'The last letter of the english alphabet is %s',
// key3: 'Water freezes at %d degrees'
// }
i18next.t('key1', { postProcess: 'sprintf', sprintf: ['a', 'b', 'c', 'd'] });
// --> 'The first 4 letters of the english alphabet are: a, b, c and d'
i18next.t('key2', { postProcess: 'sprintf', sprintf: { users: [{name: 'Dolly'}, {name: 'Molly'}, {name: 'Polly'}] } });
// --> 'Hello Dolly, Molly and Polly'
import i18next from 'i18next';
import sprintf from 'i18next-sprintf-postprocessor';
i18next.init({
overloadTranslationOptionHandler: sprintf.overloadTranslationOptionHandler
});
// given loaded resources
// translation: {
// key1: 'The first 4 letters of the english alphabet are: %s, %s, %s and %s',
// key2: 'Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s',
// key3: 'The last letter of the english alphabet is %s',
// key3: 'Water freezes at %d degrees'
// }
i18next.t('interpolationTest1', 'a', 'b', 'c', 'd');
// --> 'The first 4 letters of the english alphabet are: a, b, c and d'
i18next.t('interpolationTest3', 'z');
// --> 'The last letter of the english alphabet is z'
i18next.t('interpolationTest4', 0);
// --> 'Water freezes at 0 degrees'
FAQs
backend layer for i18next using browsers xhr
The npm package i18next-sprintf-postprocessor receives a total of 12,882 weekly downloads. As such, i18next-sprintf-postprocessor popularity was classified as popular.
We found that i18next-sprintf-postprocessor 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
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.