Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-redux-translate

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-redux-translate - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

react-redux-translate-1.0.3.tgz

15

index.js
'use strict';
function translator (defaultLanguage, storeLanguageKey, path) {
function translator (language, storeLanguageKey, path) {
if (arguments.length < 3)
throw new Error("Function 'translator' require at least three arguments default language, language key in the store, path from the root of the project (directory contained node-modules) to 'i18n' directory");
function Lang(defaultLanguage, path) {
function Lang(language, path) {
this.path = path;
this.defineSource(defaultLanguage);
this.defineSource(language);
}

@@ -17,3 +17,3 @@

const i18n = new Lang(defaultLanguage, path);
const i18n = new Lang(language, path);

@@ -49,3 +49,8 @@ function translate(props) {

}
return result;
if (!/<\w+>\w?|\w+<\/\w+>/.test(string)) {
return string;
} else {
const innerHtml = props => <span dangerouslySetInnerHTML={{__html: props}} />
return innerHtml(string);
}
}

@@ -52,0 +57,0 @@

{
"name": "react-redux-translate",
"version": "1.0.3",
"description": "provide i18n translate using react-redux state",
"version": "1.0.4",
"description": "easy internationalization with react-redux",
"main": "index.js",

@@ -19,3 +19,4 @@ "scripts": {

"react-redux",
"i18n",
"redux",
"react-i18n",
"translate",

@@ -22,0 +23,0 @@ "internationalization"

@@ -34,4 +34,3 @@ #react-redux-translate

3. 'pathToI18nDirectoryProjectRoot' path form root of the project (the same level where is the node-modules directory)
to 'i18n' directory.
3. 'pathToI18nDirectoryProjectRoot' path form root of the project (the same level where is the node-modules directory) to 'i18n' directory.

@@ -57,3 +56,3 @@

`"home":{"event": "Meet ${} and ${} at GitHub" }`
`"home": {"event": "Meet ${} and ${} at GitHub" }`

@@ -64,3 +63,10 @@ and you set follow params to the `<T/>`component

you will get **"`Meet Mary and John at GitHub`"** string inside `div`.
you will get **"`Meet Mary and John at GitHub`"** string inside `div`.
Of cause you can add any HTML tags with **class** attribute:
"home": "<a href='some-link' class="this-string-will-blue-as-link">Some text <i>some text with italic style</i></span>"
You don't need to do any special to insert HTML tags into translation string!
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc