globalize-rpk 1.7.0 → 1.7.1
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/globalize/currency.js +590 -0
- package/globalize/date.js +3139 -0
- package/globalize/globalize-runtime.js +326 -0
- package/globalize/globalize.js +507 -0
- package/globalize/message.js +2076 -0
- package/globalize/number.js +1727 -0
- package/globalize/plural.js +376 -0
- package/globalize/relative-time.js +203 -0
- package/globalize/unit.js +301 -0
- package/node-main.js +27 -0
- package/package.json +3 -26
- package/CONTRIBUTING.md +0 -5
- package/README.md +0 -818
- package/doc/api/core/constructor.md +0 -28
- package/doc/api/core/load.md +0 -96
- package/doc/api/core/locale.md +0 -43
- package/doc/api/currency/currency-formatter.md +0 -196
- package/doc/api/currency/currency-to-parts-formatter.md +0 -117
- package/doc/api/date/date-formatter.md +0 -203
- package/doc/api/date/date-parser.md +0 -60
- package/doc/api/date/date-to-parts-formatter.md +0 -176
- package/doc/api/date/load-iana-time-zone.md +0 -29
- package/doc/api/message/load-messages.md +0 -105
- package/doc/api/message/message-formatter.md +0 -208
- package/doc/api/number/number-formatter.md +0 -202
- package/doc/api/number/number-parser.md +0 -130
- package/doc/api/number/number-to-parts-formatter.md +0 -140
- package/doc/api/plural/plural-generator.md +0 -84
- package/doc/api/relative-time/relative-time-formatter.md +0 -60
- package/doc/api/unit/unit-formatter.md +0 -72
- package/doc/blog-post/2017-07-xx-1.3.0-announcement.md +0 -177
- package/doc/cldr.md +0 -114
- package/doc/error/e-default-locale-not-defined.md +0 -9
- package/doc/error/e-invalid-cldr.md +0 -14
- package/doc/error/e-invalid-par-type.md +0 -12
- package/doc/error/e-invalid-par-value.md +0 -11
- package/doc/error/e-missing-cldr.md +0 -11
- package/doc/error/e-missing-parameter.md +0 -10
- package/doc/error/e-missing-plural-module.md +0 -9
- package/doc/error/e-par-missing-key.md +0 -11
- package/doc/error/e-par-out-of-range.md +0 -13
- package/doc/error/e-unsupported.md +0 -10
- package/doc/migrating-from-0.x.md +0 -64
- package/examples/amd-bower/.bowerrc +0 -7
- package/examples/amd-bower/README.md +0 -65
- package/examples/amd-bower/bower.json +0 -13
- package/examples/amd-bower/index.html +0 -46
- package/examples/amd-bower/main.js +0 -141
- package/examples/amd-bower/messages/en.json +0 -12
- package/examples/amd-bower/package.json +0 -14
- package/examples/app-npm-webpack/README.md +0 -74
- package/examples/app-npm-webpack/app/index.js +0 -89
- package/examples/app-npm-webpack/index-template.html +0 -71
- package/examples/app-npm-webpack/messages/ar.json +0 -25
- package/examples/app-npm-webpack/messages/de.json +0 -21
- package/examples/app-npm-webpack/messages/en.json +0 -21
- package/examples/app-npm-webpack/messages/es.json +0 -21
- package/examples/app-npm-webpack/messages/pt.json +0 -21
- package/examples/app-npm-webpack/messages/ru.json +0 -23
- package/examples/app-npm-webpack/messages/zh.json +0 -20
- package/examples/app-npm-webpack/package.json +0 -17
- package/examples/app-npm-webpack/webpack-config.js +0 -63
- package/examples/globalize-compiler/README.md +0 -45
- package/examples/globalize-compiler/app.js +0 -58
- package/examples/globalize-compiler/development.html +0 -121
- package/examples/globalize-compiler/messages.json +0 -12
- package/examples/globalize-compiler/package.json +0 -15
- package/examples/globalize-compiler/production.html +0 -75
- package/examples/node-npm/README.md +0 -57
- package/examples/node-npm/main.js +0 -65
- package/examples/node-npm/messages/en.json +0 -12
- package/examples/node-npm/package.json +0 -10
- package/examples/plain-javascript/README.md +0 -81
- package/examples/plain-javascript/index.html +0 -445
@@ -1,141 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* 1. Configure require.js paths.
|
3
|
-
*/
|
4
|
-
require.config({
|
5
|
-
paths: {
|
6
|
-
// Globalize dependencies paths.
|
7
|
-
cldr: "./bower_components/cldrjs/dist/cldr",
|
8
|
-
|
9
|
-
// Unicode CLDR JSON data.
|
10
|
-
"cldr-data": "./bower_components/cldr-data",
|
11
|
-
|
12
|
-
// IANA time zone data.
|
13
|
-
"iana-tz-data": "../bower_components/iana-tz-data/iana-tz-data",
|
14
|
-
|
15
|
-
// require.js plugin we'll use to fetch CLDR JSON content.
|
16
|
-
json: "./bower_components/requirejs-plugins/src/json",
|
17
|
-
|
18
|
-
// text is json's dependency.
|
19
|
-
text: "./bower_components/requirejs-text/text",
|
20
|
-
|
21
|
-
// Globalize.
|
22
|
-
globalize: "./bower_components/globalize/dist/globalize"
|
23
|
-
}
|
24
|
-
});
|
25
|
-
|
26
|
-
|
27
|
-
/**
|
28
|
-
* 2. Require dependencies and run your code.
|
29
|
-
*/
|
30
|
-
require([
|
31
|
-
"globalize",
|
32
|
-
|
33
|
-
// CLDR content.
|
34
|
-
"json!cldr-data/main/en/ca-gregorian.json",
|
35
|
-
"json!cldr-data/main/en/currencies.json",
|
36
|
-
"json!cldr-data/main/en/dateFields.json",
|
37
|
-
"json!cldr-data/main/en/numbers.json",
|
38
|
-
"json!cldr-data/main/en/timeZoneNames.json",
|
39
|
-
"json!cldr-data/main/en/units.json",
|
40
|
-
"json!cldr-data/supplemental/currencyData.json",
|
41
|
-
"json!cldr-data/supplemental/likelySubtags.json",
|
42
|
-
"json!cldr-data/supplemental/metaZones.json",
|
43
|
-
"json!cldr-data/supplemental/plurals.json",
|
44
|
-
"json!cldr-data/supplemental/timeData.json",
|
45
|
-
"json!cldr-data/supplemental/weekData.json",
|
46
|
-
"json!messages/en.json",
|
47
|
-
"json!iana-tz-data.json",
|
48
|
-
|
49
|
-
// Extend Globalize with Date and Number modules.
|
50
|
-
"globalize/currency",
|
51
|
-
"globalize/date",
|
52
|
-
"globalize/message",
|
53
|
-
"globalize/number",
|
54
|
-
"globalize/plural",
|
55
|
-
"globalize/relative-time",
|
56
|
-
"globalize/unit"
|
57
|
-
], function( Globalize, enGregorian, enCurrencies, enDateFields, enNumbers,
|
58
|
-
enTimeZoneNames, enUnits, currencyData, likelySubtags, metaZones,
|
59
|
-
pluralsData, timeData, weekData, messages, ianaTzData ) {
|
60
|
-
|
61
|
-
var en, like, number;
|
62
|
-
|
63
|
-
// At this point, we have Globalize loaded. But, before we can use it, we need to feed it on the appropriate I18n content (Unicode CLDR). Read Requirements on Getting Started on the root's README.md for more information.
|
64
|
-
Globalize.load(
|
65
|
-
currencyData,
|
66
|
-
enCurrencies,
|
67
|
-
enDateFields,
|
68
|
-
enGregorian,
|
69
|
-
enNumbers,
|
70
|
-
enTimeZoneNames,
|
71
|
-
enUnits,
|
72
|
-
likelySubtags,
|
73
|
-
metaZones,
|
74
|
-
pluralsData,
|
75
|
-
timeData,
|
76
|
-
weekData
|
77
|
-
);
|
78
|
-
Globalize.loadMessages( messages );
|
79
|
-
Globalize.loadTimeZone( ianaTzData );
|
80
|
-
|
81
|
-
// Instantiate "en".
|
82
|
-
en = Globalize( "en" );
|
83
|
-
|
84
|
-
// Use Globalize to format dates.
|
85
|
-
document.getElementById( "date" ).textContent = en.formatDate( new Date(), {
|
86
|
-
datetime: "medium"
|
87
|
-
});
|
88
|
-
|
89
|
-
// Use Globalize to format dates on specific time zone.
|
90
|
-
document.getElementById( "zonedDate" ).textContent = en.formatDate( new Date(), {
|
91
|
-
datetime: "full",
|
92
|
-
timeZone: "America/Sao_Paulo"
|
93
|
-
});
|
94
|
-
|
95
|
-
// Use Globalize to format dates to parts.
|
96
|
-
document.getElementById( "dateToParts" ).innerHTML = en.formatDateToParts( new Date(), {
|
97
|
-
datetime: "medium"
|
98
|
-
}).map( function( part ) {
|
99
|
-
switch ( part.type ) {
|
100
|
-
case "month": return "<strong>" + part.value + "</strong>";
|
101
|
-
default: return part.value;
|
102
|
-
}
|
103
|
-
}).reduce( function( memo, value ) {
|
104
|
-
return memo + value;
|
105
|
-
});
|
106
|
-
|
107
|
-
// Use Globalize to format numbers.
|
108
|
-
number = en.numberFormatter();
|
109
|
-
document.getElementById( "number" ).textContent = number( 12345.6789 );
|
110
|
-
document.getElementById( "number-compact" ).textContent = en.formatNumber( 12345.6789, {
|
111
|
-
compact: "short",
|
112
|
-
minimumSignificantDigits: 1,
|
113
|
-
maximumSignificantDigits: 3
|
114
|
-
});
|
115
|
-
|
116
|
-
// Use Globalize to format currencies.
|
117
|
-
document.getElementById( "currency" ).textContent = en.formatCurrency( 69900, "USD" );
|
118
|
-
|
119
|
-
// Use Globalize to get the plural form of a numeric value.
|
120
|
-
document.getElementById( "plural-number" ).textContent = number( 12345.6789 );
|
121
|
-
document.getElementById( "plural-form" ).textContent = en.plural( 12345.6789 );
|
122
|
-
|
123
|
-
// Use Globalize to format a message with plural inflection.
|
124
|
-
like = en.messageFormatter( "like" );
|
125
|
-
document.getElementById( "message-0" ).textContent = like( 0 );
|
126
|
-
document.getElementById( "message-1" ).textContent = like( 1 );
|
127
|
-
document.getElementById( "message-2" ).textContent = like( 2 );
|
128
|
-
document.getElementById( "message-3" ).textContent = like( 3 );
|
129
|
-
|
130
|
-
// Use Globalize to format a relative time.
|
131
|
-
document.getElementById( "relative-time" ).textContent = en.formatRelativeTime( -35, "second" );
|
132
|
-
|
133
|
-
// Use Globalize to format a unit.
|
134
|
-
document.getElementById( "unit" ).textContent = en.formatUnit( 60, "mile/hour", {
|
135
|
-
form: "short"
|
136
|
-
});
|
137
|
-
|
138
|
-
document.getElementById( "requirements" ).style.display = "none";
|
139
|
-
document.getElementById( "demo" ).style.display = "block";
|
140
|
-
|
141
|
-
});
|
@@ -1,14 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "globalize-hello-world-amd-bower",
|
3
|
-
"private": true,
|
4
|
-
"comment": [
|
5
|
-
"You don't need this file. The only reasone this example does have a",
|
6
|
-
"package.json is to fool npm, so cldr-data-downloader doesn't get",
|
7
|
-
"installed on Globalize's root.",
|
8
|
-
"",
|
9
|
-
"It's analogous to `chroot .` for npm. [:P]"
|
10
|
-
],
|
11
|
-
"dependencies": {
|
12
|
-
"cldr-data-downloader": "^0.3.4"
|
13
|
-
}
|
14
|
-
}
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# Globalize App example using webpack
|
2
|
-
|
3
|
-
This example demonstrates how to integrate Globalize with Webpack in your
|
4
|
-
Application. If you already have an existing Application using Webpack stack,
|
5
|
-
this example should as well provide you guidance on how to integrate Globalize.
|
6
|
-
It focuses on the [Globalize Webpack Plugin][], which automates data loading
|
7
|
-
(CLDR and app messages) during development and automates Globalize compilation
|
8
|
-
and the usage of Globalize runtime modules for production. It assumes knowledge
|
9
|
-
of Globalize, npm, and Webpack usage basics.
|
10
|
-
|
11
|
-
## Requirements
|
12
|
-
|
13
|
-
**1. Install app development dependencies**
|
14
|
-
|
15
|
-
This example uses `npm` to download the app development dependencies (i.e.,
|
16
|
-
Globalize, CLDR data, Cldrjs, Webpack, [Globalize Webpack Plugin][], and
|
17
|
-
others).
|
18
|
-
|
19
|
-
```
|
20
|
-
npm install
|
21
|
-
```
|
22
|
-
|
23
|
-
## Running the example
|
24
|
-
|
25
|
-
### Development mode
|
26
|
-
|
27
|
-
```
|
28
|
-
npm start
|
29
|
-
```
|
30
|
-
|
31
|
-
1. Start a server by running `npm start`, which uses webpack's live reload HMR
|
32
|
-
(Hot Module Replacement). See `package.json` to understand the actual shell
|
33
|
-
command that is used.
|
34
|
-
1. Point your browser at `http://localhost:8080`. Note that your browser will
|
35
|
-
automatically reload on any changes made to the application code (`app/*.js`
|
36
|
-
files). Also note that for faster page reload, formatters are created
|
37
|
-
dynamically and automatically by the [Globalize Webpack Plugin][].
|
38
|
-
1. Note you can specify the development locale of your choice by setting the
|
39
|
-
`developmentLocale` property of the Globalize Webpack Plugin on the Webpack
|
40
|
-
config file.
|
41
|
-
1. Note that CLDR data and your messages data are automatically loaded by the
|
42
|
-
[Globalize Webpack Plugin][].
|
43
|
-
1. Understand the demo by reading the source code. We have comments there for
|
44
|
-
you.
|
45
|
-
|
46
|
-
### Production mode
|
47
|
-
|
48
|
-
```
|
49
|
-
npm run build
|
50
|
-
```
|
51
|
-
|
52
|
-
1. Generate the compiled bundles by running `npm run build`, which will be
|
53
|
-
created at `./dist`. Note the production bundles are split into three chunks:
|
54
|
-
(a) vendor, which holds third-party libraries, which in this case means
|
55
|
-
Globalize Runtime modules, (b) i18n precompiled data, which means the minimum
|
56
|
-
yet sufficient set of precompiled i18n data that your application needs (one
|
57
|
-
file for each supported locale), and (c) app, which means your application code.
|
58
|
-
Also note that all the production code is already minified using UglifyJS. See
|
59
|
-
`package.json` to understand the actual shell command that is used.
|
60
|
-
1. Note that your formatters are already precompiled. This is
|
61
|
-
obvious, but worth emphasizing. It means your formatters are prebuilt, so no client
|
62
|
-
CPU clock is wasted to generate them and no CLDR or messages data needs to be
|
63
|
-
dynamically loaded. It means fast to load code (small code) and fast to run
|
64
|
-
code.
|
65
|
-
1. Point your browser at `./dist/index.html` to run the application using the
|
66
|
-
generated production files. Edit this file to display the application using a
|
67
|
-
different locale (source code has instructions).
|
68
|
-
1. Understand the demo by reading the source code. We have comments there for
|
69
|
-
you.
|
70
|
-
|
71
|
-
For more information about the plugin, see the [Globalize Webpack Plugin][]
|
72
|
-
documentation.
|
73
|
-
|
74
|
-
[Globalize Webpack Plugin]: https://github.com/rxaviers/globalize-webpack-plugin
|
@@ -1,89 +0,0 @@
|
|
1
|
-
var Globalize = require( "globalize" );
|
2
|
-
var startTime = new Date();
|
3
|
-
|
4
|
-
// Standalone table.
|
5
|
-
var numberFormatter = Globalize.numberFormatter({ maximumFractionDigits: 2 });
|
6
|
-
document.getElementById( "number" ).textContent = numberFormatter( 12345.6789 );
|
7
|
-
|
8
|
-
var numberCompactFormatter = Globalize.numberFormatter({
|
9
|
-
compact: "short",
|
10
|
-
minimumSignificantDigits: 1,
|
11
|
-
maximumSignificantDigits: 3
|
12
|
-
});
|
13
|
-
document.getElementById( "number-compact" ).textContent = numberCompactFormatter( 12345.6789 );
|
14
|
-
|
15
|
-
var currencyFormatter = Globalize.currencyFormatter( "USD" );
|
16
|
-
document.getElementById( "currency" ).textContent = currencyFormatter( 69900 );
|
17
|
-
|
18
|
-
var dateFormatter = Globalize.dateFormatter({ datetime: "medium" });
|
19
|
-
document.getElementById( "date" ).textContent = dateFormatter( new Date() );
|
20
|
-
|
21
|
-
var dateWithTimeZoneFormatter = Globalize.dateFormatter({
|
22
|
-
datetime: "full",
|
23
|
-
timeZone: "America/Sao_Paulo"
|
24
|
-
});
|
25
|
-
document.getElementById( "date-time-zone" ).textContent = dateWithTimeZoneFormatter( new Date() );
|
26
|
-
|
27
|
-
var _dateToPartsFormatter = Globalize.dateToPartsFormatter({ datetime: "medium" });
|
28
|
-
var dateToPartsFormatter = function( value ) {
|
29
|
-
return _dateToPartsFormatter( value, {
|
30
|
-
datetime: "medium"
|
31
|
-
}).map(function( part ) {
|
32
|
-
switch(part.type) {
|
33
|
-
case "month": return "<strong>" + part.value + "</strong>";
|
34
|
-
default: return part.value;
|
35
|
-
}
|
36
|
-
}).reduce(function( memo, value ) {
|
37
|
-
return memo + value;
|
38
|
-
});
|
39
|
-
};
|
40
|
-
document.getElementById( "date-to-parts" ).innerHTML = dateToPartsFormatter( new Date() );
|
41
|
-
|
42
|
-
var relativeTimeFormatter = Globalize.relativeTimeFormatter( "second" );
|
43
|
-
document.getElementById( "relative-time" ).textContent = relativeTimeFormatter( 0 );
|
44
|
-
|
45
|
-
var unitFormatter = Globalize.unitFormatter( "mile/hour", { form: "short" } );
|
46
|
-
document.getElementById( "unit" ).textContent = unitFormatter( 60 );
|
47
|
-
|
48
|
-
// Messages.
|
49
|
-
document.getElementById( "intro-1" ).textContent = Globalize.formatMessage( "intro-1" );
|
50
|
-
document.getElementById( "number-label" ).textContent = Globalize.formatMessage( "number-label" );
|
51
|
-
document.getElementById( "number-compact-label" ).textContent = Globalize.formatMessage( "number-compact-label" );
|
52
|
-
document.getElementById( "currency-label" ).textContent = Globalize.formatMessage( "currency-label" );
|
53
|
-
document.getElementById( "date-label" ).textContent = Globalize.formatMessage( "date-label" );
|
54
|
-
document.getElementById( "date-time-zone-label" ).textContent = Globalize.formatMessage( "date-time-zone-label" );
|
55
|
-
document.getElementById( "date-to-parts-label" ).textContent = Globalize.formatMessage( "date-to-parts-label" );
|
56
|
-
document.getElementById( "relative-time-label" ).textContent = Globalize.formatMessage( "relative-time-label" );
|
57
|
-
document.getElementById( "unit-label" ).textContent = Globalize.formatMessage( "unit-label" );
|
58
|
-
document.getElementById( "message-1" ).textContent = Globalize.formatMessage( "message-1", {
|
59
|
-
currency: currencyFormatter( 69900 ),
|
60
|
-
date: dateFormatter( new Date() ),
|
61
|
-
number: numberFormatter( 12345.6789 ),
|
62
|
-
relativeTime: relativeTimeFormatter( 0 ),
|
63
|
-
unit: unitFormatter( 60 )
|
64
|
-
});
|
65
|
-
|
66
|
-
document.getElementById( "message-2" ).textContent = Globalize.formatMessage( "message-2", {
|
67
|
-
count: 3
|
68
|
-
});
|
69
|
-
|
70
|
-
// Display demo.
|
71
|
-
document.getElementById( "requirements" ).style.display = "none";
|
72
|
-
document.getElementById( "demo" ).style.display = "block";
|
73
|
-
|
74
|
-
// Refresh elapsed time
|
75
|
-
setInterval(function() {
|
76
|
-
var elapsedTime = +( ( startTime - new Date() ) / 1000 ).toFixed( 0 );
|
77
|
-
document.getElementById( "date" ).textContent = dateFormatter( new Date() );
|
78
|
-
document.getElementById( "date-time-zone" ).textContent = dateWithTimeZoneFormatter( new Date() );
|
79
|
-
document.getElementById( "date-to-parts" ).innerHTML = dateToPartsFormatter( new Date() );
|
80
|
-
document.getElementById( "relative-time" ).textContent = relativeTimeFormatter( elapsedTime );
|
81
|
-
document.getElementById( "message-1" ).textContent = Globalize.formatMessage( "message-1", {
|
82
|
-
currency: currencyFormatter( 69900 ),
|
83
|
-
date: dateFormatter( new Date() ),
|
84
|
-
number: numberFormatter( 12345.6789 ),
|
85
|
-
relativeTime: relativeTimeFormatter( elapsedTime ),
|
86
|
-
unit: unitFormatter( 60 )
|
87
|
-
});
|
88
|
-
|
89
|
-
}, 1000);
|
@@ -1,71 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
-
<title>Globalize App example using Webpack</title>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
|
10
|
-
<h1>Globalize App example using Webpack</h1>
|
11
|
-
|
12
|
-
<div id="requirements">
|
13
|
-
<h2>Requirements</h2>
|
14
|
-
<ul>
|
15
|
-
<li>Read README.md for instructions on how to run the demo.
|
16
|
-
</li>
|
17
|
-
</ul>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<div id="demo" style="display: none">
|
21
|
-
<p id="intro-1">Use Globalize to internationalize your application.</p>
|
22
|
-
<table border="1" style="marginBottom: 1em;">
|
23
|
-
<tbody>
|
24
|
-
<tr>
|
25
|
-
<td><span id="number-label">Standalone Number</span></td>
|
26
|
-
<td>"<span id="number"></span>"</td>
|
27
|
-
</tr>
|
28
|
-
<tr>
|
29
|
-
<td><span id="number-compact-label">Standalone Number (compact form)</span></td>
|
30
|
-
<td>"<span id="number-compact"></span>"</td>
|
31
|
-
</tr>
|
32
|
-
<tr>
|
33
|
-
<td><span id="currency-label">Standalone Currency</span></td>
|
34
|
-
<td>"<span id="currency"></span>"</td>
|
35
|
-
</tr>
|
36
|
-
<tr>
|
37
|
-
<td><span id="date-label">Standalone Date</span></td>
|
38
|
-
<td>"<span id="date"></span>"</td>
|
39
|
-
</tr>
|
40
|
-
<tr>
|
41
|
-
<td><span id="date-time-zone-label">Standalone Date (in a specific IANA time zone, e.g., America/Sao_Paulo)</span></td>
|
42
|
-
<td>"<span id="date-time-zone"></span>"</td>
|
43
|
-
</tr>
|
44
|
-
<tr>
|
45
|
-
<td><span id="date-to-parts-label">Standalone Date (note the highlighted month, the markup was added using formatDateToParts)</span></td>
|
46
|
-
<td>"<span id="date-to-parts"></span>"</td>
|
47
|
-
</tr>
|
48
|
-
<tr>
|
49
|
-
<td><span id="relative-time-label">Standalone Relative Time</span></td>
|
50
|
-
<td>"<span id="relative-time"></span>"</td>
|
51
|
-
</tr>
|
52
|
-
<tr>
|
53
|
-
<td><span id="unit-label">Standalone Unit</span></td>
|
54
|
-
<td>"<span id="unit"></span>"</td>
|
55
|
-
</tr>
|
56
|
-
</tbody>
|
57
|
-
</table>
|
58
|
-
<p id="message-1">
|
59
|
-
An example of a message using mixed number "{number}", currency "{currency}", date "{date}", relative time "{relativeTime}", and unit "{unit}".
|
60
|
-
</p>
|
61
|
-
<p id="message-2">
|
62
|
-
An example of a message with pluralization support:
|
63
|
-
{count, plural,
|
64
|
-
one {You have one remaining task}
|
65
|
-
other {You have # remaining tasks}
|
66
|
-
}.
|
67
|
-
</p>
|
68
|
-
</div>
|
69
|
-
|
70
|
-
</body>
|
71
|
-
</html>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"ar": {
|
3
|
-
"intro-1": "استخدم Globalize لتدويل تطبيقك.",
|
4
|
-
"number-label": "رقم",
|
5
|
-
"number-compact-label": "الرقم (شكل مدمج)",
|
6
|
-
"currency-label": "عملة",
|
7
|
-
"date-label": "تاريخ",
|
8
|
-
"date-time-zone-label": "التاريخ (في منطقة زمنية محددة ل إيانا، على سبيل المثال، America/Sao_Paulo)",
|
9
|
-
"date-to-parts-label": "التاريخ (لاحظ الشهر القوي، تمت إضافة الترميز باستخدام formatDateToParts)",
|
10
|
-
"relative-time-label": "الوقت النسبي",
|
11
|
-
"unit-label": "وحدة القياس",
|
12
|
-
"message-1": "مثال علي رسالة باستخدام رقم مختلط \"{number}\", عملة \"{currency}\", تاريخ \"{date}\", وقت نسبي \"{relativeTime}\", و وحدة قياس \"{unit}\" .",
|
13
|
-
"message-2": [
|
14
|
-
"مثال على رسالة بدعم صيغة الجمع:",
|
15
|
-
"{count, plural,",
|
16
|
-
" zero {لا يوجد لديك اي مهام متبقية}",
|
17
|
-
" one {لديك مهمة واحدة متبقية}",
|
18
|
-
" two {لديك اثنين من المهام المتبقية}",
|
19
|
-
" few {لديك # من المهام المتبقية}",
|
20
|
-
" many {لديك # من المهام المتبقية}",
|
21
|
-
" other {لديك # من المهام المتبقية}",
|
22
|
-
"}."
|
23
|
-
]
|
24
|
-
}
|
25
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"de": {
|
3
|
-
"intro-1": "Verwenden Sie Globalize um Ihre Anwendung zu internationalisieren.",
|
4
|
-
"number-label": "Zahl",
|
5
|
-
"number-compact-label": "Zahl (kompakte Form)",
|
6
|
-
"currency-label": "Währung",
|
7
|
-
"date-label": "Datum",
|
8
|
-
"date-time-zone-label": "Datum (in einer bestimmten IANA-Zeitzone, z. B. America/Sao_Paulo)",
|
9
|
-
"date-to-parts-label": "Datum (beachten Sie den hervorgehobenen Monat, das Markup wurde mit dateToPartsFormatter hinzugefügt)",
|
10
|
-
"relative-time-label": "Relative Zeit",
|
11
|
-
"unit-label": "Einheit",
|
12
|
-
"message-1": "Ein Beispiel mit Zahl \"{number}\", Währung \"{currency}\", Datum \"{date}\", relative Zeit \"{relativeTime}\", und Einheit \"{unit}\".",
|
13
|
-
"message-2": [
|
14
|
-
"Ein Beispieltext mit Unterstützung von Plural Formen: ",
|
15
|
-
"{count, plural,",
|
16
|
-
" one {Sie haben noch eine Aufgabe}",
|
17
|
-
" other {Sie haben noch # verbliebende Aufgaben}",
|
18
|
-
"}."
|
19
|
-
]
|
20
|
-
}
|
21
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"en": {
|
3
|
-
"intro-1": "Use Globalize to internationalize your application.",
|
4
|
-
"number-label": "Number",
|
5
|
-
"number-compact-label": "Number (compact form)",
|
6
|
-
"currency-label": "Currency",
|
7
|
-
"date-label": "Date",
|
8
|
-
"date-time-zone-label": "Date (in a specific IANA time zone, e.g., America/Sao_Paulo)",
|
9
|
-
"date-to-parts-label": "Date (note the highlighted month, the markup was added using formatDateToParts)",
|
10
|
-
"relative-time-label": "Relative Time",
|
11
|
-
"unit-label": "Unit",
|
12
|
-
"message-1": "An example of a message using mixed number \"{number}\", currency \"{currency}\", date \"{date}\", relative time \"{relativeTime}\", and unit \"{unit}\".",
|
13
|
-
"message-2": [
|
14
|
-
"An example of a message with pluralization support:",
|
15
|
-
"{count, plural,",
|
16
|
-
" one {You have one remaining task}",
|
17
|
-
" other {You have # remaining tasks}",
|
18
|
-
"}."
|
19
|
-
]
|
20
|
-
}
|
21
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"es": {
|
3
|
-
"intro-1": "Usa Globalize para internacionalizar tu aplicación.",
|
4
|
-
"number-label": "Número",
|
5
|
-
"number-compact-label": "Número (forma compacta)",
|
6
|
-
"currency-label": "Moneda",
|
7
|
-
"date-label": "Fecha",
|
8
|
-
"date-time-zone-label": "Fecha (en una zona horaria IANA específica, por ejemplo, America/Sao_Paulo)",
|
9
|
-
"date-to-parts-label": "Fecha (note el mes destacado en negro, el marcador de html se agregó utilizando dateToPartsFormatter)",
|
10
|
-
"relative-time-label": "Tiempo Relativo",
|
11
|
-
"unit-label": "Unidad",
|
12
|
-
"message-1": "Un ejemplo de mensaje usando números mixtos \"{number}\", monedas \"{currency}\", fechas \"{date}\", tiempo relativo \"{relativeTime}\", y unidades \"{unit}\".",
|
13
|
-
"message-2": [
|
14
|
-
"Un ejemplo de mensaje con soporte de pluralización:",
|
15
|
-
"{count, plural,",
|
16
|
-
" one {Tienes una tarea restante}",
|
17
|
-
" other {Tienes # tareas restantes}",
|
18
|
-
"}."
|
19
|
-
]
|
20
|
-
}
|
21
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"pt": {
|
3
|
-
"intro-1": "Use o Globalize para internacionalizar sua aplicação.",
|
4
|
-
"number-label": "Número",
|
5
|
-
"number-compact-label": "Número (forma compacta)",
|
6
|
-
"currency-label": "Moeda",
|
7
|
-
"date-label": "Data",
|
8
|
-
"date-time-zone-label": "Data (em um fuso horário IANA específico, por exemplo, America/Sao_Paulo)",
|
9
|
-
"date-to-parts-label": "Data (note o mês em negrito, a marcação HTML foi adicionada usando formatDateToParts)",
|
10
|
-
"relative-time-label": "Tempo relativo",
|
11
|
-
"unit-label": "Unit",
|
12
|
-
"message-1": "Um exemplo de mensagem com mistura de número \"{number}\", moeda \"{currency}\", data \"{date}\", tempo relativo \"{relativeTime}\", e unidade \"{unit}\".",
|
13
|
-
"message-2": [
|
14
|
-
"Um exemplo de message com suporte a pluralização:",
|
15
|
-
"{count, plural,",
|
16
|
-
" one {Você tem uma tarefa restante}",
|
17
|
-
" other {Você tem # tarefas restantes}",
|
18
|
-
"}."
|
19
|
-
]
|
20
|
-
}
|
21
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"ru": {
|
3
|
-
"intro-1": "Используйте Globalize для интернационализиции вашего приложения.",
|
4
|
-
"number-label": "Число",
|
5
|
-
"number-compact-label": "Число (компактная форма)",
|
6
|
-
"currency-label": "Валюта",
|
7
|
-
"date-label": "Дата",
|
8
|
-
"date-time-zone-label": "Дата (в определенном часовом поясе IANA, например, America/Sao_Paulo)",
|
9
|
-
"date-to-parts-label": "Дата (обратите внимание на сильный месяц, разметка была добавлена с помощью formatDateToParts)",
|
10
|
-
"relative-time-label": "Относительное время",
|
11
|
-
"unit-label": "Единица измерения",
|
12
|
-
"message-1": "Пример сообщения с числом \"{number}\", валютой \"{currency}\", датой \"{date}\", относительным временем \"{relativeTime}\" и единицей измерения \"{unit}\".",
|
13
|
-
"message-2": [
|
14
|
-
"Пример сообщения с поддержкой множественного числа:",
|
15
|
-
"{count, plural,",
|
16
|
-
" one {У вас осталась одна задача}",
|
17
|
-
" many {У вас осталось # задач}",
|
18
|
-
" few {У вас осталось # задачи}",
|
19
|
-
" other {У вас осталось # задачи}",
|
20
|
-
"}."
|
21
|
-
]
|
22
|
-
}
|
23
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"zh": {
|
3
|
-
"intro-1": "使用Globalize的国际化应用程序",
|
4
|
-
"number-label": "号码",
|
5
|
-
"number-compact-label": "编号(紧凑形式)",
|
6
|
-
"currency-label": "币",
|
7
|
-
"date-label": "迄今",
|
8
|
-
"date-time-zone-label": "日期(在特定的IANA时区,例如America / Sao_Paulo)",
|
9
|
-
"date-to-parts-label": "日期(注意强烈的月份,使用formatDateToParts添加标记)",
|
10
|
-
"relative-time-label": "相对时间",
|
11
|
-
"unit-label": "单元",
|
12
|
-
"message-1": "使用混合数\"{number}\",货币\"{currency}\",日期\"{date}\",相对时间\"{relativeTime}\"和单元\"{unit}\"的消息的例子。",
|
13
|
-
"message-2": [
|
14
|
-
"与多元化支持消息的例子:",
|
15
|
-
"{count, plural,",
|
16
|
-
" other {你有#剩下的任务}",
|
17
|
-
"}."
|
18
|
-
]
|
19
|
-
}
|
20
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"private": true,
|
3
|
-
"devDependencies": {
|
4
|
-
"cldr-data": ">=25",
|
5
|
-
"globalize": "^1.3.0",
|
6
|
-
"globalize-webpack-plugin": "^2.1.0",
|
7
|
-
"html-webpack-plugin": "^2.30.1",
|
8
|
-
"iana-tz-data": "^2017.1.0",
|
9
|
-
"webpack": "^3.11.0",
|
10
|
-
"webpack-dev-server": "^2.11.1"
|
11
|
-
},
|
12
|
-
"scripts": {
|
13
|
-
"start": "webpack-dev-server --config webpack-config.js --hot --progress --colors --inline",
|
14
|
-
"build": "NODE_ENV=production webpack --config webpack-config.js"
|
15
|
-
},
|
16
|
-
"cldr-data-urls-filter": "(core|dates|numbers|units)"
|
17
|
-
}
|
@@ -1,63 +0,0 @@
|
|
1
|
-
var webpack = require( "webpack" );
|
2
|
-
var path = require("path");
|
3
|
-
var CommonsChunkPlugin = require( "webpack/lib/optimize/CommonsChunkPlugin" );
|
4
|
-
var HtmlWebpackPlugin = require( "html-webpack-plugin" );
|
5
|
-
var GlobalizePlugin = require( "globalize-webpack-plugin" );
|
6
|
-
|
7
|
-
var production = process.env.NODE_ENV === "production";
|
8
|
-
var globalizeCompiledDataRegex = new RegExp( /^(globalize\-compiled\-data)\-\S+$/ );
|
9
|
-
|
10
|
-
function subLocaleNames( name ) {
|
11
|
-
return name.replace( globalizeCompiledDataRegex, "$1" );
|
12
|
-
}
|
13
|
-
|
14
|
-
module.exports = {
|
15
|
-
entry: {
|
16
|
-
main: "./app/index.js",
|
17
|
-
},
|
18
|
-
output: {
|
19
|
-
path: path.join( __dirname, production ? "./dist" : "./tmp" ),
|
20
|
-
publicPath: production ? "" : "http://localhost:8080/",
|
21
|
-
chunkFilename: "[name].[chunkhash].js",
|
22
|
-
filename: production ? "[name].[chunkhash].js" : "app.js"
|
23
|
-
},
|
24
|
-
resolve: {
|
25
|
-
extensions: [ "*", ".js" ]
|
26
|
-
},
|
27
|
-
plugins: [
|
28
|
-
new HtmlWebpackPlugin({
|
29
|
-
template: "./index-template.html",
|
30
|
-
// filter to a single compiled globalize language
|
31
|
-
// change 'en' to language of choice or remove inject all languages
|
32
|
-
// NOTE: last language will be set language
|
33
|
-
chunks: [ "vendor", "globalize-compiled-data-en", "main" ],
|
34
|
-
chunksSortMode: function ( c1, c2 ) {
|
35
|
-
var orderedChunks = [ "vendor", "globalize-compiled-data", "main" ];
|
36
|
-
var o1 = orderedChunks.indexOf( subLocaleNames( c1.names[ 0 ]));
|
37
|
-
var o2 = orderedChunks.indexOf( subLocaleNames( c2.names[ 0 ]));
|
38
|
-
return o1 - o2;
|
39
|
-
},
|
40
|
-
}),
|
41
|
-
new GlobalizePlugin({
|
42
|
-
production: production,
|
43
|
-
developmentLocale: "en",
|
44
|
-
supportedLocales: [ "ar", "de", "en", "es", "pt", "ru", "zh" ],
|
45
|
-
messages: "messages/[locale].json",
|
46
|
-
output: "i18n/[locale].[chunkhash].js"
|
47
|
-
})
|
48
|
-
].concat( production ? [
|
49
|
-
new CommonsChunkPlugin({
|
50
|
-
name: "vendor",
|
51
|
-
minChunks: function(module) {
|
52
|
-
return (
|
53
|
-
module.context && module.context.indexOf("node_modules") !== -1
|
54
|
-
);
|
55
|
-
}
|
56
|
-
}),
|
57
|
-
new webpack.optimize.UglifyJsPlugin({
|
58
|
-
compress: {
|
59
|
-
warnings: false
|
60
|
-
}
|
61
|
-
})
|
62
|
-
] : [] )
|
63
|
-
};
|