@zohodesk/i18n 1.0.0-beta.31 → 1.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/es/components/DateTimeDiffFormat.js +2 -2
- package/es/components/FormatText.js +3 -2
- package/es/components/HOCI18N.js +5 -5
- package/es/components/I18N.js +2 -2
- package/es/components/I18NProvider.js +3 -3
- package/es/components/PluralFormat.js +3 -5
- package/es/components/UserTimeDiffFormat.js +2 -2
- package/es/components/__tests__/DateTimeDiffFormat.spec.js +2 -2
- package/es/components/__tests__/FormatText.spec.js +2 -2
- package/es/components/__tests__/HOCI18N.spec.js +2 -2
- package/es/components/__tests__/I18N.spec.js +6 -7
- package/es/components/__tests__/I18NProvider.spec.js +2 -2
- package/es/components/__tests__/PluralFormat.spec.js +3 -3
- package/es/components/__tests__/UserTimeDiffFormat.spec.js +2 -2
- package/es/index.js +10 -10
- package/es/utils/__tests__/jsxTranslations.spec.js +1 -1
- package/es/utils/index.js +1 -1
- package/es/utils/jsxTranslations.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { pad, getValues, getDiffObj, formatDate, getLyears, getDatePatternWithoutYear } from
|
|
4
|
-
import FormatText from
|
|
3
|
+
import { pad, getValues, getDiffObj, formatDate, getLyears, getDatePatternWithoutYear } from "../utils";
|
|
4
|
+
import FormatText from "./FormatText";
|
|
5
5
|
import datetime from '@zohodesk/datetimejs';
|
|
6
6
|
export default class DateTimeDiffFormat extends React.Component {
|
|
7
7
|
constructor(props) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import I18N from
|
|
3
|
+
import I18N from "./I18N";
|
|
4
4
|
export default class FormatText extends React.Component {
|
|
5
5
|
render() {
|
|
6
|
-
return /*#__PURE__*/React.createElement(I18N, this.props
|
|
6
|
+
return /*#__PURE__*/React.createElement(I18N, { ...this.props
|
|
7
|
+
});
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
}
|
package/es/components/HOCI18N.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import React, { Children } from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { replaceI18NValuesWithRegex, unescapeUnicode } from
|
|
6
|
-
import { I18NContext } from
|
|
3
|
+
import { replaceI18NValuesWithRegex, unescapeUnicode } from "../utils";
|
|
4
|
+
import { I18NContext } from "../I18NContext";
|
|
7
5
|
export default (function () {
|
|
8
6
|
let i18NKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9
7
|
return Component => {
|
|
@@ -39,7 +37,9 @@ export default (function () {
|
|
|
39
37
|
|
|
40
38
|
return result;
|
|
41
39
|
}, {});
|
|
42
|
-
return /*#__PURE__*/React.createElement(Component,
|
|
40
|
+
return /*#__PURE__*/React.createElement(Component, { ...this.props,
|
|
41
|
+
...i18nProps
|
|
42
|
+
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
}
|
package/es/components/I18N.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { Children } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { replaceI18NValuesWithRegex, unescapeUnicode } from
|
|
3
|
+
import { replaceI18NValuesWithRegex, unescapeUnicode } from "../utils";
|
|
4
4
|
import { HTMLPurifier } from '@zoho/SecurityJS';
|
|
5
|
-
import { I18NContext } from
|
|
5
|
+
import { I18NContext } from "../I18NContext";
|
|
6
6
|
export default class I18N extends React.Component {
|
|
7
7
|
constructor(props) {
|
|
8
8
|
super(props);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { getI18NValue, userDateFormat } from
|
|
4
|
-
import { getI18NComponent } from
|
|
5
|
-
import { I18NContext } from
|
|
3
|
+
import { getI18NValue, userDateFormat } from "../utils";
|
|
4
|
+
import { getI18NComponent } from "../utils/jsxTranslations";
|
|
5
|
+
import { I18NContext } from "../I18NContext";
|
|
6
6
|
const emptyObj = {};
|
|
7
7
|
|
|
8
8
|
const dummy = (key, values) => key;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
5
|
-
import FormatText from
|
|
3
|
+
import FormatText from "./FormatText";
|
|
6
4
|
export default class PluralFormat extends React.Component {
|
|
7
5
|
render() {
|
|
8
6
|
const {
|
|
@@ -23,13 +21,13 @@ export default class PluralFormat extends React.Component {
|
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
values = `${value}`;
|
|
26
|
-
return /*#__PURE__*/React.createElement(FormatText,
|
|
24
|
+
return /*#__PURE__*/React.createElement(FormatText, { ...this.props,
|
|
27
25
|
i18NKey: key,
|
|
28
26
|
values: values,
|
|
29
27
|
one: null,
|
|
30
28
|
many: null,
|
|
31
29
|
zero: null
|
|
32
|
-
})
|
|
30
|
+
});
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import DateTimeDiffFormat from
|
|
4
|
-
import { I18NContext } from
|
|
3
|
+
import DateTimeDiffFormat from "./DateTimeDiffFormat";
|
|
4
|
+
import { I18NContext } from "../I18NContext";
|
|
5
5
|
export default class UserTimeDiffFormat extends Component {
|
|
6
6
|
render() {
|
|
7
7
|
let currentTime = new Date();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import DateTimeDiffFormat from
|
|
2
|
-
import I18NProvider from
|
|
1
|
+
import DateTimeDiffFormat from "../DateTimeDiffFormat";
|
|
2
|
+
import I18NProvider from "../I18NProvider";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import renderer from 'react-test-renderer';
|
|
5
5
|
let tzData = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import FormatText from
|
|
2
|
-
import I18NProvider from
|
|
1
|
+
import FormatText from "../FormatText";
|
|
2
|
+
import I18NProvider from "../I18NProvider";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import renderer from 'react-test-renderer';
|
|
5
5
|
describe('FormatText component', () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import HOCI18N from
|
|
2
|
-
import I18NProvider from
|
|
1
|
+
import HOCI18N from "..//HOCI18N";
|
|
2
|
+
import I18NProvider from "../I18NProvider";
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import renderer from 'react-test-renderer';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import I18N from '../I18N';
|
|
4
|
-
import I18NProvider from '../I18NProvider';
|
|
1
|
+
import I18N from "../I18N";
|
|
2
|
+
import I18NProvider from "../I18NProvider";
|
|
5
3
|
import React from 'react';
|
|
6
4
|
import renderer from 'react-test-renderer';
|
|
7
5
|
const defaultProps = {
|
|
@@ -13,9 +11,9 @@ describe('I18N component', () => {
|
|
|
13
11
|
i18n: {
|
|
14
12
|
key1: 'vimal1<b>vimal</b>'
|
|
15
13
|
}
|
|
16
|
-
}, /*#__PURE__*/React.createElement(I18N,
|
|
14
|
+
}, /*#__PURE__*/React.createElement(I18N, { ...defaultProps,
|
|
17
15
|
isHtml: true
|
|
18
|
-
})))
|
|
16
|
+
})));
|
|
19
17
|
let tree = ele.toJSON();
|
|
20
18
|
expect(tree).toMatchSnapshot();
|
|
21
19
|
});
|
|
@@ -24,7 +22,8 @@ describe('I18N component', () => {
|
|
|
24
22
|
i18n: {
|
|
25
23
|
key1: 'vimal1<b>vimal</b>'
|
|
26
24
|
}
|
|
27
|
-
}, /*#__PURE__*/React.createElement(I18N, defaultProps
|
|
25
|
+
}, /*#__PURE__*/React.createElement(I18N, { ...defaultProps
|
|
26
|
+
})));
|
|
28
27
|
let tree = ele.toJSON();
|
|
29
28
|
expect(tree).toMatchSnapshot();
|
|
30
29
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import I18NProvider, { i18NProviderUtils } from
|
|
2
|
-
import I18N from
|
|
1
|
+
import I18NProvider, { i18NProviderUtils } from "../I18NProvider";
|
|
2
|
+
import I18N from "../I18N";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import renderer from 'react-test-renderer';
|
|
5
5
|
import { Provider } from 'react-redux';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import PluralFormat from
|
|
2
|
-
import I18NProvider from
|
|
3
|
-
import FormatText from
|
|
1
|
+
import PluralFormat from "../PluralFormat";
|
|
2
|
+
import I18NProvider from "../I18NProvider";
|
|
3
|
+
import FormatText from "../FormatText";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import renderer from 'react-test-renderer';
|
|
6
6
|
describe('PluralFormat component', () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import UserTimeDiffFormat from
|
|
2
|
-
import I18NProvider, { i18NProviderUtils } from
|
|
1
|
+
import UserTimeDiffFormat from "../UserTimeDiffFormat";
|
|
2
|
+
import I18NProvider, { i18NProviderUtils } from "../I18NProvider";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import renderer from 'react-test-renderer';
|
|
5
5
|
let temp = Date;
|
package/es/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { formatDate, pad, replaceI18NValuesWithRegex, unescapeUnicode, getValues, getI18NInfo, isToday, isYesterday, isTomorrow, isWithinAWeek, isTwoWeeksOrMore, userDateFormat, getDiffObj, getLyears, getSuffix, getDatePatternWithoutYear, setLocalizedData, setI18NKeyMapping, dayi18n, monthi18n, timei18n } from
|
|
2
|
-
import { getI18NValue as getI18NValue1 } from
|
|
3
|
-
export { I18NContext } from
|
|
4
|
-
export { default as I18NProvider, i18NProviderUtils } from
|
|
5
|
-
export { default as I18N } from
|
|
6
|
-
export { default as HOCI18N } from
|
|
7
|
-
export { default as FormatText } from
|
|
8
|
-
export { default as PluralFormat } from
|
|
9
|
-
export { default as DateTimeDiffFormat } from
|
|
10
|
-
export { default as UserTimeDiffFormat } from
|
|
1
|
+
export { formatDate, pad, replaceI18NValuesWithRegex, unescapeUnicode, getValues, getI18NInfo, isToday, isYesterday, isTomorrow, isWithinAWeek, isTwoWeeksOrMore, userDateFormat, getDiffObj, getLyears, getSuffix, getDatePatternWithoutYear, setLocalizedData, setI18NKeyMapping, dayi18n, monthi18n, timei18n } from "./utils";
|
|
2
|
+
import { getI18NValue as getI18NValue1 } from "./utils";
|
|
3
|
+
export { I18NContext } from "./I18NContext";
|
|
4
|
+
export { default as I18NProvider, i18NProviderUtils } from "./components/I18NProvider";
|
|
5
|
+
export { default as I18N } from "./components/I18N";
|
|
6
|
+
export { default as HOCI18N } from "./components/HOCI18N";
|
|
7
|
+
export { default as FormatText } from "./components/FormatText";
|
|
8
|
+
export { default as PluralFormat } from "./components/PluralFormat";
|
|
9
|
+
export { default as DateTimeDiffFormat } from "./components/DateTimeDiffFormat";
|
|
10
|
+
export { default as UserTimeDiffFormat } from "./components/UserTimeDiffFormat";
|
|
11
11
|
export const getI18NValue = (i18n, key, values) => getI18NValue1(i18n)(key, values);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { splitMatchedExp, generateChildren, replaceWithComponentPlaceHolder, createElement, prepareI18NFunc, getI18NComponent } from
|
|
2
|
+
import { splitMatchedExp, generateChildren, replaceWithComponentPlaceHolder, createElement, prepareI18NFunc, getI18NComponent } from "../jsxTranslations";
|
|
3
3
|
|
|
4
4
|
function Bold(_ref) {
|
|
5
5
|
let {
|
package/es/utils/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime from '@zohodesk/datetimejs';
|
|
2
|
-
import { i18NProviderUtils } from
|
|
2
|
+
import { i18NProviderUtils } from "../components/I18NProvider";
|
|
3
3
|
export const dayi18n = {
|
|
4
4
|
'Sun': 'deskreact.calendar.daynameshort.sunday',
|
|
5
5
|
'Mon': 'deskreact.calendar.daynameshort.monday',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/i18n",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.33",
|
|
4
4
|
"main": "lib/index",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"jsnext:main": "es/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"clean": "react-cli clean lib es coverage",
|
|
13
13
|
"build": "react-cli build:component:cmjs",
|
|
14
14
|
"build:es": "react-cli build:library:es",
|
|
15
|
-
"build:dev": "npm run clean && npm run build --module
|
|
15
|
+
"build:dev": "npm run clean && npm run build --module-mode=dev -- -w",
|
|
16
16
|
"prepublish": "npm run init && npm run build && npm run build:es ",
|
|
17
17
|
"prepare": "npm run init && npm run build && npm run build:es",
|
|
18
18
|
"test": "react-cli test",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint": "react-cli lint"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@zoho/SecurityJS": "
|
|
23
|
+
"@zoho/SecurityJS": "7.2.4"
|
|
24
24
|
},
|
|
25
25
|
"react-cli": {
|
|
26
26
|
"docs": {
|