Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-redux-translate
Advanced tools
#react-redux-translate
$ npm i --save react-redux-translate
Create Translate instance in any place within the src directory.
import React from 'react';
import { connect } from 'react-redux';
import translate from './common/react-redux-translate';
let T = translate('defaultLanguage', 'languageKeyInState', 'pathToI18nDirectory');
export default T = connect(state => ({languageKeyInState: state.languageKeyInState}))(T);
If pure string needed to insert as the function argument
export const funcT = ({keys, insertions = []}) => <T keys={keys} insertions={insertions} />;
Keep in mind
1. 'defaultLanguage' must correspond name of the JSON file in i18n directory.
2. 'languageKeyInState' must correspond name language key in the redux state.
3. 'pathToI18nDirectory' path form root of project (level of node-modules directory)
to 'i18n' directory.
Import T where needed
import T from 'pathToInstance';
Insert as React Component with required properties
<div><T keys="home.title" /><div>
'Keys' property can be either string with dot delimiter or array of string.
If you would like to add some words to a translated string use 'insertions' property and add placeholders ${} to the source string. insertions
must be an array of string.
For example, for string in english const home = { title: "Meet ${} and ${} at GitHub" }
FAQs
easy internationalization with react-redux
The npm package react-redux-translate receives a total of 0 weekly downloads. As such, react-redux-translate popularity was classified as not popular.
We found that react-redux-translate 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.