Kendo UI Internationalization
This repository contains the source code and documentation of the Kendo UI Internationalization package.
It includes methods for parsing and formatting dates and numbers by using Unicode Common Locale Data Repository (CLDR) data. These methods are split into the following modules:
Basic Usage
CLDR Data
To download the full CDLR database, you need to install the cldr-data module by running the following command.
npm install --save cldr-data
To apply the methods for different locales, load the likelySubtags
and the locale data by using the load
method.
Additionally, the library requires you to load:
- The supplemental
currencyData
for the default currency formatting. - The
weekData
for the day of week formatting.
import { load } from '@telerik/kendo-intl';
load(
require("cldr-data/supplemental/likelySubtags.json"),
require("cldr-data/supplemental/currencyData.json"),
require("cldr-data/supplemental/weekData.json"),
require("cldr-data/main/bg/numbers.json"),
require("cldr-data/main/bg/currencies.json"),
require("cldr-data/main/bg/ca-gregorian.json"),
require("cldr-data/main/bg/dateFields.json"),
require("cldr-data/main/bg/timeZoneNames.json")
);
For more examples and available configuration options, refer to the article on CLDR Data.
Date Parsing
Date parsing converts a string into a Date
object by using the specific settings of the locale.
import { parseDate } from '@telerik/kendo-intl';
parseDate("11/6/2000", ["G", "d"]);
parseDate("Montag, 6.11.2000", "EEEE, d.MM.y", "de");
parseDate("2000-11-06T10:30Z");
For more examples and available configuration options, refer to the article on date parsing.
Date Formatting
Date formatting converts a Date
object into a human-readable string by using the specific settings of the locale.
import { formatDate } from '@telerik/kendo-intl';
formatDate(new Date(2000, 10, 6), "d");
formatDate(new Date(2000, 10, 6), "yMd", "de");
formatDate(new Date(2000, 10, 6), "EEEE, d.MM.y", "bg");
For more examples and available configuration options, refer to the article on date formatting.
Number Parsing
Number parsing converts a string into a Number
object by using the specific settings of the locale.
import { parseNumber } from '@telerik/kendo-intl';
parseNumber("12.22");
parseNumber("1.212,22 €", "de");
parseNumber("10.22 %");
parseNumber("1,0000123e+4", "bg");
For more examples and available configuration options, refer to the article on number parsing.
Number Formatting
Number formatting converts a Number
object into a human-readable string using the specific settings of the locale.
import { formatNumber } from '@telerik/kendo-intl';
formatNumber(1234.567, "n2");
formatNumber(1234.567, "c", "de");
formatNumber(1234.567, {
style: "currency",
currency: "USD",
currencyDisplay: "displayName"
}, "bg");
formatNumber(2345678, "##,#.00");
For more examples and available configuration options, refer to the article on number formatting.
General Formatting
General formatting provides methods for independent placeholder and type formatting by using the specific settings of the locale.
import { format, toString } from '@telerik/kendo-intl';
format('Date: {0:d} - Price: {1:c}', [new Date(), 10.5], "en")
toString(10.5, "c", "bg");
toString(new Date(), "d");
For more examples and available configuration options, refer to the article on general formatting.
Installation
-
The Internationalization library is published as a scoped NPM package in the NPMJS Telerik account.
-
Download and install the module:
npm install --save '@telerik/kendo-intl';
-
Once installed, import the Internationalization in your application root module:
import { formatDate, parseDate } from '@telerik/kendo-intl';
import { formatNumber, parseNumber } from '@telerik/kendo-intl';
var numbers = require('@telerik/kendo-intl/number').numbers;
var dates = require('@telerik/kendo-intl/dates').dates;