@zohodesk/i18n 1.0.0-beta.26 → 1.0.0-beta.28

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.
Files changed (50) hide show
  1. package/README.md +113 -105
  2. package/es/components/I18NProvider.js +5 -1
  3. package/es/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  4. package/es/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  5. package/es/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  6. package/es/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  7. package/es/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  8. package/es/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  9. package/es/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  10. package/es/utils/__tests__/jsxTranslations.spec.js +174 -0
  11. package/es/{utils.js → utils/index.js} +25 -2
  12. package/es/utils/jsxTranslations.js +193 -0
  13. package/lib/components/I18NProvider.js +6 -1
  14. package/lib/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  15. package/lib/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  16. package/lib/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  17. package/lib/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  18. package/lib/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  19. package/lib/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  20. package/lib/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  21. package/lib/utils/__tests__/jsxTranslations.spec.js +183 -0
  22. package/lib/{utils.js → utils/index.js} +28 -5
  23. package/lib/utils/jsxTranslations.js +242 -0
  24. package/package.json +30 -29
  25. package/src/I18NContext.js +2 -2
  26. package/src/components/DateTimeDiffFormat.js +256 -256
  27. package/src/components/FormatText.js +14 -14
  28. package/src/components/HOCI18N.js +37 -37
  29. package/src/components/I18N.js +74 -74
  30. package/src/components/I18NProvider.js +116 -110
  31. package/src/components/PluralFormat.js +37 -37
  32. package/src/components/UserTimeDiffFormat.js +97 -97
  33. package/src/components/__tests__/DateTimeDiffFormat.spec.js +618 -618
  34. package/src/components/__tests__/FormatText.spec.js +26 -26
  35. package/src/components/__tests__/HOCI18N.spec.js +33 -33
  36. package/src/components/__tests__/I18N.spec.js +29 -29
  37. package/src/components/__tests__/I18NProvider.spec.js +65 -65
  38. package/src/components/__tests__/PluralFormat.spec.js +27 -27
  39. package/src/components/__tests__/UserTimeDiffFormat.spec.js +1076 -1076
  40. package/src/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  41. package/src/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  42. package/src/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  43. package/src/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  44. package/src/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  45. package/src/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  46. package/src/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  47. package/src/index.js +37 -37
  48. package/src/utils/__tests__/jsxTranslations.spec.js +213 -0
  49. package/src/{utils.js → utils/index.js} +632 -612
  50. package/src/utils/jsxTranslations.js +180 -0
package/README.md CHANGED
@@ -1,105 +1,113 @@
1
- # i18n
2
-
3
- # 1.0.0-beta.26
4
-
5
- - Localization feature enhancement in i18n method.
6
-
7
- # 1.0.0-beta.25
8
-
9
- - July i18n key correction
10
-
11
- # 1.0.0-beta.24
12
-
13
- - I18N support for Days, Months and 12-hour time variables.
14
-
15
- # 1.0.0-beta.23
16
-
17
- - Zoho security version updated.
18
-
19
- # 1.0.0-beta.22
20
-
21
- - Data test id added for I18N.js
22
-
23
- # 1.0.0-beta.21
24
-
25
- - Data test id added for dateTimedifformat.js
26
-
27
- # 1.0.0-beta.20
28
-
29
- - Date field issue fixed in UserTimeDiffFormat component
30
-
31
- # 1.0.0-beta.19
32
-
33
- - In this version we have made changes in i18n provider to call user date format function only if the time zone data is available.
34
-
35
- # 1.0.0-beta.18
36
-
37
- - Localization feature added and incorporated into getI18NValue Method.
38
-
39
- # 1.0.0-beta.17
40
-
41
- - There was some i18n changes done in live before moving the date format build to live. Since we need these changes we have published it as new version.
42
-
43
- # 1.0.0-beta.16
44
-
45
- - DatePattern and dateTimePattern key has been changed for the date format build.
46
-
47
- # 1.0.0-beta.15.1
48
-
49
- - Zoho security version updated.
50
-
51
- # 1.0.0-beta.15
52
-
53
- - When working on date format build we have published I18n. Also, before moving date format build to master we had a emergency fix that need to be sent, so when publishing I18n we have published the date format changes with the next version.
54
-
55
- # 1.0.0-beta.14
56
-
57
- - Issue fixed in enable current year.
58
-
59
- # 1.0.0-beta.13
60
-
61
- - Issue fixed in due date.
62
-
63
- # 1.0.0-beta.12
64
-
65
- - Issue fixed in date Format Pattern.
66
-
67
- # 1.0.0-beta.11
68
-
69
- - Date Format Changes
70
-
71
- # 1.0.0-beta.10
72
-
73
- - Date Format Issue Fixes
74
-
75
- # 1.0.0-beta.9
76
-
77
- - Date Format Changes
78
-
79
- # 1.0.0-beta.8
80
-
81
- - ES Module Support Changes
82
-
83
- # 1.0.0-beta.7
84
-
85
- - 'userDateFormat' util method - 'others' function fix
86
-
87
- # 1.0.0-beta.6
88
-
89
- - Added new prop 'isNeedTime' for DateTimeDiffFormat Component
90
-
91
- # 1.0.0-beta.5
92
-
93
- - Timezone logic moved to @zohodesk/datetimejs
94
-
95
- # 1.0.0-beta.4
96
-
97
- - Added new prop 'page' for DateTimeDiffFormat Component
98
-
99
- # 1.0.0-beta.3
100
-
101
- - Added support for exact times along with relative times in format() function
102
-
103
- # 1.0.0-beta.0
104
-
105
- - Test Publish
1
+ # i18n
2
+
3
+ # 1.0.0-beta.28
4
+
5
+ - Updating @zoho/SecurityJS package
6
+
7
+ # 1.0.0-beta.27
8
+
9
+ - JSX support within a text
10
+
11
+ # 1.0.0-beta.26
12
+
13
+ - Localization feature enhancement in i18n method.
14
+
15
+ # 1.0.0-beta.25
16
+
17
+ - July i18n key correction
18
+
19
+ # 1.0.0-beta.24
20
+
21
+ - I18N support for Days, Months and 12-hour time variables.
22
+
23
+ # 1.0.0-beta.23
24
+
25
+ - Zoho security version updated.
26
+
27
+ # 1.0.0-beta.22
28
+
29
+ - Data test id added for I18N.js
30
+
31
+ # 1.0.0-beta.21
32
+
33
+ - Data test id added for dateTimedifformat.js
34
+
35
+ # 1.0.0-beta.20
36
+
37
+ - Date field issue fixed in UserTimeDiffFormat component
38
+
39
+ # 1.0.0-beta.19
40
+
41
+ - In this version we have made changes in i18n provider to call user date format function only if the time zone data is available.
42
+
43
+ # 1.0.0-beta.18
44
+
45
+ - Localization feature added and incorporated into getI18NValue Method.
46
+
47
+ # 1.0.0-beta.17
48
+
49
+ - There was some i18n changes done in live before moving the date format build to live. Since we need these changes we have published it as new version.
50
+
51
+ # 1.0.0-beta.16
52
+
53
+ - DatePattern and dateTimePattern key has been changed for the date format build.
54
+
55
+ # 1.0.0-beta.15.1
56
+
57
+ - Zoho security version updated.
58
+
59
+ # 1.0.0-beta.15
60
+
61
+ - When working on date format build we have published I18n. Also, before moving date format build to master we had a emergency fix that need to be sent, so when publishing I18n we have published the date format changes with the next version.
62
+
63
+ # 1.0.0-beta.14
64
+
65
+ - Issue fixed in enable current year.
66
+
67
+ # 1.0.0-beta.13
68
+
69
+ - Issue fixed in due date.
70
+
71
+ # 1.0.0-beta.12
72
+
73
+ - Issue fixed in date Format Pattern.
74
+
75
+ # 1.0.0-beta.11
76
+
77
+ - Date Format Changes
78
+
79
+ # 1.0.0-beta.10
80
+
81
+ - Date Format Issue Fixes
82
+
83
+ # 1.0.0-beta.9
84
+
85
+ - Date Format Changes
86
+
87
+ # 1.0.0-beta.8
88
+
89
+ - ES Module Support Changes
90
+
91
+ # 1.0.0-beta.7
92
+
93
+ - 'userDateFormat' util method - 'others' function fix
94
+
95
+ # 1.0.0-beta.6
96
+
97
+ - Added new prop 'isNeedTime' for DateTimeDiffFormat Component
98
+
99
+ # 1.0.0-beta.5
100
+
101
+ - Timezone logic moved to @zohodesk/datetimejs
102
+
103
+ # 1.0.0-beta.4
104
+
105
+ - Added new prop 'page' for DateTimeDiffFormat Component
106
+
107
+ # 1.0.0-beta.3
108
+
109
+ - Added support for exact times along with relative times in format() function
110
+
111
+ # 1.0.0-beta.0
112
+
113
+ - Test Publish
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { getI18NValue, userDateFormat } from '../utils';
4
+ import { getI18NComponent } from '../utils/jsxTranslations';
4
5
  import { I18NContext } from '../I18NContext';
5
6
  const emptyObj = {};
6
7
 
@@ -8,12 +9,14 @@ const dummy = (key, values) => key;
8
9
 
9
10
  export const i18NProviderUtils = {
10
11
  getI18NValue: dummy,
11
- userDateFormat: dummy
12
+ userDateFormat: dummy,
13
+ getI18NComponent: dummy
12
14
  };
13
15
  export default class I18NProvider extends React.Component {
14
16
  constructor(props, context) {
15
17
  super(props, context);
16
18
  i18NProviderUtils.getI18NValue = getI18NValue(props.i18n);
19
+ i18NProviderUtils.getI18NComponent = getI18NComponent(props.i18n);
17
20
 
18
21
  if (props.tzData) {
19
22
  i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, props.isEnabledCurrentYear);
@@ -37,6 +40,7 @@ export default class I18NProvider extends React.Component {
37
40
  this.reject = rej;
38
41
  }).then(() => {
39
42
  i18NProviderUtils.getI18NValue = getI18NValue(nextProps.i18n);
43
+ i18NProviderUtils.getI18NComponent = getI18NComponent(nextProps.i18n);
40
44
 
41
45
  if (props.tzData) {
42
46
  i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, this.props.isEnabledCurrentYear);