@zohodesk/i18n 1.0.0-beta.17 → 1.0.0-beta.18

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 (62) hide show
  1. package/README.md +73 -69
  2. package/es/components/HOCI18N.js +33 -30
  3. package/es/components/UserTimeDiffFormat.js +6 -5
  4. package/es/components/__tests__/DateTimeDiffFormat.spec.js +177 -136
  5. package/es/components/__tests__/FormatText.spec.js +0 -1
  6. package/es/components/__tests__/HOCI18N.spec.js +0 -1
  7. package/es/components/__tests__/I18N.spec.js +0 -2
  8. package/es/components/__tests__/I18NProvider.spec.js +0 -1
  9. package/es/components/__tests__/PluralFormat.spec.js +0 -1
  10. package/es/components/__tests__/UserTimeDiffFormat.spec.js +287 -206
  11. package/es/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  12. package/es/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  13. package/es/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  14. package/es/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  15. package/es/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  16. package/es/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  17. package/es/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  18. package/es/index.js +1 -1
  19. package/es/utils.js +51 -12
  20. package/lib/components/DateTimeDiffFormat.js +3 -3
  21. package/lib/components/FormatText.js +3 -3
  22. package/lib/components/HOCI18N.js +3 -3
  23. package/lib/components/I18N.js +3 -3
  24. package/lib/components/I18NProvider.js +4 -4
  25. package/lib/components/PluralFormat.js +3 -3
  26. package/lib/components/UserTimeDiffFormat.js +3 -3
  27. package/lib/components/__tests__/I18NProvider.spec.js +1 -1
  28. package/lib/components/__tests__/UserTimeDiffFormat.spec.js +1 -1
  29. package/lib/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  30. package/lib/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  31. package/lib/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  32. package/lib/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  33. package/lib/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  34. package/lib/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  35. package/lib/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  36. package/lib/index.js +58 -52
  37. package/lib/utils.js +58 -20
  38. package/package.json +28 -28
  39. package/src/I18NContext.js +2 -2
  40. package/src/components/DateTimeDiffFormat.js +254 -254
  41. package/src/components/FormatText.js +14 -14
  42. package/src/components/HOCI18N.js +37 -37
  43. package/src/components/I18N.js +72 -72
  44. package/src/components/I18NProvider.js +106 -106
  45. package/src/components/PluralFormat.js +37 -37
  46. package/src/components/UserTimeDiffFormat.js +94 -94
  47. package/src/components/__tests__/DateTimeDiffFormat.spec.js +618 -618
  48. package/src/components/__tests__/FormatText.spec.js +26 -26
  49. package/src/components/__tests__/HOCI18N.spec.js +33 -33
  50. package/src/components/__tests__/I18N.spec.js +29 -29
  51. package/src/components/__tests__/I18NProvider.spec.js +65 -65
  52. package/src/components/__tests__/PluralFormat.spec.js +27 -27
  53. package/src/components/__tests__/UserTimeDiffFormat.spec.js +1076 -1076
  54. package/src/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  55. package/src/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  56. package/src/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  57. package/src/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  58. package/src/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  59. package/src/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  60. package/src/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  61. package/src/index.js +33 -32
  62. package/src/utils.js +527 -497
@@ -1,258 +1,258 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`DateTimeDiffFormat component Should display other - greater time 1`] = `
4
- <span
5
- className={null}
6
- data-title={null}
7
- >
8
-
9
- </span>
10
- `;
11
-
12
- exports[`DateTimeDiffFormat component Should display other - less time 1`] = `
13
- <span
14
- className={null}
15
- data-title={null}
16
- >
17
- less 7 NaN-NaN-NaN
18
- </span>
19
- `;
20
-
21
- exports[`DateTimeDiffFormat component Should display other - same time 1`] = `
22
- <span
23
- className={null}
24
- data-title={null}
25
- >
26
- less 7 NaN-NaN-NaN
27
- </span>
28
- `;
29
-
30
- exports[`DateTimeDiffFormat component Should display other later- less time 1`] = `
31
- <span
32
- className={null}
33
- data-title={null}
34
- >
35
- less 7 NaN-NaN-NaN
36
- </span>
37
- `;
38
-
39
- exports[`DateTimeDiffFormat component Should display other later- less time 2`] = `
40
- <span
41
- className={null}
42
- data-title={null}
43
- >
44
-
45
- </span>
46
- `;
47
-
48
- exports[`DateTimeDiffFormat component Should display other later- same time 1`] = `
49
- <span
50
- className={null}
51
- data-title={null}
52
- >
53
- less 7 NaN-NaN-NaN
54
- </span>
55
- `;
56
-
57
- exports[`DateTimeDiffFormat component Should display others 1`] = `
58
- <span
59
- className={null}
60
- data-title={null}
61
- >
62
- less 7 NaN-NaN-NaN
63
- </span>
64
- `;
65
-
66
- exports[`DateTimeDiffFormat component Should display today ago 1`] = `
67
- <span
68
- className={null}
69
- data-title={null}
70
- >
71
-
72
- </span>
73
- `;
74
-
75
- exports[`DateTimeDiffFormat component Should display today key - greater than 24 hour 1`] = `
76
- <span
77
- className={null}
78
- data-title={null}
79
- >
80
-
81
- </span>
82
- `;
83
-
84
- exports[`DateTimeDiffFormat component Should display today key - less than 24 hour 1`] = `
85
- <span
86
- className={null}
87
- data-title={null}
88
- >
89
-
90
- </span>
91
- `;
92
-
93
- exports[`DateTimeDiffFormat component Should display today key - same time 1`] = `
94
- <span
95
- className={null}
96
- data-title={null}
97
- >
98
-
99
- </span>
100
- `;
101
-
102
- exports[`DateTimeDiffFormat component Should display today later 1`] = `
103
- <span
104
- className={null}
105
- data-title={null}
106
- >
107
-
108
- </span>
109
- `;
110
-
111
- exports[`DateTimeDiffFormat component Should display today1 1`] = `
112
- <div>
113
- <span
114
- className={null}
115
- data-title={null}
116
- >
117
-
118
- </span>
119
- <span
120
- className={null}
121
- data-title={null}
122
- >
123
-
124
- </span>
125
- <span
126
- className={null}
127
- data-title={null}
128
- >
129
-
130
- </span>
131
- <span
132
- className={null}
133
- data-title={null}
134
- >
135
-
136
- </span>
137
- <span
138
- className={null}
139
- data-title={null}
140
- >
141
-
142
- </span>
143
- <span
144
- className={null}
145
- data-title={null}
146
- >
147
-
148
- </span>
149
- <span
150
- className={null}
151
- data-title={null}
152
- >
153
-
154
- </span>
155
- <span
156
- className={null}
157
- data-title={null}
158
- >
159
-
160
- </span>
161
- <span
162
- className={null}
163
- data-title={null}
164
- >
165
-
166
- </span>
167
- <span
168
- className={null}
169
- data-title={null}
170
- >
171
-
172
- </span>
173
- <span
174
- className={null}
175
- data-title={null}
176
- >
177
-
178
- </span>
179
- <span
180
- className={null}
181
- data-title={null}
182
- >
183
-
184
- </span>
185
- </div>
186
- `;
187
-
188
- exports[`DateTimeDiffFormat component Should display tomorrow key - greater than 24 hour 1`] = `
189
- <span
190
- className={null}
191
- data-title={null}
192
- >
193
-
194
- </span>
195
- `;
196
-
197
- exports[`DateTimeDiffFormat component Should display tomorrow key - less than 24 hour 1`] = `
198
- <span
199
- className={null}
200
- data-title={null}
201
- >
202
-
203
- </span>
204
- `;
205
-
206
- exports[`DateTimeDiffFormat component Should display tomorrow key - same time 1`] = `
207
- <span
208
- className={null}
209
- data-title={null}
210
- >
211
-
212
- </span>
213
- `;
214
-
215
- exports[`DateTimeDiffFormat component Should display years and days 1`] = `
216
- <span
217
- className={null}
218
- data-title={null}
219
- >
220
- 2 years 62 days ago
221
- </span>
222
- `;
223
-
224
- exports[`DateTimeDiffFormat component Should display years and days1 1`] = `
225
- <span
226
- className={null}
227
- data-title={null}
228
- >
229
- 2 years 62 days later
230
- </span>
231
- `;
232
-
233
- exports[`DateTimeDiffFormat component Should display yesterday - greater than 24 hour 1`] = `
234
- <span
235
- className={null}
236
- data-title={null}
237
- >
238
-
239
- </span>
240
- `;
241
-
242
- exports[`DateTimeDiffFormat component Should display yesterday - less than 24 hour 1`] = `
243
- <span
244
- className={null}
245
- data-title={null}
246
- >
247
-
248
- </span>
249
- `;
250
-
251
- exports[`DateTimeDiffFormat component Should display yesterday - with same time 1`] = `
252
- <span
253
- className={null}
254
- data-title={null}
255
- >
256
-
257
- </span>
258
- `;
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`DateTimeDiffFormat component Should display other - greater time 1`] = `
4
+ <span
5
+ className={null}
6
+ data-title={null}
7
+ >
8
+
9
+ </span>
10
+ `;
11
+
12
+ exports[`DateTimeDiffFormat component Should display other - less time 1`] = `
13
+ <span
14
+ className={null}
15
+ data-title={null}
16
+ >
17
+ less 7 NaN-NaN-NaN
18
+ </span>
19
+ `;
20
+
21
+ exports[`DateTimeDiffFormat component Should display other - same time 1`] = `
22
+ <span
23
+ className={null}
24
+ data-title={null}
25
+ >
26
+ less 7 NaN-NaN-NaN
27
+ </span>
28
+ `;
29
+
30
+ exports[`DateTimeDiffFormat component Should display other later- less time 1`] = `
31
+ <span
32
+ className={null}
33
+ data-title={null}
34
+ >
35
+ less 7 NaN-NaN-NaN
36
+ </span>
37
+ `;
38
+
39
+ exports[`DateTimeDiffFormat component Should display other later- less time 2`] = `
40
+ <span
41
+ className={null}
42
+ data-title={null}
43
+ >
44
+
45
+ </span>
46
+ `;
47
+
48
+ exports[`DateTimeDiffFormat component Should display other later- same time 1`] = `
49
+ <span
50
+ className={null}
51
+ data-title={null}
52
+ >
53
+ less 7 NaN-NaN-NaN
54
+ </span>
55
+ `;
56
+
57
+ exports[`DateTimeDiffFormat component Should display others 1`] = `
58
+ <span
59
+ className={null}
60
+ data-title={null}
61
+ >
62
+ less 7 NaN-NaN-NaN
63
+ </span>
64
+ `;
65
+
66
+ exports[`DateTimeDiffFormat component Should display today ago 1`] = `
67
+ <span
68
+ className={null}
69
+ data-title={null}
70
+ >
71
+
72
+ </span>
73
+ `;
74
+
75
+ exports[`DateTimeDiffFormat component Should display today key - greater than 24 hour 1`] = `
76
+ <span
77
+ className={null}
78
+ data-title={null}
79
+ >
80
+
81
+ </span>
82
+ `;
83
+
84
+ exports[`DateTimeDiffFormat component Should display today key - less than 24 hour 1`] = `
85
+ <span
86
+ className={null}
87
+ data-title={null}
88
+ >
89
+
90
+ </span>
91
+ `;
92
+
93
+ exports[`DateTimeDiffFormat component Should display today key - same time 1`] = `
94
+ <span
95
+ className={null}
96
+ data-title={null}
97
+ >
98
+
99
+ </span>
100
+ `;
101
+
102
+ exports[`DateTimeDiffFormat component Should display today later 1`] = `
103
+ <span
104
+ className={null}
105
+ data-title={null}
106
+ >
107
+
108
+ </span>
109
+ `;
110
+
111
+ exports[`DateTimeDiffFormat component Should display today1 1`] = `
112
+ <div>
113
+ <span
114
+ className={null}
115
+ data-title={null}
116
+ >
117
+
118
+ </span>
119
+ <span
120
+ className={null}
121
+ data-title={null}
122
+ >
123
+
124
+ </span>
125
+ <span
126
+ className={null}
127
+ data-title={null}
128
+ >
129
+
130
+ </span>
131
+ <span
132
+ className={null}
133
+ data-title={null}
134
+ >
135
+
136
+ </span>
137
+ <span
138
+ className={null}
139
+ data-title={null}
140
+ >
141
+
142
+ </span>
143
+ <span
144
+ className={null}
145
+ data-title={null}
146
+ >
147
+
148
+ </span>
149
+ <span
150
+ className={null}
151
+ data-title={null}
152
+ >
153
+
154
+ </span>
155
+ <span
156
+ className={null}
157
+ data-title={null}
158
+ >
159
+
160
+ </span>
161
+ <span
162
+ className={null}
163
+ data-title={null}
164
+ >
165
+
166
+ </span>
167
+ <span
168
+ className={null}
169
+ data-title={null}
170
+ >
171
+
172
+ </span>
173
+ <span
174
+ className={null}
175
+ data-title={null}
176
+ >
177
+
178
+ </span>
179
+ <span
180
+ className={null}
181
+ data-title={null}
182
+ >
183
+
184
+ </span>
185
+ </div>
186
+ `;
187
+
188
+ exports[`DateTimeDiffFormat component Should display tomorrow key - greater than 24 hour 1`] = `
189
+ <span
190
+ className={null}
191
+ data-title={null}
192
+ >
193
+
194
+ </span>
195
+ `;
196
+
197
+ exports[`DateTimeDiffFormat component Should display tomorrow key - less than 24 hour 1`] = `
198
+ <span
199
+ className={null}
200
+ data-title={null}
201
+ >
202
+
203
+ </span>
204
+ `;
205
+
206
+ exports[`DateTimeDiffFormat component Should display tomorrow key - same time 1`] = `
207
+ <span
208
+ className={null}
209
+ data-title={null}
210
+ >
211
+
212
+ </span>
213
+ `;
214
+
215
+ exports[`DateTimeDiffFormat component Should display years and days 1`] = `
216
+ <span
217
+ className={null}
218
+ data-title={null}
219
+ >
220
+ 2 years 62 days ago
221
+ </span>
222
+ `;
223
+
224
+ exports[`DateTimeDiffFormat component Should display years and days1 1`] = `
225
+ <span
226
+ className={null}
227
+ data-title={null}
228
+ >
229
+ 2 years 62 days later
230
+ </span>
231
+ `;
232
+
233
+ exports[`DateTimeDiffFormat component Should display yesterday - greater than 24 hour 1`] = `
234
+ <span
235
+ className={null}
236
+ data-title={null}
237
+ >
238
+
239
+ </span>
240
+ `;
241
+
242
+ exports[`DateTimeDiffFormat component Should display yesterday - less than 24 hour 1`] = `
243
+ <span
244
+ className={null}
245
+ data-title={null}
246
+ >
247
+
248
+ </span>
249
+ `;
250
+
251
+ exports[`DateTimeDiffFormat component Should display yesterday - with same time 1`] = `
252
+ <span
253
+ className={null}
254
+ data-title={null}
255
+ >
256
+
257
+ </span>
258
+ `;
@@ -1,17 +1,17 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`FormatText component Should display i18n value 1`] = `
4
- <span>
5
- vimal1&lt;b&gt;vimal&lt;/b&gt;
6
- </span>
7
- `;
8
-
9
- exports[`FormatText component Should display i18n value as html 1`] = `
10
- <span
11
- dangerouslySetInnerHTML={
12
- Object {
13
- "__html": "vimal1<b>vimal</b>",
14
- }
15
- }
16
- />
17
- `;
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`FormatText component Should display i18n value 1`] = `
4
+ <span>
5
+ vimal1&lt;b&gt;vimal&lt;/b&gt;
6
+ </span>
7
+ `;
8
+
9
+ exports[`FormatText component Should display i18n value as html 1`] = `
10
+ <span
11
+ dangerouslySetInnerHTML={
12
+ Object {
13
+ "__html": "vimal1<b>vimal</b>",
14
+ }
15
+ }
16
+ />
17
+ `;
@@ -1,15 +1,15 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`I18N component Should display i18n key 1`] = `
4
- <div>
5
- test
6
- key1
7
- </div>
8
- `;
9
-
10
- exports[`I18N component Should display i18n value 1`] = `
11
- <div>
12
- test
13
- vimal1
14
- </div>
15
- `;
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`I18N component Should display i18n key 1`] = `
4
+ <div>
5
+ test
6
+ key1
7
+ </div>
8
+ `;
9
+
10
+ exports[`I18N component Should display i18n value 1`] = `
11
+ <div>
12
+ test
13
+ vimal1
14
+ </div>
15
+ `;
@@ -1,17 +1,17 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`I18N component Should display i18n value 1`] = `
4
- <span>
5
- vimal1&lt;b&gt;vimal&lt;/b&gt;
6
- </span>
7
- `;
8
-
9
- exports[`I18N component Should display i18n value as html 1`] = `
10
- <span
11
- dangerouslySetInnerHTML={
12
- Object {
13
- "__html": "vimal1<b>vimal</b>",
14
- }
15
- }
16
- />
17
- `;
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`I18N component Should display i18n value 1`] = `
4
+ <span>
5
+ vimal1&lt;b&gt;vimal&lt;/b&gt;
6
+ </span>
7
+ `;
8
+
9
+ exports[`I18N component Should display i18n value as html 1`] = `
10
+ <span
11
+ dangerouslySetInnerHTML={
12
+ Object {
13
+ "__html": "vimal1<b>vimal</b>",
14
+ }
15
+ }
16
+ />
17
+ `;
@@ -1,13 +1,13 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`I18NProvider component Should display i18n value 1`] = `
4
- <span>
5
- vimal
6
- </span>
7
- `;
8
-
9
- exports[`I18NProvider component Should display key not available case 1`] = `
10
- <span>
11
- key2
12
- </span>
13
- `;
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`I18NProvider component Should display i18n value 1`] = `
4
+ <span>
5
+ vimal
6
+ </span>
7
+ `;
8
+
9
+ exports[`I18NProvider component Should display key not available case 1`] = `
10
+ <span>
11
+ key2
12
+ </span>
13
+ `;
@@ -1,17 +1,17 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`PluralFormat component Should display i18n value 1`] = `
4
- <span>
5
- vimal1&lt;b&gt;vimal&lt;/b&gt;
6
- </span>
7
- `;
8
-
9
- exports[`PluralFormat component Should display i18n value as html 1`] = `
10
- <span
11
- dangerouslySetInnerHTML={
12
- Object {
13
- "__html": "vimal1<b>vimal</b>",
14
- }
15
- }
16
- />
17
- `;
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`PluralFormat component Should display i18n value 1`] = `
4
+ <span>
5
+ vimal1&lt;b&gt;vimal&lt;/b&gt;
6
+ </span>
7
+ `;
8
+
9
+ exports[`PluralFormat component Should display i18n value as html 1`] = `
10
+ <span
11
+ dangerouslySetInnerHTML={
12
+ Object {
13
+ "__html": "vimal1<b>vimal</b>",
14
+ }
15
+ }
16
+ />
17
+ `;