@zohodesk/i18n 1.0.0-beta.30 → 1.0.0-beta.31
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
CHANGED
|
@@ -23,7 +23,7 @@ export default class I18NProvider extends React.Component {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
componentDidUpdate(
|
|
26
|
+
componentDidUpdate(prevProps) {
|
|
27
27
|
let {
|
|
28
28
|
i18n,
|
|
29
29
|
timeZone,
|
|
@@ -31,19 +31,20 @@ export default class I18NProvider extends React.Component {
|
|
|
31
31
|
timeFormat,
|
|
32
32
|
direction,
|
|
33
33
|
onChange,
|
|
34
|
-
tzData
|
|
34
|
+
tzData,
|
|
35
|
+
isEnabledCurrentYear
|
|
35
36
|
} = this.props;
|
|
36
37
|
|
|
37
|
-
if (i18n !==
|
|
38
|
+
if (i18n !== prevProps.i18n || timeZone !== prevProps.timeZone || datePattern !== prevProps.datePattern || timeFormat !== prevProps.timeFormat || direction !== prevProps.direction || tzData !== prevProps.tzData || isEnabledCurrentYear !== prevProps.isEnabledCurrentYear) {
|
|
38
39
|
this.promise = new Promise((res, rej) => {
|
|
39
40
|
this.resolve = res;
|
|
40
41
|
this.reject = rej;
|
|
41
42
|
}).then(() => {
|
|
42
|
-
i18NProviderUtils.getI18NValue = getI18NValue(
|
|
43
|
-
i18NProviderUtils.getI18NComponent = getI18NComponent(
|
|
43
|
+
i18NProviderUtils.getI18NValue = getI18NValue(this.props.i18n);
|
|
44
|
+
i18NProviderUtils.getI18NComponent = getI18NComponent(this.props.i18n);
|
|
44
45
|
|
|
45
|
-
if (props.tzData) {
|
|
46
|
-
i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, this.props.isEnabledCurrentYear);
|
|
46
|
+
if (this.props.tzData) {
|
|
47
|
+
i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, this.props.tzData, this.props.timeFormat, this.props.datePattern, this.props.isEnabledCurrentYear);
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
this.promise = null;
|
|
@@ -75,7 +75,7 @@ var I18NProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
75
75
|
|
|
76
76
|
_createClass(I18NProvider, [{
|
|
77
77
|
key: "componentDidUpdate",
|
|
78
|
-
value: function componentDidUpdate(
|
|
78
|
+
value: function componentDidUpdate(prevProps) {
|
|
79
79
|
var _this2 = this;
|
|
80
80
|
|
|
81
81
|
var _this$props = this.props,
|
|
@@ -85,18 +85,19 @@ var I18NProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
85
85
|
timeFormat = _this$props.timeFormat,
|
|
86
86
|
direction = _this$props.direction,
|
|
87
87
|
onChange = _this$props.onChange,
|
|
88
|
-
tzData = _this$props.tzData
|
|
88
|
+
tzData = _this$props.tzData,
|
|
89
|
+
isEnabledCurrentYear = _this$props.isEnabledCurrentYear;
|
|
89
90
|
|
|
90
|
-
if (i18n !==
|
|
91
|
+
if (i18n !== prevProps.i18n || timeZone !== prevProps.timeZone || datePattern !== prevProps.datePattern || timeFormat !== prevProps.timeFormat || direction !== prevProps.direction || tzData !== prevProps.tzData || isEnabledCurrentYear !== prevProps.isEnabledCurrentYear) {
|
|
91
92
|
this.promise = new Promise(function (res, rej) {
|
|
92
93
|
_this2.resolve = res;
|
|
93
94
|
_this2.reject = rej;
|
|
94
95
|
}).then(function () {
|
|
95
|
-
i18NProviderUtils.getI18NValue = (0, _utils.getI18NValue)(
|
|
96
|
-
i18NProviderUtils.getI18NComponent = (0, _jsxTranslations.getI18NComponent)(
|
|
96
|
+
i18NProviderUtils.getI18NValue = (0, _utils.getI18NValue)(_this2.props.i18n);
|
|
97
|
+
i18NProviderUtils.getI18NComponent = (0, _jsxTranslations.getI18NComponent)(_this2.props.i18n);
|
|
97
98
|
|
|
98
|
-
if (props.tzData) {
|
|
99
|
-
i18NProviderUtils.userDateFormat = (0, _utils.userDateFormat)(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, _this2.props.isEnabledCurrentYear);
|
|
99
|
+
if (_this2.props.tzData) {
|
|
100
|
+
i18NProviderUtils.userDateFormat = (0, _utils.userDateFormat)(i18NProviderUtils.getI18NValue, _this2.props.tzData, _this2.props.timeFormat, _this2.props.datePattern, _this2.props.isEnabledCurrentYear);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
_this2.promise = null;
|
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ export default class I18NProvider extends React.Component {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
componentDidUpdate(
|
|
34
|
+
componentDidUpdate(prevProps) {
|
|
35
35
|
let {
|
|
36
36
|
i18n,
|
|
37
37
|
timeZone,
|
|
@@ -40,28 +40,30 @@ export default class I18NProvider extends React.Component {
|
|
|
40
40
|
direction,
|
|
41
41
|
onChange,
|
|
42
42
|
tzData,
|
|
43
|
+
isEnabledCurrentYear
|
|
43
44
|
} = this.props;
|
|
44
45
|
if (
|
|
45
|
-
i18n !==
|
|
46
|
-
timeZone !==
|
|
47
|
-
datePattern !==
|
|
48
|
-
timeFormat !==
|
|
49
|
-
direction !==
|
|
50
|
-
tzData !==
|
|
46
|
+
i18n !== prevProps.i18n ||
|
|
47
|
+
timeZone !== prevProps.timeZone ||
|
|
48
|
+
datePattern !== prevProps.datePattern ||
|
|
49
|
+
timeFormat !== prevProps.timeFormat ||
|
|
50
|
+
direction !== prevProps.direction ||
|
|
51
|
+
tzData !== prevProps.tzData ||
|
|
52
|
+
isEnabledCurrentYear !== prevProps.isEnabledCurrentYear
|
|
51
53
|
) {
|
|
52
54
|
this.promise = new Promise((res, rej) => {
|
|
53
55
|
this.resolve = res;
|
|
54
56
|
this.reject = rej;
|
|
55
57
|
}).then(
|
|
56
58
|
() => {
|
|
57
|
-
i18NProviderUtils.getI18NValue = getI18NValue(
|
|
58
|
-
i18NProviderUtils.getI18NComponent = getI18NComponent(
|
|
59
|
-
if(props.tzData){
|
|
59
|
+
i18NProviderUtils.getI18NValue = getI18NValue(this.props.i18n);
|
|
60
|
+
i18NProviderUtils.getI18NComponent = getI18NComponent(this.props.i18n);
|
|
61
|
+
if (this.props.tzData) {
|
|
60
62
|
i18NProviderUtils.userDateFormat = userDateFormat(
|
|
61
63
|
i18NProviderUtils.getI18NValue,
|
|
62
|
-
props.tzData,
|
|
63
|
-
props.timeFormat,
|
|
64
|
-
props.datePattern,
|
|
64
|
+
this.props.tzData,
|
|
65
|
+
this.props.timeFormat,
|
|
66
|
+
this.props.datePattern,
|
|
65
67
|
this.props.isEnabledCurrentYear
|
|
66
68
|
);
|
|
67
69
|
}
|