You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-32Lines changed: 52 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,24 +7,30 @@
7
7
8
8
This repository contains the source code and documentation of the Kendo UI Internationalization package.
9
9
10
-
It includes methods for parsing and formatting dates and numbers using [Unicode Common Locale Data Repository (CLDR)](http://cldr.unicode.org/) data, which are split into the following modules:
10
+
It includes methods for parsing and formatting dates and numbers by using [Unicode Common Locale Data Repository (CLDR)](http://cldr.unicode.org/) data. These methods are split into the following modules:
11
11
12
-
* CLDR
13
-
* Date Parsing
14
-
* Date Formatting
15
-
* Number Parsing
16
-
* Number Formatting
12
+
*[CLDR](#cldr-data)
13
+
*[Date Parsing](#date-parsing)
14
+
*[Date Formatting](#date-formatting)
15
+
*[Number Parsing](#number-parsing)
16
+
*[Number Formatting](#number-formatting)
17
+
*[General Formatting](#general-formatting)
17
18
18
19
## Basic Usage
19
20
20
21
### CLDR Data
21
22
22
-
The [cldr-data module](https://www.npmjs.com/package/cldr-data) is required in order to download the full CDLR database.
23
+
To download the full CDLR database, you need to install the [cldr-data module](https://www.npmjs.com/package/cldr-data) by running the following command.
24
+
23
25
```sh
24
26
npm install --save cldr-data
25
27
```
26
28
27
-
To use the methods for different locales, use the [`load`](https://github.com/telerik/kendo-intl/blob/master/docs/cldr/api.md#load) method to load the `likelySubtags` and locale data. Additionally, the library requires the loading of the supplemental `currencyData` for the default currency formatting and the `weekData` for the day of week formatting.
29
+
To apply the methods for different locales, load the `likelySubtags` and the locale data by using the [`load`](https://github.com/telerik/kendo-intl/blob/master/docs/cldr/api.md#load) method.
30
+
31
+
Additionally, the library requires you to load:
32
+
* The supplemental `currencyData` for the default currency formatting.
33
+
* The `weekData` for the day of week formatting.
28
34
29
35
```javascript
30
36
import { load } from'@telerik/kendo-intl';
@@ -42,7 +48,7 @@ For more examples and available configuration options, refer to the article on [
42
48
43
49
### Date Parsing
44
50
45
-
Date parsing converts a string to a `Date` object using the locale specific settings.
51
+
Date parsing converts a string to a `Date` object by using the specific settings of the locale.
46
52
47
53
```js
48
54
import { parseDate } from'@telerik/kendo-intl';
@@ -56,7 +62,7 @@ For more examples and available configuration options, refer to the article on [
56
62
57
63
### Date Formatting
58
64
59
-
Date parsing converts a `Date` object to a human-readable string using the locale specific settings.
65
+
Date formatting converts a `Date` object to a human-readable string by using the specific settings of the locale.
60
66
61
67
```js
62
68
import { formatDate } from'@telerik/kendo-intl';
@@ -70,22 +76,22 @@ For more examples and available configuration options, refer to the article on [
70
76
71
77
### Number Parsing
72
78
73
-
Number parsing converts a string to a `Number` object using the specific settings of the locale.
79
+
Number parsing converts a string to a `Number` object by using the specific settings of the locale.
74
80
75
81
```js
76
82
import { parseNumber } from'@telerik/kendo-intl';
77
83
78
84
parseNumber("12.22"); // 12.22
79
85
parseNumber("1.212,22 €", "de"); // 1212.22
80
-
parseNumber("10.22 %"); // 0.1022
86
+
parseNumber("10.22 %"); // 0.1022
81
87
parseNumber("1,0000123e+4", "bg"); // 10000.123
82
88
```
83
89
84
90
For more examples and available configuration options, refer to the article on [number parsing](https://github.com/telerik/kendo-intl/blob/master/docs/num-parsing/index.md).
85
91
86
92
### Number Formatting
87
93
88
-
Number formatting converts a `Number` object to a human-readable string using the locale specific settings.
94
+
Number formatting converts a `Number` object to a human-readable string using the specific settings of the locale.
For more examples and available configuration options, refer to the article on [number formatting](https://github.com/telerik/kendo-intl/blob/master/docs/num-formatting/index.md).
107
113
108
-
##Installation
114
+
### General Formatting
109
115
110
-
The Internationalization library is published as a [scoped NPM package](https://docs.npmjs.com/misc/scope) in the [NPMJS Telerik account](https://www.npmjs.com/~telerik).
116
+
General formatting provides methods for independent placeholder and type formatting by using the specific settings of the locale.
111
117
112
-
Install it using NPM.
118
+
```js
119
+
import { format, toString } from'@telerik/kendo-intl';
var numbers =require('@telerik/kendo-intl/number').numbers;
129
-
//or
130
-
var dates =require('@telerik/kendo-intl/dates').dates;
125
+
toString(newDate(), "d"); // 1/5/2017
131
126
```
132
127
133
-
> To install the npm package, you use Node.js 5.0.0 or later versions.
128
+
For more examples and available configuration options, refer to the article on [general formatting](https://github.com/telerik/kendo-intl/blob/master/docs/general-formatting/index.md).
129
+
130
+
## Installation
131
+
132
+
1. The Internationalization library is published as a [scoped NPM package](https://docs.npmjs.com/misc/scope) in the [NPMJS Telerik account](https://www.npmjs.com/~telerik).
133
+
134
+
2. Download and install the module:
135
+
136
+
```bash
137
+
npm install --save '@telerik/kendo-intl';
138
+
```
139
+
140
+
3. Once installed, import the Internationalization in your application root module:
141
+
142
+
```javascript
143
+
// ES2015 module syntax
144
+
import { formatDate, parseDate } from '@telerik/kendo-intl';
145
+
//or
146
+
import { formatNumber, parseNumber } from '@telerik/kendo-intl';
147
+
```
148
+
```javascript
149
+
// CommonJS format
150
+
var numbers = require('@telerik/kendo-intl/number').numbers;
151
+
//or
152
+
var dates = require('@telerik/kendo-intl/dates').dates;
Copy file name to clipboardExpand all lines: docs/cldr/index.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,31 +8,32 @@ position: 1
8
8
9
9
# CLDR Data
10
10
11
-
The Kendo UI Internationalization library uses the [Unicode Common Locale Data Repository (CLDR)](http://cldr.unicode.org/) as a source for the locale information. To function properly, it requires the data for the corresponding locale to load.
11
+
The Kendo UI Internationalization library uses the [Unicode Common Locale Data Repository (CLDR)](http://cldr.unicode.org/) as a source for the locale information.
12
12
13
-
The `numbers`, `currencies`, `gregorian calendar`(`"ca-gregorian"`) and `timeZoneNames` for the `en` locale and the `supplemental weekData` are loaded by default.
13
+
In order for it to function properly, load the data for the corresponding locale. By default, the `numbers`, `currencies`, `gregorian calendar`(`"ca-gregorian"`), and `timeZoneNames` for the `en` locale are loaded. To support `en` dates and numbers parsing and formatting without loading any data, a subset of the supplemental `currencyData`, `likelySubtags`, and `weekData` is also loaded.
14
14
15
15
## Prerequisites
16
16
17
-
The table below lists the data which is required for number and date formatting and parsing.
17
+
If you work with the `en` locale, you do not have to load any data. The only exception refers to the currency formatting with non-default currency. In this case, load the `cldr-data/main/en/currencies.json` data.
18
18
19
-
| FORMATS | REQUIRED DATA |
20
-
|:--- |:--- |
21
-
| Any |`cldr/supplemental/likelySubtags.json`|
22
-
| Basic numbers |`cldr/main/locale/numbers.json`|
23
-
| Currency |`cldr/main/locale/currencies.json` and `cldr/supplemental/currencyData.json`|
| Numeric week day formatting |`cldr/supplemental/weekData.json`|
28
29
29
-
Unicode CLDR is available as JSON at [https://github.com/unicode-cldr/](https://github.com/unicode-cldr/). For more information on the package organization, refer to [https://github.com/unicode-cldr/cldr-json](https://github.com/unicode-cldr/cldr-json) .
30
+
## Getting CLDR Data
30
31
31
-
It is also available as a single [cldr-data](https://www.npmjs.com/package/cldr-data) package.
32
+
Unicode CLDR is available as JSON at [https://github.com/unicode-cldr/](https://github.com/unicode-cldr/). For more information on the package organization, refer to [https://github.com/unicode-cldr/cldr-json](https://github.com/unicode-cldr/cldr-json). It is also available as a single [cldr-data](https://www.npmjs.com/package/cldr-data) package.
32
33
33
34
## Loading CLDR Data
34
35
35
-
Load the CLDR data using the [`load`]({% cldrapi_internalization %}#load) method.
36
+
To load the CLDR data, use the [`load`]({% cldrapi_internalization %}#load) method.
0 commit comments