@zohodesk/i18n 1.0.0-beta.2 → 1.0.0-beta.21

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 (67) hide show
  1. package/README.md +80 -0
  2. package/es/I18NContext.js +1 -2
  3. package/es/components/DateTimeDiffFormat.js +192 -184
  4. package/es/components/FormatText.js +4 -25
  5. package/es/components/HOCI18N.js +33 -45
  6. package/es/components/I18N.js +46 -63
  7. package/es/components/I18NProvider.js +54 -84
  8. package/es/components/PluralFormat.js +29 -48
  9. package/es/components/UserTimeDiffFormat.js +65 -70
  10. package/es/components/__tests__/DateTimeDiffFormat.spec.js +868 -657
  11. package/es/components/__tests__/FormatText.spec.js +20 -17
  12. package/es/components/__tests__/HOCI18N.spec.js +18 -22
  13. package/es/components/__tests__/I18N.spec.js +20 -19
  14. package/es/components/__tests__/I18NProvider.spec.js +36 -45
  15. package/es/components/__tests__/PluralFormat.spec.js +20 -17
  16. package/es/components/__tests__/UserTimeDiffFormat.spec.js +1343 -1095
  17. package/es/index.js +2 -6
  18. package/es/utils.js +250 -385
  19. package/lib/I18NContext.js +6 -6
  20. package/lib/components/DateTimeDiffFormat.js +167 -123
  21. package/lib/components/FormatText.js +32 -22
  22. package/lib/components/HOCI18N.js +47 -23
  23. package/lib/components/I18N.js +60 -36
  24. package/lib/components/I18NProvider.js +76 -69
  25. package/lib/components/PluralFormat.js +42 -32
  26. package/lib/components/UserTimeDiffFormat.js +81 -54
  27. package/lib/components/__tests__/DateTimeDiffFormat.spec.js +815 -629
  28. package/lib/components/__tests__/FormatText.spec.js +23 -25
  29. package/lib/components/__tests__/HOCI18N.spec.js +26 -34
  30. package/lib/components/__tests__/I18N.spec.js +21 -26
  31. package/lib/components/__tests__/I18NProvider.spec.js +43 -51
  32. package/lib/components/__tests__/PluralFormat.spec.js +24 -28
  33. package/lib/components/__tests__/UserTimeDiffFormat.spec.js +1256 -1039
  34. package/lib/index.js +73 -119
  35. package/lib/utils.js +222 -329
  36. package/package.json +2 -2
  37. package/src/I18NContext.js +3 -0
  38. package/src/components/DateTimeDiffFormat.js +256 -0
  39. package/src/components/FormatText.js +14 -0
  40. package/src/components/HOCI18N.js +37 -0
  41. package/src/components/I18N.js +72 -0
  42. package/src/components/I18NProvider.js +110 -0
  43. package/src/components/PluralFormat.js +37 -0
  44. package/src/components/UserTimeDiffFormat.js +97 -0
  45. package/src/components/__tests__/DateTimeDiffFormat.spec.js +618 -0
  46. package/src/components/__tests__/FormatText.spec.js +27 -0
  47. package/src/components/__tests__/HOCI18N.spec.js +33 -0
  48. package/src/components/__tests__/I18N.spec.js +30 -0
  49. package/src/components/__tests__/I18NProvider.spec.js +65 -0
  50. package/src/components/__tests__/PluralFormat.spec.js +28 -0
  51. package/src/components/__tests__/UserTimeDiffFormat.spec.js +1076 -0
  52. package/src/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -0
  53. package/src/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -0
  54. package/src/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -0
  55. package/src/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -0
  56. package/src/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -0
  57. package/src/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -0
  58. package/src/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -0
  59. package/src/index.js +33 -0
  60. package/src/utils.js +527 -0
  61. package/.DS_Store +0 -0
  62. package/es/components/NewDateFormat.js +0 -50
  63. package/es/offset.js +0 -629
  64. package/es/timezones.js +0 -112
  65. package/lib/components/NewDateFormat.js +0 -68
  66. package/lib/offset.js +0 -634
  67. package/lib/timezones.js +0 -120
@@ -0,0 +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
+ `;
@@ -0,0 +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
+ `;
@@ -0,0 +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
+ `;
@@ -0,0 +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
+ `;
@@ -0,0 +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
+ `;
@@ -0,0 +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
+ `;
@@ -0,0 +1,366 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`UserTimeDiffFormat component Should display other - greater time 1`] = `
4
+ <span
5
+ className={null}
6
+ data-title={null}
7
+ >
8
+ yesterday
9
+ </span>
10
+ `;
11
+
12
+ exports[`UserTimeDiffFormat component Should display other - less time 1`] = `
13
+ <span
14
+ className={null}
15
+ data-title={null}
16
+ >
17
+ less 7 23-10-2016
18
+ </span>
19
+ `;
20
+
21
+ exports[`UserTimeDiffFormat component Should display other - same time 1`] = `
22
+ <span
23
+ className={null}
24
+ data-title={null}
25
+ >
26
+ less 7 23-10-2016
27
+ </span>
28
+ `;
29
+
30
+ exports[`UserTimeDiffFormat component Should display other later- less time 1`] = `
31
+ <span
32
+ className={null}
33
+ data-title={null}
34
+ >
35
+ less 7 27-10-2016
36
+ </span>
37
+ `;
38
+
39
+ exports[`UserTimeDiffFormat component Should display other later- less time 2`] = `
40
+ <span
41
+ className={null}
42
+ data-title={null}
43
+ >
44
+ tomorrow
45
+ </span>
46
+ `;
47
+
48
+ exports[`UserTimeDiffFormat component Should display other later- same time 1`] = `
49
+ <span
50
+ className={null}
51
+ data-title={null}
52
+ >
53
+ less 7 27-10-2016
54
+ </span>
55
+ `;
56
+
57
+ exports[`UserTimeDiffFormat component Should display others 1`] = `
58
+ <span
59
+ className={null}
60
+ data-title={null}
61
+ >
62
+ less 7 27-11-2016
63
+ </span>
64
+ `;
65
+
66
+ exports[`UserTimeDiffFormat component Should display today ago - user 1`] = `
67
+ <span
68
+ className={null}
69
+ data-title={null}
70
+ >
71
+ 00:00:01 ago
72
+ </span>
73
+ `;
74
+
75
+ exports[`UserTimeDiffFormat component Should display today ago 1`] = `
76
+ <span
77
+ className={null}
78
+ data-title={null}
79
+ >
80
+ 00:00:01 later
81
+ </span>
82
+ `;
83
+
84
+ exports[`UserTimeDiffFormat component Should display today key - greater than 24 hour 1`] = `
85
+ <span
86
+ className={null}
87
+ data-title={null}
88
+ >
89
+ today.later
90
+ </span>
91
+ `;
92
+
93
+ exports[`UserTimeDiffFormat component Should display today key - less than 24 hour 1`] = `
94
+ <span
95
+ className={null}
96
+ data-title={null}
97
+ >
98
+ today.ago
99
+ </span>
100
+ `;
101
+
102
+ exports[`UserTimeDiffFormat component Should display today key - same time 1`] = `
103
+ <span
104
+ className={null}
105
+ data-title={null}
106
+ >
107
+ today
108
+ </span>
109
+ `;
110
+
111
+ exports[`UserTimeDiffFormat component Should display today key - user 1`] = `
112
+ <span
113
+ className={null}
114
+ data-title={null}
115
+ >
116
+ today
117
+ </span>
118
+ `;
119
+
120
+ exports[`UserTimeDiffFormat component Should display today later - user 1`] = `
121
+ <span
122
+ className={null}
123
+ data-title={null}
124
+ >
125
+ 00:00:01 later
126
+ </span>
127
+ `;
128
+
129
+ exports[`UserTimeDiffFormat component Should display today later 1`] = `
130
+ <span
131
+ className={null}
132
+ data-title={null}
133
+ >
134
+ 00:00:01 later
135
+ </span>
136
+ `;
137
+
138
+ exports[`UserTimeDiffFormat component Should display today1 1`] = `
139
+ <div>
140
+ <span
141
+ className={null}
142
+ data-title={null}
143
+ >
144
+
145
+ </span>
146
+ <span
147
+ className={null}
148
+ data-title={null}
149
+ >
150
+
151
+ </span>
152
+ <span
153
+ className={null}
154
+ data-title={null}
155
+ >
156
+
157
+ </span>
158
+ <span
159
+ className={null}
160
+ data-title={null}
161
+ >
162
+
163
+ </span>
164
+ <span
165
+ className={null}
166
+ data-title={null}
167
+ >
168
+
169
+ </span>
170
+ <span
171
+ className={null}
172
+ data-title={null}
173
+ >
174
+
175
+ </span>
176
+ <span
177
+ className={null}
178
+ data-title={null}
179
+ >
180
+
181
+ </span>
182
+ <span
183
+ className={null}
184
+ data-title={null}
185
+ >
186
+
187
+ </span>
188
+ <span
189
+ className={null}
190
+ data-title={null}
191
+ >
192
+
193
+ </span>
194
+ <span
195
+ className={null}
196
+ data-title={null}
197
+ >
198
+
199
+ </span>
200
+ <span
201
+ className={null}
202
+ data-title={null}
203
+ >
204
+
205
+ </span>
206
+ <span
207
+ className={null}
208
+ data-title={null}
209
+ >
210
+
211
+ </span>
212
+ </div>
213
+ `;
214
+
215
+ exports[`UserTimeDiffFormat component Should display tomorrow key - greater than 24 hour 1`] = `
216
+ <span
217
+ className={null}
218
+ data-title={null}
219
+ >
220
+ tomorrow
221
+ </span>
222
+ `;
223
+
224
+ exports[`UserTimeDiffFormat component Should display tomorrow key - less than 24 hour 1`] = `
225
+ <span
226
+ className={null}
227
+ data-title={null}
228
+ >
229
+ tomorrow
230
+ </span>
231
+ `;
232
+
233
+ exports[`UserTimeDiffFormat component Should display tomorrow key - same time 1`] = `
234
+ <span
235
+ className={null}
236
+ data-title={null}
237
+ >
238
+ tomorrow
239
+ </span>
240
+ `;
241
+
242
+ exports[`UserTimeDiffFormat component Should display years and days 1`] = `
243
+ <span
244
+ className={null}
245
+ data-title={null}
246
+ >
247
+
248
+ </span>
249
+ `;
250
+
251
+ exports[`UserTimeDiffFormat component Should display years and days1 1`] = `
252
+ <span
253
+ className={null}
254
+ data-title={null}
255
+ >
256
+
257
+ </span>
258
+ `;
259
+
260
+ exports[`UserTimeDiffFormat component Should display yesterday - greater than 24 hour 1`] = `
261
+ <span
262
+ className={null}
263
+ data-title={null}
264
+ >
265
+ yesterday
266
+ </span>
267
+ `;
268
+
269
+ exports[`UserTimeDiffFormat component Should display yesterday - less than 24 hour 1`] = `
270
+ <span
271
+ className={null}
272
+ data-title={null}
273
+ >
274
+ yesterday
275
+ </span>
276
+ `;
277
+
278
+ exports[`UserTimeDiffFormat component Should display yesterday - with same time 1`] = `
279
+ <span
280
+ className={null}
281
+ data-title={null}
282
+ >
283
+ yesterday
284
+ </span>
285
+ `;
286
+
287
+ exports[`UserTimeDiffFormat component created time today 1`] = `
288
+ <span
289
+ className={null}
290
+ data-title={null}
291
+ >
292
+ 12:25 PM
293
+ </span>
294
+ `;
295
+
296
+ exports[`UserTimeDiffFormat component created time tomorrow 1`] = `
297
+ <span
298
+ className={null}
299
+ data-title={null}
300
+ >
301
+ tommorrow 12:25 PM
302
+ </span>
303
+ `;
304
+
305
+ exports[`UserTimeDiffFormat component created time within 7 days 1`] = `
306
+ <span
307
+ className={null}
308
+ data-title={null}
309
+ >
310
+
311
+ </span>
312
+ `;
313
+
314
+ exports[`UserTimeDiffFormat component created time within pattern 1`] = `
315
+ <span
316
+ className={null}
317
+ data-title={null}
318
+ >
319
+
320
+ </span>
321
+ `;
322
+
323
+ exports[`UserTimeDiffFormat component created time yesterday 1`] = `
324
+ <span
325
+ className={null}
326
+ data-title={null}
327
+ >
328
+ yesterday 12:25 PM
329
+ </span>
330
+ `;
331
+
332
+ exports[`UserTimeDiffFormat component task due date set - overdue 1`] = `
333
+ <span
334
+ className={null}
335
+ data-title={null}
336
+ >
337
+
338
+ </span>
339
+ `;
340
+
341
+ exports[`UserTimeDiffFormat component task due date set - today [hh:mm:AM/PM] 1`] = `
342
+ <span
343
+ className={null}
344
+ data-title="late by 364 days"
345
+ >
346
+ 25-10-2015
347
+ </span>
348
+ `;
349
+
350
+ exports[`UserTimeDiffFormat component task due date set - tomorrow [hh:mm:AM/PM] 1`] = `
351
+ <span
352
+ className={null}
353
+ data-title={null}
354
+ >
355
+ tommorrow 10:25 AM
356
+ </span>
357
+ `;
358
+
359
+ exports[`UserTimeDiffFormat component task due date set - yesterday dd:MM:YYYY hh:mm:A 1`] = `
360
+ <span
361
+ className={null}
362
+ data-title={null}
363
+ >
364
+ 24/10/2016 12:25 PM
365
+ </span>
366
+ `;