
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
translated-react
Advanced tools
Component for managing and using simple translations in React.js. Easily implement i18n with this dependency free internationalization library.
Component for managing and using simple translations in React.js. Easily implement i18n with this dependency free internationalization library, with a minimum footprint of 1,21 KB gzipped.
npm install translated-react
Or:
yarn add translated-react
import React from 'react'
import ReactDOM from 'react-dom'
import TranslatedProvider, { translated } from 'translated-react'
import PropTypes from 'prop-types'
const langTable = {
en: {
moreText: 'Some more text',
textForTesting: 'Some text for testing with {nWords} words'
},
es: {
moreText: 'Algo más de texto',
textForTesting: 'Algo de texto de prueba con {nWords} palabras'
}
}
const MyComponent = ({lookup: t}) => [t('textForTesting', { nWords: '8' }), t('moreText')]
MyComponent.propTypes = {
lookup: PropTypes.func.isRequired
}
const MyTranslatedComponent = translated(MyComponent)
const MyApp = () => (
<TranslatedProvider lang="es" defaultLang="en" langTable={langTable}>
<MyTranslatedComponent />
</TranslatedProvider>
)
ReactDOM.render(<MyApp />, document.getElementsByTagName('body')[0].appendChild(document.createElement('div')))
Currently only one TranslatedProvider component is supported; this means that, if you use two TranslatedProvider components only the last created one will have effect in setting the language, default language and translations table.
You can change the current language with the exported function setLang(newLang)
. This will trigger rerendering of the TranslatedProvider component and its children with the new language (if it's different from the current one).
Texts without vars are cached.
npm test
Or:
yarn test
translated-react is available under MIT. See LICENSE for more details.
FAQs
Component for managing and using simple translations in React.js. Easily implement i18n with this dependency free internationalization library.
The npm package translated-react receives a total of 0 weekly downloads. As such, translated-react popularity was classified as not popular.
We found that translated-react 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.