Skip to content

Commit 117fe1c

Browse files
Merge pull request #11 from telerik/docs-update
Docs update
2 parents eac81d1 + 0b11a56 commit 117fe1c

File tree

12 files changed

+451
-366
lines changed

12 files changed

+451
-366
lines changed

README.md

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,30 @@
77

88
This repository contains the source code and documentation of the Kendo UI Internationalization package.
99

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:
1111

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)
1718

1819
## Basic Usage
1920

2021
### CLDR Data
2122

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+
2325
```sh
2426
npm install --save cldr-data
2527
```
2628

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.
2834

2935
```javascript
3036
import { load } from '@telerik/kendo-intl';
@@ -42,7 +48,7 @@ For more examples and available configuration options, refer to the article on [
4248

4349
### Date Parsing
4450

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.
4652

4753
```js
4854
import { parseDate } from '@telerik/kendo-intl';
@@ -56,7 +62,7 @@ For more examples and available configuration options, refer to the article on [
5662

5763
### Date Formatting
5864

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.
6066

6167
```js
6268
import { formatDate } from '@telerik/kendo-intl';
@@ -70,22 +76,22 @@ For more examples and available configuration options, refer to the article on [
7076

7177
### Number Parsing
7278

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.
7480

7581
```js
7682
import { parseNumber } from '@telerik/kendo-intl';
7783

7884
parseNumber("12.22"); // 12.22
7985
parseNumber("1.212,22 €", "de"); // 1212.22
80-
parseNumber("10.22 %"); // 0.1022
86+
parseNumber("10.22 %"); // 0.1022
8187
parseNumber("1,0000123e+4", "bg"); // 10000.123
8288
```
8389

8490
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).
8591

8692
### Number Formatting
8793

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.
8995

9096
```js
9197
import { formatNumber } from '@telerik/kendo-intl';
@@ -105,29 +111,43 @@ formatNumber(2345678, "##,#.00"); // 2,345,678.00
105111

106112
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).
107113

108-
## Installation
114+
### General Formatting
109115

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.
111117

112-
Install it using NPM.
118+
```js
119+
import { format, toString } from '@telerik/kendo-intl';
113120

114-
```bash
115-
npm install --save '@telerik/kendo-intl';
116-
```
121+
format('Date: {0:d} - Price: {1:c}', [new Date(), 10.5], "en") // Date: 1/5/2017 - Price: $10.50
117122

118-
Once installed, import the module.
123+
toString(10.5, "c", "bg"); // 10,50 лв.
119124

120-
```javascript
121-
// ES2015 module syntax
122-
import { formatDate, parseDate } from '@telerik/kendo-intl';
123-
//or
124-
import { formatNumber, parseNumber } from '@telerik/kendo-intl';
125-
```
126-
```javascript
127-
// CommonJS format
128-
var numbers = require('@telerik/kendo-intl/number').numbers;
129-
//or
130-
var dates = require('@telerik/kendo-intl/dates').dates;
125+
toString(new Date(), "d"); // 1/5/2017
131126
```
132127

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;
153+
```

docs/cldr/api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Loads CLDR data.
2020

2121
##### data `Object`
2222

23-
The CLDR data to be loaded. Multiple parameters are accepted.
23+
The CLDR data to be loaded. Accepts multiple parameters.
2424

2525
### firstDay
2626

@@ -84,7 +84,7 @@ Indicates whether the standalone names should be returned.
8484

8585
The names.
8686

87-
An object will be returned if the type is `"dayPeriods"` or `"eras"`. For the other types, the result is `Array`.
87+
If the type is `"dayPeriods"` or `"eras"`, an object is returned. For the other types, the result is `Array`.
8888

8989
### numberSymbols
9090

@@ -100,4 +100,4 @@ The locale id.
100100

101101
##### Returns `Object`
102102

103-
An object holding the number symbols from the specified locale.
103+
Holds the number symbols from the specified locale.

docs/cldr/index.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,32 @@ position: 1
88

99
# CLDR Data
1010

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.
1212

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.
1414

1515
## Prerequisites
1616

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.
1818

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` |
24-
| Basic dates | `cldr/main/locale/ca-gregorian.json` |
25-
| Localized timezone | `cldr/main/locale/timeZoneNames.json` |
19+
The following table provides the data formats that are required for number and date formatting and parsing when you use a non-default locale.
2620

27-
## Getting CLDR Data
21+
| FORMATS | REQUIRED DATA |
22+
|:--- |:--- |
23+
| Any | `cldr/supplemental/likelySubtags.json` |
24+
| Basic numbers | `cldr/main/locale/numbers.json` |
25+
| Currency | `cldr/main/locale/currencies.json` and `cldr/supplemental/currencyData.json` |
26+
| Basic dates | `cldr/main/locale/ca-gregorian.json` |
27+
| Localized timezone | `cldr/main/locale/timeZoneNames.json` |
28+
| Numeric week day formatting | `cldr/supplemental/weekData.json` |
2829

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
3031

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.
3233

3334
## Loading CLDR Data
3435

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.
3637

3738
```
3839
import { cldr, load } from '@telerik/kendo-intl';

0 commit comments

Comments
 (0)