@zohodesk/i18n 1.0.0-beta.25 → 1.0.0-beta.27

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