Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
A simple tool to translate i18n.
install
npm install i18n-s -S
use
import I18n from 'i18n-s';
let locale = 'zh-cn';
let localeData = {
"test": "test string",
"b.test": "test string b",
"a is b's father": "${a} is ${b}'s father",
"c": {
"test": "test string c"
}
}
let i18n = new I18n({
locale: 'zh-CN', // init locale
i18nData: {}, // init data,
log: process.env.NODE_ENV !== 'production', // is log when no translate
// log: function(msg) { console.log(msg) }, // log can be a function
});
// set current locale and locale data
i18n.setLocaleData(locale, i18nData);
i18n.setLocale(locale);
// translate with vars
let str = i18n.__('test');
// translate with dot
let str = i18n.__('b.test');
// translate with context
let str = i18n.__('c.test');
// translate with vars
let str = i18n.__('a is b\'s father', {
a: 'Json',
b: 'Joy'
});
i18n.setLocaleData(locale, localeData)
i18n.setLocale(locale)
i18n.translate(key, vars={})
i18n.__(key, vars={})
: alias to i18n.translate
FAQs
Fork of https://github.com/ccqgithub/i18n-s
The npm package sg-i18n receives a total of 1 weekly downloads. As such, sg-i18n popularity was classified as not popular.
We found that sg-i18n 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.