
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
simple-languages
Advanced tools
A small wrapper for switching languages. Inspired by react-localization and rewritten using Proxy for a much smaller code base (50 ~ 80 lines of codes).
npm install --save simple-languages
or
yarn add simple-languages
Basic usage
import createLanguages from 'simple-languages'
// create the Languages object
const Languages = createLanguages()
// set the language, it is 'en' by default
Languages.lang = 'vi'
/* set the language data, it can be overwrite anytime
* please note that the words "formatString", "lang" and "data" are reserved
*/
Languages.data = {
en: {
hello: 'Hello'
},
vi: {
hello: 'Xin chào'
}
}
console.log(Languages.hello) // => Xin chào
Languages.lang = 'en' // change language by setting the lang property
console.log(Languages.hello) // => Hello
import createLanguages from 'simple-languages'
import formatString from 'simple-languages/formatString'
const Languages = createLanguages()
Languages.data.en = {
hello: 'Hello, {0} and {1}!!!'
}
// ...do the same as above then
Languages.formatString = formatString
console.log(Languages.formatString(Languages.hello, 'John', 'David')) // => Hello, John and David!!!
import formatString from 'simple-languages/formatString-react'
Since this plugin using Proxy which is only supported by modern browsers. https://caniuse.com/#search=proxy.
However, a polyfill can be used to support IE9+.
FAQs
A tiny package for switching languages
The npm package simple-languages receives a total of 0 weekly downloads. As such, simple-languages popularity was classified as not popular.
We found that simple-languages 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.