globalize-rpk 1.7.0
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/CONTRIBUTING.md +5 -0
- package/LICENSE +20 -0
- package/README.md +818 -0
- package/doc/api/core/constructor.md +28 -0
- package/doc/api/core/load.md +96 -0
- package/doc/api/core/locale.md +43 -0
- package/doc/api/currency/currency-formatter.md +196 -0
- package/doc/api/currency/currency-to-parts-formatter.md +117 -0
- package/doc/api/date/date-formatter.md +203 -0
- package/doc/api/date/date-parser.md +60 -0
- package/doc/api/date/date-to-parts-formatter.md +176 -0
- package/doc/api/date/load-iana-time-zone.md +29 -0
- package/doc/api/message/load-messages.md +105 -0
- package/doc/api/message/message-formatter.md +208 -0
- package/doc/api/number/number-formatter.md +202 -0
- package/doc/api/number/number-parser.md +130 -0
- package/doc/api/number/number-to-parts-formatter.md +140 -0
- package/doc/api/plural/plural-generator.md +84 -0
- package/doc/api/relative-time/relative-time-formatter.md +60 -0
- package/doc/api/unit/unit-formatter.md +72 -0
- package/doc/blog-post/2017-07-xx-1.3.0-announcement.md +177 -0
- package/doc/cldr.md +114 -0
- package/doc/error/e-default-locale-not-defined.md +9 -0
- package/doc/error/e-invalid-cldr.md +14 -0
- package/doc/error/e-invalid-par-type.md +12 -0
- package/doc/error/e-invalid-par-value.md +11 -0
- package/doc/error/e-missing-cldr.md +11 -0
- package/doc/error/e-missing-parameter.md +10 -0
- package/doc/error/e-missing-plural-module.md +9 -0
- package/doc/error/e-par-missing-key.md +11 -0
- package/doc/error/e-par-out-of-range.md +13 -0
- package/doc/error/e-unsupported.md +10 -0
- package/doc/migrating-from-0.x.md +64 -0
- package/examples/amd-bower/.bowerrc +7 -0
- package/examples/amd-bower/README.md +65 -0
- package/examples/amd-bower/bower.json +13 -0
- package/examples/amd-bower/index.html +46 -0
- package/examples/amd-bower/main.js +141 -0
- package/examples/amd-bower/messages/en.json +12 -0
- package/examples/amd-bower/package.json +14 -0
- package/examples/app-npm-webpack/README.md +74 -0
- package/examples/app-npm-webpack/app/index.js +89 -0
- package/examples/app-npm-webpack/index-template.html +71 -0
- package/examples/app-npm-webpack/messages/ar.json +25 -0
- package/examples/app-npm-webpack/messages/de.json +21 -0
- package/examples/app-npm-webpack/messages/en.json +21 -0
- package/examples/app-npm-webpack/messages/es.json +21 -0
- package/examples/app-npm-webpack/messages/pt.json +21 -0
- package/examples/app-npm-webpack/messages/ru.json +23 -0
- package/examples/app-npm-webpack/messages/zh.json +20 -0
- package/examples/app-npm-webpack/package.json +17 -0
- package/examples/app-npm-webpack/webpack-config.js +63 -0
- package/examples/globalize-compiler/README.md +45 -0
- package/examples/globalize-compiler/app.js +58 -0
- package/examples/globalize-compiler/development.html +121 -0
- package/examples/globalize-compiler/messages.json +12 -0
- package/examples/globalize-compiler/package.json +15 -0
- package/examples/globalize-compiler/production.html +75 -0
- package/examples/node-npm/README.md +57 -0
- package/examples/node-npm/main.js +65 -0
- package/examples/node-npm/messages/en.json +12 -0
- package/examples/node-npm/package.json +10 -0
- package/examples/plain-javascript/README.md +81 -0
- package/examples/plain-javascript/index.html +445 -0
- package/package.json +109 -0
@@ -0,0 +1,445 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<head>
|
3
|
+
<meta charset="utf-8">
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
5
|
+
<title>Globalize Hello World (plain javascript)</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<h1>Globalize Hello World (plain javascript)</h1>
|
9
|
+
|
10
|
+
<div id="requirements">
|
11
|
+
<h2>Requirements</h2>
|
12
|
+
<ul>
|
13
|
+
<li>You need to download `cldrjs` and `globalize` dependencies yourself. Read README.md for instructions.
|
14
|
+
</li>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div id="demo" style="display: none">
|
19
|
+
<h2>Demo output</h2>
|
20
|
+
<p>Now: <span id="date"></span></p>
|
21
|
+
<p>Now: <span id="dateToParts"></span> (note the highlighted month, the markup was added using formatDateToParts)</p>
|
22
|
+
<p>Now (in America/Sao_Paulo): <span id="zonedDate"></span></p>
|
23
|
+
<p>A number: <span id="number"></span></p>
|
24
|
+
<p>A number (compact form): <span id="number-compact"></span></p>
|
25
|
+
<p>A currency: <span id="currency"></span></p>
|
26
|
+
<p>Plural form of <span id="plural-number"></span> is <span id="plural-form"></span></p>
|
27
|
+
<p>Messages:</p>
|
28
|
+
<ul>
|
29
|
+
<li><span id="message-0"></span></li>
|
30
|
+
<li><span id="message-1"></span></li>
|
31
|
+
<li><span id="message-2"></span></li>
|
32
|
+
<li><span id="message-3"></span></li>
|
33
|
+
</ul>
|
34
|
+
<p>Something happened: <span id="relative-time"></span></p>
|
35
|
+
<p>Speed limit: <span id="unit"></span></p>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<!--
|
39
|
+
First, we load Globalize's dependencies (`cldrjs` and its supplemental
|
40
|
+
module).
|
41
|
+
-->
|
42
|
+
<script src="cldrjs/dist/cldr.js"></script>
|
43
|
+
<script src="cldrjs/dist/cldr/event.js"></script>
|
44
|
+
<script src="cldrjs/dist/cldr/supplemental.js"></script>
|
45
|
+
|
46
|
+
<!--
|
47
|
+
Next, we load Globalize and its modules. Note they are already available on
|
48
|
+
this repository. If it's not, read Usage on Getting Started on the root's
|
49
|
+
README.md.
|
50
|
+
-->
|
51
|
+
<script src="globalize/dist/globalize.js"></script>
|
52
|
+
<script src="globalize/dist/globalize/message.js"></script>
|
53
|
+
<script src="globalize/dist/globalize/number.js"></script>
|
54
|
+
<script src="globalize/dist/globalize/plural.js"></script>
|
55
|
+
|
56
|
+
<!-- Load after globalize/number.js -->
|
57
|
+
<script src="globalize/dist/globalize/date.js"></script>
|
58
|
+
<script src="globalize/dist/globalize/currency.js"></script>
|
59
|
+
|
60
|
+
<!-- Load after globalize/number.js and globalize/plural.js-->
|
61
|
+
<script src="globalize/dist/globalize/relative-time.js"></script>
|
62
|
+
<script src="globalize/dist/globalize/unit.js"></script>
|
63
|
+
|
64
|
+
<script>
|
65
|
+
|
66
|
+
// At this point, we have Globalize loaded. But, before we can use it, we
|
67
|
+
// need to feed it on the appropriate I18n content (Unicode CLDR). In order
|
68
|
+
// to do so, we use `Globalize.load()` and pass the content. On this demo,
|
69
|
+
// we made the things a little easier for you: we've embedded static JSON
|
70
|
+
// into the demo. So, you don't need to actually fetch it elsewhere.
|
71
|
+
Globalize.load({
|
72
|
+
"main": {
|
73
|
+
"en": {
|
74
|
+
"identity": {
|
75
|
+
"version": {
|
76
|
+
"_cldrVersion": "25",
|
77
|
+
"_number": "$Revision: 91 $"
|
78
|
+
},
|
79
|
+
"generation": {
|
80
|
+
"_date": "$Date: 2014-03-13 22:27:12 -0500 (Thu, 13 Mar 2014) $"
|
81
|
+
},
|
82
|
+
"language": "en"
|
83
|
+
},
|
84
|
+
"dates": {
|
85
|
+
"calendars": {
|
86
|
+
"gregorian": {
|
87
|
+
"days": {
|
88
|
+
"format": {
|
89
|
+
"wide": {
|
90
|
+
"sun": "Sunday",
|
91
|
+
"mon": "Monday",
|
92
|
+
"tue": "Tuesday",
|
93
|
+
"wed": "Wednesday",
|
94
|
+
"thu": "Thursday",
|
95
|
+
"fri": "Friday",
|
96
|
+
"sat": "Saturday"
|
97
|
+
}
|
98
|
+
}
|
99
|
+
},
|
100
|
+
"months": {
|
101
|
+
"format": {
|
102
|
+
"abbreviated": {
|
103
|
+
"1": "Jan",
|
104
|
+
"2": "Feb",
|
105
|
+
"3": "Mar",
|
106
|
+
"4": "Apr",
|
107
|
+
"5": "May",
|
108
|
+
"6": "Jun",
|
109
|
+
"7": "Jul",
|
110
|
+
"8": "Aug",
|
111
|
+
"9": "Sep",
|
112
|
+
"10": "Oct",
|
113
|
+
"11": "Nov",
|
114
|
+
"12": "Dec"
|
115
|
+
},
|
116
|
+
"wide": {
|
117
|
+
"1": "January",
|
118
|
+
"2": "February",
|
119
|
+
"3": "March",
|
120
|
+
"4": "April",
|
121
|
+
"5": "May",
|
122
|
+
"6": "June",
|
123
|
+
"7": "July",
|
124
|
+
"8": "August",
|
125
|
+
"9": "September",
|
126
|
+
"10": "October",
|
127
|
+
"11": "November",
|
128
|
+
"12": "December"
|
129
|
+
}
|
130
|
+
}
|
131
|
+
},
|
132
|
+
"dayPeriods": {
|
133
|
+
"format": {
|
134
|
+
"wide": {
|
135
|
+
"am": "AM",
|
136
|
+
"am-alt-variant": "am",
|
137
|
+
"noon": "noon",
|
138
|
+
"pm": "PM",
|
139
|
+
"pm-alt-variant": "pm"
|
140
|
+
}
|
141
|
+
}
|
142
|
+
},
|
143
|
+
"dateFormats": {
|
144
|
+
"full": "EEEE, MMMM d, y",
|
145
|
+
"medium": "MMM d, y"
|
146
|
+
},
|
147
|
+
"timeFormats": {
|
148
|
+
"full": "h:mm:ss a zzzz",
|
149
|
+
"medium": "h:mm:ss a",
|
150
|
+
},
|
151
|
+
"dateTimeFormats": {
|
152
|
+
"full": "{1} 'at' {0}",
|
153
|
+
"medium": "{1}, {0}"
|
154
|
+
}
|
155
|
+
}
|
156
|
+
},
|
157
|
+
"fields": {
|
158
|
+
"second": {
|
159
|
+
"displayName": "Second",
|
160
|
+
"relative-type-0": "now",
|
161
|
+
"relativeTime-type-future": {
|
162
|
+
"relativeTimePattern-count-one": "in {0} second",
|
163
|
+
"relativeTimePattern-count-other": "in {0} seconds"
|
164
|
+
},
|
165
|
+
"relativeTime-type-past": {
|
166
|
+
"relativeTimePattern-count-one": "{0} second ago",
|
167
|
+
"relativeTimePattern-count-other": "{0} seconds ago"
|
168
|
+
}
|
169
|
+
}
|
170
|
+
},
|
171
|
+
"timeZoneNames": {
|
172
|
+
"metazone": {
|
173
|
+
"Brasilia": {
|
174
|
+
"long": {
|
175
|
+
"generic": "Brasilia Time",
|
176
|
+
"standard": "Brasilia Standard Time",
|
177
|
+
"daylight": "Brasilia Summer Time"
|
178
|
+
}
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}
|
182
|
+
},
|
183
|
+
"numbers": {
|
184
|
+
"currencies": {
|
185
|
+
"USD": {
|
186
|
+
"symbol": "$"
|
187
|
+
}
|
188
|
+
},
|
189
|
+
"defaultNumberingSystem": "latn",
|
190
|
+
"symbols-numberSystem-latn": {
|
191
|
+
"decimal": ".",
|
192
|
+
"exponential": "E",
|
193
|
+
"group": ",",
|
194
|
+
"infinity": "∞",
|
195
|
+
"minusSign": "-",
|
196
|
+
"nan": "NaN",
|
197
|
+
"percentSign": "%",
|
198
|
+
"perMille": "‰",
|
199
|
+
"plusSign": "+",
|
200
|
+
"timeSeparator": ":"
|
201
|
+
},
|
202
|
+
"decimalFormats-numberSystem-latn": {
|
203
|
+
"standard": "#,##0.###",
|
204
|
+
"short": {
|
205
|
+
"decimalFormat": {
|
206
|
+
"1000-count-one": "0K",
|
207
|
+
"1000-count-other": "0K",
|
208
|
+
"10000-count-one": "00K",
|
209
|
+
"10000-count-other": "00K",
|
210
|
+
"100000-count-one": "000K",
|
211
|
+
"100000-count-other": "000K",
|
212
|
+
"1000000-count-one": "0M",
|
213
|
+
"1000000-count-other": "0M",
|
214
|
+
"10000000-count-one": "00M",
|
215
|
+
"10000000-count-other": "00M",
|
216
|
+
"100000000-count-one": "000M",
|
217
|
+
"100000000-count-other": "000M",
|
218
|
+
"1000000000-count-one": "0B",
|
219
|
+
"1000000000-count-other": "0B",
|
220
|
+
"10000000000-count-one": "00B",
|
221
|
+
"10000000000-count-other": "00B",
|
222
|
+
"100000000000-count-one": "000B",
|
223
|
+
"100000000000-count-other": "000B",
|
224
|
+
"1000000000000-count-one": "0T",
|
225
|
+
"1000000000000-count-other": "0T",
|
226
|
+
"10000000000000-count-one": "00T",
|
227
|
+
"10000000000000-count-other": "00T",
|
228
|
+
"100000000000000-count-one": "000T",
|
229
|
+
"100000000000000-count-other": "000T"
|
230
|
+
}
|
231
|
+
}
|
232
|
+
},
|
233
|
+
"currencyFormats-numberSystem-latn": {
|
234
|
+
"currencySpacing": {
|
235
|
+
"beforeCurrency": {
|
236
|
+
"currencyMatch": "[:^S:]",
|
237
|
+
"surroundingMatch": "[:digit:]",
|
238
|
+
"insertBetween": " "
|
239
|
+
},
|
240
|
+
"afterCurrency": {
|
241
|
+
"currencyMatch": "[:^S:]",
|
242
|
+
"surroundingMatch": "[:digit:]",
|
243
|
+
"insertBetween": " "
|
244
|
+
}
|
245
|
+
},
|
246
|
+
"standard": "¤#,##0.00"
|
247
|
+
}
|
248
|
+
},
|
249
|
+
"units": {
|
250
|
+
"short": {
|
251
|
+
"per": {
|
252
|
+
"compoundUnitPattern": "{0}/{1}"
|
253
|
+
},
|
254
|
+
"speed-mile-per-hour": {
|
255
|
+
"displayName": "miles/hour",
|
256
|
+
"unitPattern-count-one": "{0} mph",
|
257
|
+
"unitPattern-count-other": "{0} mph"
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
261
|
+
}
|
262
|
+
},
|
263
|
+
"supplemental": {
|
264
|
+
"version": {
|
265
|
+
"_cldrVersion": "25",
|
266
|
+
"_number": "$Revision: 91 $"
|
267
|
+
},
|
268
|
+
"currencyData": {
|
269
|
+
"fractions": {
|
270
|
+
"DEFAULT": {
|
271
|
+
"_rounding": "0",
|
272
|
+
"_digits": "2"
|
273
|
+
}
|
274
|
+
}
|
275
|
+
},
|
276
|
+
"likelySubtags": {
|
277
|
+
"en": "en-Latn-US",
|
278
|
+
},
|
279
|
+
"metaZones": {
|
280
|
+
"metazoneInfo": {
|
281
|
+
"timezone": {
|
282
|
+
"America": {
|
283
|
+
"Sao_Paulo": [
|
284
|
+
{
|
285
|
+
"usesMetazone": {
|
286
|
+
"_mzone": "Brasilia"
|
287
|
+
}
|
288
|
+
}
|
289
|
+
]
|
290
|
+
}
|
291
|
+
}
|
292
|
+
}
|
293
|
+
},
|
294
|
+
"plurals-type-cardinal": {
|
295
|
+
"en": {
|
296
|
+
"pluralRule-count-one": "i = 1 and v = 0 @integer 1",
|
297
|
+
"pluralRule-count-other": " @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …"
|
298
|
+
}
|
299
|
+
}
|
300
|
+
}
|
301
|
+
});
|
302
|
+
Globalize.loadMessages({
|
303
|
+
"en": {
|
304
|
+
"like": [
|
305
|
+
"{0, plural, offset:1",
|
306
|
+
" =0 {Be the first to like this}",
|
307
|
+
" =1 {You liked this}",
|
308
|
+
" one {You and someone else liked this}",
|
309
|
+
" other {You and # others liked this}",
|
310
|
+
"}"
|
311
|
+
]
|
312
|
+
}
|
313
|
+
});
|
314
|
+
Globalize.loadTimeZone({
|
315
|
+
"zoneData": {
|
316
|
+
"America": {
|
317
|
+
"Sao_Paulo": {
|
318
|
+
"abbrs": [
|
319
|
+
"LMT", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
320
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
321
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
322
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
323
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
324
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
325
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
326
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
327
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
328
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03",
|
329
|
+
"-02", "-03", "-02", "-03", "-02", "-03", "-02", "-03", "-02"
|
330
|
+
],
|
331
|
+
"untils": [
|
332
|
+
-1767214412000, -1206957600000, -1191362400000, -1175374800000, -1159826400000,
|
333
|
+
-633819600000, -622069200000, -602283600000, -591832800000, -570747600000,
|
334
|
+
-560210400000, -539125200000, -531352800000, -195426000000, -184197600000,
|
335
|
+
-155163600000, -150069600000, -128898000000, -121125600000, -99954000000, -89589600000,
|
336
|
+
-68418000000, -57967200000, 499748400000, 511236000000, 530593200000, 540266400000,
|
337
|
+
562129200000, 571197600000, 592974000000, 602042400000, 624423600000, 634701600000,
|
338
|
+
656478000000, 666756000000, 687927600000, 697600800000, 719982000000, 728445600000,
|
339
|
+
750826800000, 761709600000, 782276400000, 793159200000, 813726000000, 824004000000,
|
340
|
+
844570800000, 856058400000, 876106800000, 888717600000, 908074800000, 919562400000,
|
341
|
+
938919600000, 951616800000, 970974000000, 982461600000, 1003028400000, 1013911200000,
|
342
|
+
1036292400000, 1045360800000, 1066532400000, 1076810400000, 1099364400000,
|
343
|
+
1108864800000, 1129431600000, 1140314400000, 1162695600000, 1172368800000,
|
344
|
+
1192330800000, 1203213600000, 1224385200000, 1234663200000, 1255834800000,
|
345
|
+
1266717600000, 1287284400000, 1298167200000, 1318734000000, 1330221600000,
|
346
|
+
1350788400000, 1361066400000, 1382238000000, 1392516000000, 1413687600000,
|
347
|
+
1424570400000, 1445137200000, 1456020000000, 1476586800000, 1487469600000,
|
348
|
+
1508036400000, 1518919200000, 1540090800000, 1550368800000, 1571540400000,
|
349
|
+
1581818400000, 1602990000000, 1613872800000, 1634439600000, 1645322400000,
|
350
|
+
1665889200000, 1677376800000, 1697338800000, 1708221600000, 1729393200000,
|
351
|
+
1739671200000, 1760842800000, 1771725600000, 1792292400000, 1803175200000,
|
352
|
+
1823742000000, 1834624800000, 1855191600000, 1866074400000, 1887246000000,
|
353
|
+
1897524000000, 1918695600000, 1928973600000, 1950145200000, 1960423200000,
|
354
|
+
1981594800000, 1992477600000, 2013044400000, 2024532000000, 2044494000000,
|
355
|
+
2055376800000, 2076548400000, 2086826400000, 2107998000000, 2118880800000,
|
356
|
+
2139447600000, null
|
357
|
+
],
|
358
|
+
"offsets": [
|
359
|
+
186.4667, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180,
|
360
|
+
120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120,
|
361
|
+
180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180,
|
362
|
+
120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120,
|
363
|
+
180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180,
|
364
|
+
120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120,
|
365
|
+
180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120, 180,
|
366
|
+
120, 180, 120, 180, 120, 180, 120, 180, 120, 180, 120
|
367
|
+
],
|
368
|
+
"isdsts": [
|
369
|
+
0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
370
|
+
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
371
|
+
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
372
|
+
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
373
|
+
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
|
374
|
+
]
|
375
|
+
}
|
376
|
+
}
|
377
|
+
}
|
378
|
+
});
|
379
|
+
|
380
|
+
var en, like, number;
|
381
|
+
|
382
|
+
// Instantiate "en".
|
383
|
+
en = Globalize( "en" );
|
384
|
+
|
385
|
+
// Use Globalize to format dates.
|
386
|
+
document.getElementById( "date" ).textContent = en.formatDate( new Date(), {
|
387
|
+
datetime: "medium"
|
388
|
+
});
|
389
|
+
|
390
|
+
// Use Globalize to format dates on specific time zone.
|
391
|
+
document.getElementById( "zonedDate" ).textContent = en.formatDate( new Date(), {
|
392
|
+
datetime: "full",
|
393
|
+
timeZone: "America/Sao_Paulo"
|
394
|
+
});
|
395
|
+
|
396
|
+
// Use Globalize to format dates to parts.
|
397
|
+
document.getElementById( "dateToParts" ).innerHTML = en.formatDateToParts( new Date(), {
|
398
|
+
datetime: "medium"
|
399
|
+
}).map(function( part ) {
|
400
|
+
switch(part.type) {
|
401
|
+
case "month": return "<strong>" + part.value + "<\/strong>";
|
402
|
+
default: return part.value;
|
403
|
+
}
|
404
|
+
}).reduce(function( memo, value ) {
|
405
|
+
return memo + value;
|
406
|
+
});
|
407
|
+
|
408
|
+
// Use Globalize to format numbers.
|
409
|
+
number = en.numberFormatter();
|
410
|
+
document.getElementById( "number" ).textContent = number( 12345.6789 );
|
411
|
+
document.getElementById( "number-compact" ).textContent = en.formatNumber( 12345.6789, {
|
412
|
+
compact: "short",
|
413
|
+
minimumSignificantDigits: 1,
|
414
|
+
maximumSignificantDigits: 3
|
415
|
+
});
|
416
|
+
|
417
|
+
// Use Globalize to format currencies.
|
418
|
+
document.getElementById( "currency" ).textContent = en.formatCurrency( 69900, "USD" );
|
419
|
+
|
420
|
+
// Use Globalize to get the plural form of a numeric value.
|
421
|
+
document.getElementById( "plural-number" ).textContent = number( 12345.6789 );
|
422
|
+
document.getElementById( "plural-form" ).textContent = en.plural( 12345.6789 );
|
423
|
+
|
424
|
+
// Use Globalize to format a message with plural inflection.
|
425
|
+
like = en.messageFormatter( "like" );
|
426
|
+
document.getElementById( "message-0" ).textContent = like( 0 );
|
427
|
+
document.getElementById( "message-1" ).textContent = like( 1 );
|
428
|
+
document.getElementById( "message-2" ).textContent = like( 2 );
|
429
|
+
document.getElementById( "message-3" ).textContent = like( 3 );
|
430
|
+
|
431
|
+
// Use Globalize to format a relative time.
|
432
|
+
document.getElementById( "relative-time" ).textContent = en.formatRelativeTime( -35, "second" );
|
433
|
+
|
434
|
+
// Use Globalize to format a unit.
|
435
|
+
document.getElementById( "unit" ).textContent = en.formatUnit( 60, "mile/hour", {
|
436
|
+
form: "short"
|
437
|
+
});
|
438
|
+
|
439
|
+
document.getElementById( "requirements" ).style.display = "none";
|
440
|
+
document.getElementById( "demo" ).style.display = "block";
|
441
|
+
|
442
|
+
</script>
|
443
|
+
|
444
|
+
</body>
|
445
|
+
</html>
|
package/package.json
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
{
|
2
|
+
"name": "globalize-rpk",
|
3
|
+
"version": "1.7.0",
|
4
|
+
"description": "Repackaged version of globalize to work with Angular projects without path-mapping. A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data.",
|
5
|
+
"keywords": [
|
6
|
+
"utility",
|
7
|
+
"globalization",
|
8
|
+
"internationalization",
|
9
|
+
"multilingualization",
|
10
|
+
"localization",
|
11
|
+
"g11n",
|
12
|
+
"i18n",
|
13
|
+
"m17n",
|
14
|
+
"L10n",
|
15
|
+
"localize",
|
16
|
+
"format",
|
17
|
+
"parse",
|
18
|
+
"translate",
|
19
|
+
"strings",
|
20
|
+
"numbers",
|
21
|
+
"dates",
|
22
|
+
"times",
|
23
|
+
"calendars",
|
24
|
+
"plural",
|
25
|
+
"plurals",
|
26
|
+
"pluralize",
|
27
|
+
"cultures",
|
28
|
+
"languages",
|
29
|
+
"locales",
|
30
|
+
"Unicode",
|
31
|
+
"CLDR",
|
32
|
+
"JSON"
|
33
|
+
],
|
34
|
+
"homepage": "https://github.com/globalizejs/globalize",
|
35
|
+
"author": {
|
36
|
+
"name": "OpenJS Foundation and other contributors",
|
37
|
+
"url": "https://github.com/globalizejs/globalize/blob/master/AUTHORS.txt"
|
38
|
+
},
|
39
|
+
"maintainers": [
|
40
|
+
{
|
41
|
+
"name": "Jörn Zaefferer",
|
42
|
+
"email": "joern.zaefferer@gmail.com",
|
43
|
+
"url": "http://bassistance.de"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"name": "Rafael Xavier de Souza",
|
47
|
+
"email": "rxaviers@gmail.com",
|
48
|
+
"url": "http://rafael.xavier.blog.br"
|
49
|
+
}
|
50
|
+
],
|
51
|
+
"main": "./dist/node-main.js",
|
52
|
+
"files": [
|
53
|
+
"CONTRIBUTING.md",
|
54
|
+
"dist/",
|
55
|
+
"!dist/.build",
|
56
|
+
"doc/",
|
57
|
+
"examples/",
|
58
|
+
"!examples/**/.tmp-globalize-webpack",
|
59
|
+
"!examples/**/bower_components",
|
60
|
+
"!examples/**/node_modules",
|
61
|
+
"!examples/plain-javascript/cldrjs",
|
62
|
+
"!examples/plain-javascript/globalize",
|
63
|
+
"README.md"
|
64
|
+
],
|
65
|
+
"repository": {
|
66
|
+
"type": "git",
|
67
|
+
"url": "git://github.com/globalizejs/globalize.git"
|
68
|
+
},
|
69
|
+
"bugs": {
|
70
|
+
"url": "https://github.com/globalizejs/globalize/issues"
|
71
|
+
},
|
72
|
+
"dependencies": {
|
73
|
+
"cldrjs": "^0.5.4"
|
74
|
+
},
|
75
|
+
"devDependencies": {
|
76
|
+
"cldr-data-downloader": "^0.3.1",
|
77
|
+
"eslint-config-jquery": "3.0.0",
|
78
|
+
"glob": "^7.1.2",
|
79
|
+
"globalize-compiler": "^1.1.1",
|
80
|
+
"grunt": "1.2.0",
|
81
|
+
"grunt-check-dependencies": "1.0.0",
|
82
|
+
"grunt-commitplease": "0.0.6",
|
83
|
+
"grunt-compare-size": "0.4.2",
|
84
|
+
"grunt-contrib-clean": "1.1.0",
|
85
|
+
"grunt-contrib-connect": "0.8.0",
|
86
|
+
"grunt-contrib-copy": "1.0.0",
|
87
|
+
"grunt-contrib-qunit": "2.0.0",
|
88
|
+
"grunt-contrib-requirejs": "1.0.0",
|
89
|
+
"grunt-contrib-uglify": "3.0.1",
|
90
|
+
"grunt-contrib-watch": "1.0.0",
|
91
|
+
"grunt-eslint": "23.0.0",
|
92
|
+
"grunt-git-authors": "^3.2.0",
|
93
|
+
"grunt-mocha-test": "^0.13.2",
|
94
|
+
"gzip-js": "0.3.2",
|
95
|
+
"iana-tz-data": ">=2017.0.0",
|
96
|
+
"matchdep": "1.0.1",
|
97
|
+
"mocha": "^3.4.2",
|
98
|
+
"qunit": "2.12.0",
|
99
|
+
"semver": "^5.3.0",
|
100
|
+
"zoned-date-time": "1.1.0"
|
101
|
+
},
|
102
|
+
"commitplease": {
|
103
|
+
"nohook": true
|
104
|
+
},
|
105
|
+
"license": "MIT",
|
106
|
+
"scripts": {
|
107
|
+
"test": "grunt"
|
108
|
+
}
|
109
|
+
}
|