react-localization 1.0.11 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/lib/LocalizedStrings.d.ts +1 -1
- package/lib/LocalizedStrings.js +1 -6
- package/package.json +7 -4
package/README.md
CHANGED
@@ -22,7 +22,7 @@ It's possible to force a language different from the interface one.
|
|
22
22
|
In the React class that you want to localize require the library and define the strings object passing to the constructor a simple object containing a language key (i.e. en, it, fr..) and then a list of key-value pairs with the needed localized strings.
|
23
23
|
|
24
24
|
```js
|
25
|
-
|
25
|
+
// ES6 module syntax
|
26
26
|
import LocalizedStrings from 'react-localization';
|
27
27
|
|
28
28
|
let strings = new LocalizedStrings({
|
@@ -43,7 +43,7 @@ declare module 'react-localization' {
|
|
43
43
|
* @param key
|
44
44
|
* @param language
|
45
45
|
*/
|
46
|
-
getString(key: string, language
|
46
|
+
getString(key: string, language?: string): string;
|
47
47
|
|
48
48
|
/**
|
49
49
|
* Replace the NamedLocalization object without reinstantiating the object
|
package/lib/LocalizedStrings.js
CHANGED
@@ -24,8 +24,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
24
24
|
|
25
25
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
26
26
|
|
27
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
28
|
-
|
29
27
|
var _react = require('react');
|
30
28
|
|
31
29
|
var _react2 = _interopRequireDefault(_react);
|
@@ -36,9 +34,6 @@ var _localizedStrings2 = _interopRequireDefault(_localizedStrings);
|
|
36
34
|
|
37
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
38
36
|
|
39
|
-
var isReactComponent = function isReactComponent(value) {
|
40
|
-
return _typeof(value.$$typeof) === 'symbol';
|
41
|
-
};
|
42
37
|
var placeholderRegex = /(\{[\d|\w]+\})/;
|
43
38
|
|
44
39
|
/**
|
@@ -75,7 +70,7 @@ _localizedStrings2.default.prototype.formatString = function (str) {
|
|
75
70
|
}
|
76
71
|
}
|
77
72
|
|
78
|
-
if (
|
73
|
+
if (_react2.default.isValidElement(valueForPlaceholder)) {
|
79
74
|
hasObject = true;
|
80
75
|
return _react2.default.Children.toArray(valueForPlaceholder).map(function (component) {
|
81
76
|
return _extends({}, component, { key: index.toString() });
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-localization",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.15",
|
4
4
|
"description": "Simple module to localize the React interface using the same syntax used in the ReactNativeLocalization module, use 'npm run build' before publishing",
|
5
5
|
"scripts": {
|
6
6
|
"babel-version": "babel --version",
|
@@ -34,10 +34,13 @@
|
|
34
34
|
"babel-preset-es2015": "^6.24.1",
|
35
35
|
"babel-preset-react": "^6.24.1",
|
36
36
|
"babel-preset-stage-2": "^6.24.1",
|
37
|
-
"jasmine": "^2.7.0"
|
37
|
+
"jasmine": "^2.7.0",
|
38
|
+
"react": "^16.0.0"
|
38
39
|
},
|
39
40
|
"dependencies": {
|
40
|
-
"localized-strings": "^0.0
|
41
|
-
|
41
|
+
"localized-strings": "^0.2.0"
|
42
|
+
},
|
43
|
+
"peerDependencies": {
|
44
|
+
"react": "^16.0.0 || ^15.6.0"
|
42
45
|
}
|
43
46
|
}
|