@telerik/kendo-intl
Advanced tools
Comparing version 1.0.0 to 1.1.0-dev.201705251330
@@ -6,3 +6,3 @@ /** | ||
/** | ||
* Specifies the type of names. | ||
* Specifies the type of the names. | ||
*/ | ||
@@ -12,3 +12,3 @@ type: 'dayPeriods' | 'days' | 'months' | 'quarters' | 'eras'; | ||
/** | ||
* Specifies the names form. | ||
* Specifies the form of the names. | ||
*/ | ||
@@ -18,3 +18,3 @@ nameType: 'abbreviated' | 'narrow' | 'short' | 'wide'; | ||
/** | ||
* Specifies if the returned names should be converted to lower case. | ||
* Specifies whether the returned names should be converted to lower case. | ||
*/ | ||
@@ -32,5 +32,5 @@ lower?: boolean; | ||
* | ||
* @param locale The locale id which defines the locale from which the names should be retrieved. | ||
* @param options The options that determine the returned names. | ||
* @returns The date format names. | ||
* @param locale - The locale `id` which defines the locale from which the names should be retrieved. | ||
* @param options - The options that determine the returned names. | ||
* @returns - The date format names. | ||
*/ | ||
@@ -40,3 +40,3 @@ export function dateFormatNames(locale: string, options: DateFormatNameOptions): any; | ||
/** | ||
* Settings for the dateFieldName function. | ||
* Settings for the `dateFieldName` function. | ||
*/ | ||
@@ -68,3 +68,3 @@ export interface DateFieldNameOptions { | ||
/** | ||
* Returns a localized date field name based on a specific format specifier. | ||
* Returns a localized date-field name based on a specific format specifier. | ||
* | ||
@@ -89,5 +89,5 @@ * The available `type` values are: | ||
* | ||
* @param options Detailed configuration for the desired date field name. | ||
* @param locale The optional locale id. If not specified, the `"en"` locale id is used. | ||
* @returns The localized date field name from the current locale based on the option. | ||
* @param options - Detailed configuration for the desired date-field name. | ||
* @param locale - The optional locale `id`. If not specified, the `id` of the `"en"` locale is used. | ||
* @returns - The localized date-field name from the current locale based on the option. | ||
* | ||
@@ -106,6 +106,6 @@ * | ||
/** | ||
* Returns the first day index starting from Sunday based on the specified locale. | ||
* Returns the first-day index starting from Sunday and based on the specified locale. | ||
* | ||
* @param locale The locale id. | ||
* @returns The first day index. | ||
* @param locale - The locale `id`. | ||
* @returns - The first-day index. | ||
*/ | ||
@@ -117,3 +117,3 @@ export function firstDay(locale: string): number; | ||
* | ||
* @param data The CLDR data to be loaded. Accepts multiple parameters. | ||
* @param data - The CLDR data to be loaded. Accepts multiple parameters. | ||
*/ | ||
@@ -125,4 +125,4 @@ export function load(...data: any[]): void; | ||
* | ||
* @param locale The locale id which defines the locale for which the number symbols should be returned. | ||
* @returns The number symbols. | ||
* @param locale - The locale `id` that defines the locale for which the number symbols should be returned. | ||
* @returns - The number symbols. | ||
*/ | ||
@@ -134,2 +134,7 @@ export function numberSymbols(locale: string): any; | ||
*/ | ||
export function setData(data: any): void; | ||
/** | ||
* @hidden | ||
*/ | ||
export interface CurrencyDisplayOptions { | ||
@@ -136,0 +141,0 @@ currency: string; |
export { default as load } from './cldr/load'; | ||
export { default as setData } from './cldr/set-data'; | ||
export { default as dateFieldName } from './cldr/date-field-name'; | ||
@@ -9,2 +10,3 @@ export { default as dateFormatNames } from './cldr/date-format-names'; | ||
//# sourceMappingURL=cldr.js.map |
@@ -6,2 +6,4 @@ import { cldr, getLocaleInfo } from './info'; | ||
/* eslint-disable consistent-return */ | ||
var NoCurrency = errors.NoCurrency; | ||
@@ -17,7 +19,17 @@ var NoCurrencyDisplay = errors.NoCurrencyDisplay; | ||
function getCurrencyInfo(locale, currency) { | ||
var GLOBAL_CURRENCIES = { | ||
'001': 'USD', // 001 refers to world. not sure if it is correct to assume USD but seems better than throw an error | ||
'150': 'EUR' // 150 territory for Europe | ||
}; | ||
function getCurrencyInfo(locale, currency, throwIfNoValid) { | ||
var info = getLocaleInfo(locale); | ||
var currencies = info.numbers.currencies; | ||
if (!currencies) { | ||
throw NoCurrency.error(); | ||
if (throwIfNoValid) { | ||
throw NoCurrency.error(); | ||
} | ||
return; | ||
} | ||
@@ -28,3 +40,7 @@ | ||
if (!currencyDisplayInfo) { | ||
throw NoCurrencyDisplay.error(); | ||
if (throwIfNoValid) { | ||
throw NoCurrencyDisplay.error(); | ||
} | ||
return; | ||
} | ||
@@ -71,4 +87,10 @@ | ||
export function currencyDisplays(locale, currency) { | ||
var currencyInfo = getCurrencyInfo(locale, currency); | ||
export function currencyDisplays(locale, currency, throwIfNoValid) { | ||
if ( throwIfNoValid === void 0 ) throwIfNoValid = true; | ||
var currencyInfo = getCurrencyInfo(locale, currency, throwIfNoValid); | ||
if (!currencyInfo) { | ||
return; | ||
} | ||
if (!currencyInfo.displays) { | ||
@@ -95,3 +117,3 @@ var displays = [ currency ]; | ||
var currencyInfo = getCurrencyInfo(locale, currency); | ||
var currencyInfo = getCurrencyInfo(locale, currency, true); | ||
var result; | ||
@@ -128,6 +150,16 @@ | ||
export function territoryCurrencyCode(territory) { | ||
export function territoryCurrencyCode(territory, throwIfNoValid) { | ||
if ( throwIfNoValid === void 0 ) throwIfNoValid = true; | ||
if (GLOBAL_CURRENCIES[territory]) { | ||
return GLOBAL_CURRENCIES[territory]; | ||
} | ||
var currencyData = cldr.supplemental.currencyData; | ||
if (!currencyData) { | ||
throw NoSupplementalCurrency.error(); | ||
if (throwIfNoValid) { | ||
throw NoSupplementalCurrency.error(); | ||
} | ||
return; | ||
} | ||
@@ -138,3 +170,7 @@ | ||
if (!regionCurrencies) { | ||
throw NoCurrencyRegion.error(territory); | ||
if (throwIfNoValid) { | ||
throw NoCurrencyRegion.error(territory); | ||
} | ||
return; | ||
} | ||
@@ -152,3 +188,3 @@ | ||
if (!numbers.localeCurrency) { | ||
var currency = territoryCurrencyCode(localeTerritory(info)); | ||
var currency = territoryCurrencyCode(localeTerritory(info), throwIfNoValid); | ||
@@ -155,0 +191,0 @@ if (!currency && throwIfNoValid) { |
import { localeInfo } from './info'; | ||
import { errors } from '../errors'; | ||
@@ -7,3 +8,7 @@ export default function dateFieldName(options, locale) { | ||
var info = localeInfo(locale); | ||
var dateFields = info.calendar.dateFields || {}; | ||
var dateFields = info.calendar.dateFields; | ||
if (!dateFields) { | ||
throw errors.NoDateFieldNames.error(); | ||
} | ||
var fieldNameInfo = dateFields[options.type] || {}; | ||
@@ -10,0 +15,0 @@ |
var defaultData = { | ||
"en": { | ||
"name": "en", | ||
"identity": { | ||
"version": { | ||
"_number": "$Revision: 12418 $", | ||
"_cldrVersion": "29" | ||
en: { | ||
name: "en", | ||
identity: { | ||
version: { | ||
_number: "$Revision: 12418 $", | ||
_cldrVersion: "29" | ||
}, | ||
"language": "en" | ||
language: "en" | ||
}, | ||
"territory": "US", | ||
"numbers": { | ||
"symbols": { | ||
"decimal": ".", | ||
"group": ",", | ||
"list": ";", | ||
"percentSign": "%", | ||
"plusSign": "+", | ||
"minusSign": "-", | ||
"exponential": "E", | ||
"superscriptingExponent": "×", | ||
"perMille": "‰", | ||
"infinity": "∞", | ||
"nan": "NaN", | ||
"timeSeparator": ":" | ||
territory: "US", | ||
numbers: { | ||
symbols: { | ||
decimal: ".", | ||
group: ",", | ||
list: ";", | ||
percentSign: "%", | ||
plusSign: "+", | ||
minusSign: "-", | ||
exponential: "E", | ||
superscriptingExponent: "×", | ||
perMille: "‰", | ||
infinity: "∞", | ||
nan: "NaN", | ||
timeSeparator: ":" | ||
}, | ||
"decimal": { | ||
"patterns": [ | ||
decimal: { | ||
patterns: [ | ||
"n" | ||
], | ||
"groupSize": [ | ||
groupSize: [ | ||
3 | ||
] | ||
}, | ||
"scientific": { | ||
"patterns": [ | ||
scientific: { | ||
patterns: [ | ||
"nEn" | ||
], | ||
"groupSize": [] | ||
groupSize: [] | ||
}, | ||
"percent": { | ||
"patterns": [ | ||
percent: { | ||
patterns: [ | ||
"n%" | ||
], | ||
"groupSize": [ | ||
groupSize: [ | ||
3 | ||
] | ||
}, | ||
"currency": { | ||
"patterns": [ | ||
currency: { | ||
patterns: [ | ||
"$n" | ||
], | ||
"groupSize": [ | ||
groupSize: [ | ||
3 | ||
@@ -59,218 +59,110 @@ ], | ||
}, | ||
"currencies": { | ||
"BGN": { | ||
"displayName": "Bulgarian Lev", | ||
currencies: { | ||
BGN: { | ||
displayName: "Bulgarian Lev", | ||
"displayName-count-one": "Bulgarian lev", | ||
"displayName-count-other": "Bulgarian leva", | ||
"symbol": "BGN" | ||
symbol: "BGN" | ||
}, | ||
"EUR": { | ||
"displayName": "Euro", | ||
EUR: { | ||
displayName: "Euro", | ||
"displayName-count-one": "euro", | ||
"displayName-count-other": "euros", | ||
"symbol": "€", | ||
symbol: "€", | ||
"symbol-alt-narrow": "€" | ||
}, | ||
"USD": { | ||
"displayName": "US Dollar", | ||
USD: { | ||
displayName: "US Dollar", | ||
"displayName-count-one": "US dollar", | ||
"displayName-count-other": "US dollars", | ||
"symbol": "$", | ||
symbol: "$", | ||
"symbol-alt-narrow": "$" | ||
} | ||
}, | ||
"localeCurrency": "USD" | ||
localeCurrency: "USD" | ||
}, | ||
"calendar": { | ||
"gmtFormat": "GMT{0}", | ||
"gmtZeroFormat": "GMT", | ||
"patterns": { | ||
"d": "M/d/y", | ||
"D": "EEEE, MMMM d, y", | ||
"m": "MMM d", | ||
"M": "MMMM d", | ||
"y": "MMM y", | ||
"Y": "MMMM y", | ||
"F": "EEEE, MMMM d, y h:mm:ss a", | ||
"g": "M/d/y h:mm a", | ||
"G": "M/d/y h:mm:ss a", | ||
"t": "h:mm a", | ||
"T": "h:mm:ss a", | ||
"s": "yyyy'-'MM'-'dd'T'HH':'mm':'ss", | ||
"u": "yyyy'-'MM'-'dd HH':'mm':'ss'Z'" | ||
calendar: { | ||
gmtFormat: "GMT{0}", | ||
gmtZeroFormat: "GMT", | ||
patterns: { | ||
d: "M/d/y", | ||
D: "EEEE, MMMM d, y", | ||
m: "MMM d", | ||
M: "MMMM d", | ||
y: "MMM y", | ||
Y: "MMMM y", | ||
F: "EEEE, MMMM d, y h:mm:ss a", | ||
g: "M/d/y h:mm a", | ||
G: "M/d/y h:mm:ss a", | ||
t: "h:mm a", | ||
T: "h:mm:ss a", | ||
s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss", | ||
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'" | ||
}, | ||
"dateTimeFormats": { | ||
"full": "{1} 'at' {0}", | ||
"long": "{1} 'at' {0}", | ||
"medium": "{1}, {0}", | ||
"short": "{1}, {0}", | ||
"availableFormats": { | ||
"d": "d", | ||
"E": "ccc", | ||
"Ed": "d E", | ||
"Ehm": "E h:mm a", | ||
"EHm": "E HH:mm", | ||
"Ehms": "E h:mm:ss a", | ||
"EHms": "E HH:mm:ss", | ||
"Gy": "y G", | ||
"GyMMM": "MMM y G", | ||
"GyMMMd": "MMM d, y G", | ||
"GyMMMEd": "E, MMM d, y G", | ||
"h": "h a", | ||
"H": "HH", | ||
"hm": "h:mm a", | ||
"Hm": "HH:mm", | ||
"hms": "h:mm:ss a", | ||
"Hms": "HH:mm:ss", | ||
"hmsv": "h:mm:ss a v", | ||
"Hmsv": "HH:mm:ss v", | ||
"hmv": "h:mm a v", | ||
"Hmv": "HH:mm v", | ||
"M": "L", | ||
"Md": "M/d", | ||
"MEd": "E, M/d", | ||
"MMM": "LLL", | ||
"MMMd": "MMM d", | ||
"MMMEd": "E, MMM d", | ||
"MMMMd": "MMMM d", | ||
dateTimeFormats: { | ||
full: "{1} 'at' {0}", | ||
long: "{1} 'at' {0}", | ||
medium: "{1}, {0}", | ||
short: "{1}, {0}", | ||
availableFormats: { | ||
d: "d", | ||
E: "ccc", | ||
Ed: "d E", | ||
Ehm: "E h:mm a", | ||
EHm: "E HH:mm", | ||
Ehms: "E h:mm:ss a", | ||
EHms: "E HH:mm:ss", | ||
Gy: "y G", | ||
GyMMM: "MMM y G", | ||
GyMMMd: "MMM d, y G", | ||
GyMMMEd: "E, MMM d, y G", | ||
h: "h a", | ||
H: "HH", | ||
hm: "h:mm a", | ||
Hm: "HH:mm", | ||
hms: "h:mm:ss a", | ||
Hms: "HH:mm:ss", | ||
hmsv: "h:mm:ss a v", | ||
Hmsv: "HH:mm:ss v", | ||
hmv: "h:mm a v", | ||
Hmv: "HH:mm v", | ||
M: "L", | ||
Md: "M/d", | ||
MEd: "E, M/d", | ||
MMM: "LLL", | ||
MMMd: "MMM d", | ||
MMMEd: "E, MMM d", | ||
MMMMd: "MMMM d", | ||
"MMMMW-count-one": "'week' W 'of' MMMM", | ||
"MMMMW-count-other": "'week' W 'of' MMMM", | ||
"ms": "mm:ss", | ||
"y": "y", | ||
"yM": "M/y", | ||
"yMd": "M/d/y", | ||
"yMEd": "E, M/d/y", | ||
"yMMM": "MMM y", | ||
"yMMMd": "MMM d, y", | ||
"yMMMEd": "E, MMM d, y", | ||
"yMMMM": "MMMM y", | ||
"yQQQ": "QQQ y", | ||
"yQQQQ": "QQQQ y", | ||
ms: "mm:ss", | ||
y: "y", | ||
yM: "M/y", | ||
yMd: "M/d/y", | ||
yMEd: "E, M/d/y", | ||
yMMM: "MMM y", | ||
yMMMd: "MMM d, y", | ||
yMMMEd: "E, MMM d, y", | ||
yMMMM: "MMMM y", | ||
yQQQ: "QQQ y", | ||
yQQQQ: "QQQQ y", | ||
"yw-count-one": "'week' w 'of' y", | ||
"yw-count-other": "'week' w 'of' y" | ||
}, | ||
"appendItems": { | ||
"Day": "{0} ({2}: {1})", | ||
"Day-Of-Week": "{0} {1}", | ||
"Era": "{0} {1}", | ||
"Hour": "{0} ({2}: {1})", | ||
"Minute": "{0} ({2}: {1})", | ||
"Month": "{0} ({2}: {1})", | ||
"Quarter": "{0} ({2}: {1})", | ||
"Second": "{0} ({2}: {1})", | ||
"Timezone": "{0} {1}", | ||
"Week": "{0} ({2}: {1})", | ||
"Year": "{0} {1}" | ||
}, | ||
"intervalFormats": { | ||
"intervalFormatFallback": "{0} – {1}", | ||
"d": { | ||
"d": "d – d" | ||
}, | ||
"h": { | ||
"a": "h a – h a", | ||
"h": "h – h a" | ||
}, | ||
"H": { | ||
"H": "HH – HH" | ||
}, | ||
"hm": { | ||
"a": "h:mm a – h:mm a", | ||
"h": "h:mm – h:mm a", | ||
"m": "h:mm – h:mm a" | ||
}, | ||
"Hm": { | ||
"H": "HH:mm – HH:mm", | ||
"m": "HH:mm – HH:mm" | ||
}, | ||
"hmv": { | ||
"a": "h:mm a – h:mm a v", | ||
"h": "h:mm – h:mm a v", | ||
"m": "h:mm – h:mm a v" | ||
}, | ||
"Hmv": { | ||
"H": "HH:mm – HH:mm v", | ||
"m": "HH:mm – HH:mm v" | ||
}, | ||
"hv": { | ||
"a": "h a – h a v", | ||
"h": "h – h a v" | ||
}, | ||
"Hv": { | ||
"H": "HH – HH v" | ||
}, | ||
"M": { | ||
"M": "M – M" | ||
}, | ||
"Md": { | ||
"d": "M/d – M/d", | ||
"M": "M/d – M/d" | ||
}, | ||
"MEd": { | ||
"d": "E, M/d – E, M/d", | ||
"M": "E, M/d – E, M/d" | ||
}, | ||
"MMM": { | ||
"M": "MMM – MMM" | ||
}, | ||
"MMMd": { | ||
"d": "MMM d – d", | ||
"M": "MMM d – MMM d" | ||
}, | ||
"MMMEd": { | ||
"d": "E, MMM d – E, MMM d", | ||
"M": "E, MMM d – E, MMM d" | ||
}, | ||
"y": { | ||
"y": "y – y" | ||
}, | ||
"yM": { | ||
"M": "M/y – M/y", | ||
"y": "M/y – M/y" | ||
}, | ||
"yMd": { | ||
"d": "M/d/y – M/d/y", | ||
"M": "M/d/y – M/d/y", | ||
"y": "M/d/y – M/d/y" | ||
}, | ||
"yMEd": { | ||
"d": "E, M/d/y – E, M/d/y", | ||
"M": "E, M/d/y – E, M/d/y", | ||
"y": "E, M/d/y – E, M/d/y" | ||
}, | ||
"yMMM": { | ||
"M": "MMM – MMM y", | ||
"y": "MMM y – MMM y" | ||
}, | ||
"yMMMd": { | ||
"d": "MMM d – d, y", | ||
"M": "MMM d – MMM d, y", | ||
"y": "MMM d, y – MMM d, y" | ||
}, | ||
"yMMMEd": { | ||
"d": "E, MMM d – E, MMM d, y", | ||
"M": "E, MMM d – E, MMM d, y", | ||
"y": "E, MMM d, y – E, MMM d, y" | ||
}, | ||
"yMMMM": { | ||
"M": "MMMM – MMMM y", | ||
"y": "MMMM y – MMMM y" | ||
} | ||
} | ||
}, | ||
"timeFormats": { | ||
"full": "h:mm:ss a zzzz", | ||
"long": "h:mm:ss a z", | ||
"medium": "h:mm:ss a", | ||
"short": "h:mm a" | ||
timeFormats: { | ||
full: "h:mm:ss a zzzz", | ||
long: "h:mm:ss a z", | ||
medium: "h:mm:ss a", | ||
short: "h:mm a" | ||
}, | ||
"dateFormats": { | ||
"full": "EEEE, MMMM d, y", | ||
"long": "MMMM d, y", | ||
"medium": "MMM d, y", | ||
"short": "M/d/yy" | ||
dateFormats: { | ||
full: "EEEE, MMMM d, y", | ||
long: "MMMM d, y", | ||
medium: "MMM d, y", | ||
short: "M/d/yy" | ||
}, | ||
"days": { | ||
"format": { | ||
"abbreviated": [ | ||
days: { | ||
format: { | ||
abbreviated: [ | ||
"Sun", | ||
@@ -284,3 +176,3 @@ "Mon", | ||
], | ||
"narrow": [ | ||
narrow: [ | ||
"S", | ||
@@ -294,3 +186,3 @@ "M", | ||
], | ||
"short": [ | ||
short: [ | ||
"Su", | ||
@@ -304,3 +196,3 @@ "Mo", | ||
], | ||
"wide": [ | ||
wide: [ | ||
"Sunday", | ||
@@ -316,3 +208,3 @@ "Monday", | ||
"stand-alone": { | ||
"abbreviated": [ | ||
abbreviated: [ | ||
"Sun", | ||
@@ -326,3 +218,3 @@ "Mon", | ||
], | ||
"narrow": [ | ||
narrow: [ | ||
"S", | ||
@@ -336,3 +228,3 @@ "M", | ||
], | ||
"short": [ | ||
short: [ | ||
"Su", | ||
@@ -346,3 +238,3 @@ "Mo", | ||
], | ||
"wide": [ | ||
wide: [ | ||
"Sunday", | ||
@@ -358,5 +250,5 @@ "Monday", | ||
}, | ||
"months": { | ||
"format": { | ||
"abbreviated": [ | ||
months: { | ||
format: { | ||
abbreviated: [ | ||
"Jan", | ||
@@ -375,3 +267,3 @@ "Feb", | ||
], | ||
"narrow": [ | ||
narrow: [ | ||
"J", | ||
@@ -390,3 +282,3 @@ "F", | ||
], | ||
"wide": [ | ||
wide: [ | ||
"January", | ||
@@ -407,3 +299,3 @@ "February", | ||
"stand-alone": { | ||
"abbreviated": [ | ||
abbreviated: [ | ||
"Jan", | ||
@@ -422,3 +314,3 @@ "Feb", | ||
], | ||
"narrow": [ | ||
narrow: [ | ||
"J", | ||
@@ -437,3 +329,3 @@ "F", | ||
], | ||
"wide": [ | ||
wide: [ | ||
"January", | ||
@@ -454,5 +346,5 @@ "February", | ||
}, | ||
"quarters": { | ||
"format": { | ||
"abbreviated": [ | ||
quarters: { | ||
format: { | ||
abbreviated: [ | ||
"Q1", | ||
@@ -463,3 +355,3 @@ "Q2", | ||
], | ||
"narrow": [ | ||
narrow: [ | ||
"1", | ||
@@ -470,3 +362,3 @@ "2", | ||
], | ||
"wide": [ | ||
wide: [ | ||
"1st quarter", | ||
@@ -479,3 +371,3 @@ "2nd quarter", | ||
"stand-alone": { | ||
"abbreviated": [ | ||
abbreviated: [ | ||
"Q1", | ||
@@ -486,3 +378,3 @@ "Q2", | ||
], | ||
"narrow": [ | ||
narrow: [ | ||
"1", | ||
@@ -493,3 +385,3 @@ "2", | ||
], | ||
"wide": [ | ||
wide: [ | ||
"1st quarter", | ||
@@ -502,97 +394,97 @@ "2nd quarter", | ||
}, | ||
"dayPeriods": { | ||
"format": { | ||
"abbreviated": { | ||
"midnight": "midnight", | ||
"am": "AM", | ||
dayPeriods: { | ||
format: { | ||
abbreviated: { | ||
midnight: "midnight", | ||
am: "AM", | ||
"am-alt-variant": "am", | ||
"noon": "noon", | ||
"pm": "PM", | ||
noon: "noon", | ||
pm: "PM", | ||
"pm-alt-variant": "pm", | ||
"morning1": "in the morning", | ||
"afternoon1": "in the afternoon", | ||
"evening1": "in the evening", | ||
"night1": "at night" | ||
morning1: "in the morning", | ||
afternoon1: "in the afternoon", | ||
evening1: "in the evening", | ||
night1: "at night" | ||
}, | ||
"narrow": { | ||
"midnight": "mi", | ||
"am": "a", | ||
narrow: { | ||
midnight: "mi", | ||
am: "a", | ||
"am-alt-variant": "am", | ||
"noon": "n", | ||
"pm": "p", | ||
noon: "n", | ||
pm: "p", | ||
"pm-alt-variant": "pm", | ||
"morning1": "in the morning", | ||
"afternoon1": "in the afternoon", | ||
"evening1": "in the evening", | ||
"night1": "at night" | ||
morning1: "in the morning", | ||
afternoon1: "in the afternoon", | ||
evening1: "in the evening", | ||
night1: "at night" | ||
}, | ||
"wide": { | ||
"midnight": "midnight", | ||
"am": "AM", | ||
wide: { | ||
midnight: "midnight", | ||
am: "AM", | ||
"am-alt-variant": "am", | ||
"noon": "noon", | ||
"pm": "PM", | ||
noon: "noon", | ||
pm: "PM", | ||
"pm-alt-variant": "pm", | ||
"morning1": "in the morning", | ||
"afternoon1": "in the afternoon", | ||
"evening1": "in the evening", | ||
"night1": "at night" | ||
morning1: "in the morning", | ||
afternoon1: "in the afternoon", | ||
evening1: "in the evening", | ||
night1: "at night" | ||
} | ||
}, | ||
"stand-alone": { | ||
"abbreviated": { | ||
"midnight": "midnight", | ||
"am": "AM", | ||
abbreviated: { | ||
midnight: "midnight", | ||
am: "AM", | ||
"am-alt-variant": "am", | ||
"noon": "noon", | ||
"pm": "PM", | ||
noon: "noon", | ||
pm: "PM", | ||
"pm-alt-variant": "pm", | ||
"morning1": "morning", | ||
"afternoon1": "afternoon", | ||
"evening1": "evening", | ||
"night1": "night" | ||
morning1: "morning", | ||
afternoon1: "afternoon", | ||
evening1: "evening", | ||
night1: "night" | ||
}, | ||
"narrow": { | ||
"midnight": "midnight", | ||
"am": "AM", | ||
narrow: { | ||
midnight: "midnight", | ||
am: "AM", | ||
"am-alt-variant": "am", | ||
"noon": "noon", | ||
"pm": "PM", | ||
noon: "noon", | ||
pm: "PM", | ||
"pm-alt-variant": "pm", | ||
"morning1": "morning", | ||
"afternoon1": "afternoon", | ||
"evening1": "evening", | ||
"night1": "night" | ||
morning1: "morning", | ||
afternoon1: "afternoon", | ||
evening1: "evening", | ||
night1: "night" | ||
}, | ||
"wide": { | ||
"midnight": "midnight", | ||
"am": "AM", | ||
wide: { | ||
midnight: "midnight", | ||
am: "AM", | ||
"am-alt-variant": "am", | ||
"noon": "noon", | ||
"pm": "PM", | ||
noon: "noon", | ||
pm: "PM", | ||
"pm-alt-variant": "pm", | ||
"morning1": "morning", | ||
"afternoon1": "afternoon", | ||
"evening1": "evening", | ||
"night1": "night" | ||
morning1: "morning", | ||
afternoon1: "afternoon", | ||
evening1: "evening", | ||
night1: "night" | ||
} | ||
} | ||
}, | ||
"eras": { | ||
"format": { | ||
"wide": { | ||
"0": "Before Christ", | ||
"1": "Anno Domini", | ||
eras: { | ||
format: { | ||
wide: { | ||
0: "Before Christ", | ||
1: "Anno Domini", | ||
"0-alt-variant": "Before Common Era", | ||
"1-alt-variant": "Common Era" | ||
}, | ||
"abbreviated": { | ||
"0": "BC", | ||
"1": "AD", | ||
abbreviated: { | ||
0: "BC", | ||
1: "AD", | ||
"0-alt-variant": "BCE", | ||
"1-alt-variant": "CE" | ||
}, | ||
"narrow": { | ||
"0": "B", | ||
"1": "A", | ||
narrow: { | ||
0: "B", | ||
1: "A", | ||
"0-alt-variant": "BCE", | ||
@@ -603,54 +495,54 @@ "1-alt-variant": "CE" | ||
}, | ||
"dateFields": { | ||
"era": { | ||
"wide": "era" | ||
dateFields: { | ||
era: { | ||
wide: "era" | ||
}, | ||
"year": { | ||
"wide": "year", | ||
"short": "yr.", | ||
"narrow": "yr." | ||
year: { | ||
wide: "year", | ||
short: "yr.", | ||
narrow: "yr." | ||
}, | ||
"quarter": { | ||
"wide": "quarter", | ||
"short": "qtr.", | ||
"narrow": "qtr." | ||
quarter: { | ||
wide: "quarter", | ||
short: "qtr.", | ||
narrow: "qtr." | ||
}, | ||
"month": { | ||
"wide": "month", | ||
"short": "mo.", | ||
"narrow": "mo." | ||
month: { | ||
wide: "month", | ||
short: "mo.", | ||
narrow: "mo." | ||
}, | ||
"week": { | ||
"wide": "week", | ||
"short": "wk.", | ||
"narrow": "wk." | ||
week: { | ||
wide: "week", | ||
short: "wk.", | ||
narrow: "wk." | ||
}, | ||
"day": { | ||
"wide": "day", | ||
"short": "day", | ||
"narrow": "day" | ||
day: { | ||
wide: "day", | ||
short: "day", | ||
narrow: "day" | ||
}, | ||
"weekday": { | ||
"wide": "day of the week" | ||
weekday: { | ||
wide: "day of the week" | ||
}, | ||
"dayperiod": { | ||
"wide": "AM/PM" | ||
dayperiod: { | ||
wide: "AM/PM" | ||
}, | ||
"hour": { | ||
"wide": "hour", | ||
"short": "hr.", | ||
"narrow": "hr." | ||
hour: { | ||
wide: "hour", | ||
short: "hr.", | ||
narrow: "hr." | ||
}, | ||
"minute": { | ||
"wide": "minute", | ||
"short": "min.", | ||
"narrow": "min." | ||
minute: { | ||
wide: "minute", | ||
short: "min.", | ||
narrow: "min." | ||
}, | ||
"second": { | ||
"wide": "second", | ||
"short": "sec.", | ||
"narrow": "sec." | ||
second: { | ||
wide: "second", | ||
short: "sec.", | ||
narrow: "sec." | ||
}, | ||
"zone": { | ||
"wide": "time zone" | ||
zone: { | ||
wide: "time zone" | ||
} | ||
@@ -660,12 +552,12 @@ } | ||
}, | ||
"supplemental": { | ||
"likelySubtags": { | ||
"en": "en-Latn-US" | ||
supplemental: { | ||
likelySubtags: { | ||
en: "en-Latn-US" | ||
}, | ||
"currencyData": { | ||
"region": { | ||
"US": [ | ||
currencyData: { | ||
region: { | ||
US: [ | ||
{ | ||
"USD": { | ||
"_from": "1792-01-01" | ||
USD: { | ||
_from: "1792-01-01" | ||
} | ||
@@ -676,5 +568,5 @@ } | ||
}, | ||
"weekData": { | ||
"firstDay": { | ||
"US": "sun" | ||
weekData: { | ||
firstDay: { | ||
US: "sun" | ||
} | ||
@@ -681,0 +573,0 @@ } |
@@ -10,4 +10,11 @@ import { cldr, getLocaleInfo } from './info'; | ||
var DAYS = [ "sun", "mon", "tue", "wed", "thu", "fri", "sat" ]; | ||
var DEFAULT = '001'; | ||
export default function firstDay(locale) { | ||
var info = getLocaleInfo(locale); | ||
if (!isNaN(info.firstDay)) { | ||
return info.firstDay; | ||
} | ||
var weekData = cldr.supplemental.weekData; | ||
@@ -18,4 +25,3 @@ if (!weekData) { | ||
var info = getLocaleInfo(locale); | ||
var firstDay = weekData.firstDay[localeTerritory(info)]; | ||
var firstDay = weekData.firstDay[localeTerritory(info)] || weekData.firstDay[DEFAULT]; | ||
@@ -26,5 +32,7 @@ if (!firstDay) { | ||
return DAYS.indexOf(firstDay); | ||
info.firstDay = DAYS.indexOf(firstDay); | ||
return info.firstDay; | ||
} | ||
//# sourceMappingURL=first-day.js.map |
@@ -116,3 +116,10 @@ import { cldr } from './info'; | ||
cldrCalendar.dateTimeFormats = calendar.dateTimeFormats; | ||
var dateTimeFormats = calendar.dateTimeFormats; | ||
cldrCalendar.dateTimeFormats = { | ||
full: dateTimeFormats.full, | ||
long: dateTimeFormats.long, | ||
medium: dateTimeFormats.medium, | ||
short: dateTimeFormats.short, | ||
availableFormats: dateTimeFormats.availableFormats | ||
}; | ||
cldrCalendar.timeFormats = calendar.timeFormats; | ||
@@ -119,0 +126,0 @@ cldrCalendar.dateFormats = calendar.dateFormats; |
@@ -13,2 +13,29 @@ import { cldr } from './info'; | ||
function territoryFromName(name, identity) { | ||
var likelySubtags = cldr.supplemental.likelySubtags; | ||
var parts = name.split("-"); | ||
if (likelySubtags) { | ||
var likelyName = likelySubtags[name] || likelySubtags[parts[0]]; | ||
if (likelyName) { | ||
parts = likelyName.split("-"); | ||
} | ||
} | ||
if (identity) { | ||
for (var idx = parts.length - 1; idx >= 1; idx--) { | ||
var part = parts[idx]; | ||
if (part === identity.variant || part === identity.script) { | ||
parts.splice(idx, 1); | ||
} | ||
} | ||
} | ||
var length = parts.length; | ||
if (length > 1) { | ||
var territory = parts[length - 1]; | ||
return territory.toUpperCase(); | ||
} | ||
} | ||
export default function localeTerritory(info) { | ||
@@ -19,13 +46,12 @@ if (info.territory) { | ||
var likelySubtags = cldr.supplemental.likelySubtags; | ||
var name = info.name; | ||
var identity = info.identity; | ||
var territory; | ||
if (info.identity && info.identity.territory) { | ||
territory = info.identity.territory; | ||
} else if (likelySubtags && likelySubtags[name]) { | ||
territory = territoryFromName(likelySubtags[name]); | ||
if (identity && identity.territory) { | ||
territory = identity.territory; | ||
} else { | ||
territory = territoryFromName(name); | ||
territory = territoryFromName(name, identity); | ||
} | ||
info.territory = territory; | ||
@@ -32,0 +58,0 @@ |
import { DateFormatNameOptions } from './cldr'; | ||
/** | ||
* Settings for the formatDate and parseDate functions. | ||
* Settings for the `formatDate` and `parseDate` functions. | ||
*/ | ||
export interface DateFormatOptions { | ||
/** | ||
* Defines the skeleton format used to get the pattern from the locale calendar [`availableFormats`](http://www.unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems). | ||
* Defines the skeleton format that is used to get the pattern from the | ||
* [`availableFormats`](http://www.unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems) of the locale calendar. | ||
*/ | ||
@@ -13,3 +14,3 @@ skeleton?: string; | ||
/** | ||
* Defines the exact pattern to be used to format the date. | ||
* Defines the exact pattern that will be used to format the date. | ||
*/ | ||
@@ -34,3 +35,3 @@ pattern?: string; | ||
/** | ||
* Specifies how should the date era be formatted. | ||
* Specifies how the date era should be formatted. | ||
*/ | ||
@@ -65,3 +66,3 @@ era?: 'narrow' | 'short' | 'long'; | ||
/** | ||
* Specifies if a 12-hour time set should be used for the formatting. | ||
* Specifies whether a 12-hour time-set should be used for the formatting. | ||
*/ | ||
@@ -81,3 +82,3 @@ hour12?: boolean; | ||
/** | ||
* Specifies how the timezone should be formatted. | ||
* Specifies how the time-zone should be formatted. | ||
*/ | ||
@@ -90,6 +91,6 @@ timeZoneName?: 'short' | 'long'; | ||
* | ||
* @param value Defines the date to be formatted. | ||
* @param format Defines a string representing a predefined or custom date format, or a configuration object. | ||
* @param locale The optional locale id. If not specified, the `"en"` locale id is used. | ||
* @returns The formatted date. | ||
* @param value - Defines the date that will be formatted. | ||
* @param format - Defines a string that represents a predefined or custom date format, or a configuration object. | ||
* @param locale - The optional locale `id`. If not specified, the `id` of the `"en"` locale is used. | ||
* @returns - The formatted date. | ||
*/ | ||
@@ -101,6 +102,6 @@ export function formatDate(value: Date, format: string|DateFormatOptions, locale?: string): string; | ||
* | ||
* @param value Defines the string to be parsed. | ||
* @param format Defines a string representing a predefined or custom date format, a configuration object, or an array of formats that should be used to parse the value. | ||
* @param locale The optional locale id. If not specified, the `"en"` locale id is used. | ||
* @returns The parsed date. | ||
* @param value - Defines the string that will be parsed. | ||
* @param format - Defines a string that represents a predefined or custom date format, a configuration object, or an array of formats that should be used to parse the value. | ||
* @param locale - The optional locale `id`. If not specified, the `id` of the `"en"` locale is used. | ||
* @returns - The parsed date. | ||
*/ | ||
@@ -130,8 +131,8 @@ export function parseDate(value: string, format?: string | DateFormatOptions | string[] | DateFormatOptions[], locale?: string): Date; | ||
/** | ||
* Splits the date format into objects containing information about each part of the pattern. | ||
* Splits the date format into objects that contain information about each part of the pattern. | ||
* | ||
* @param format The format string or options. | ||
* @param locale The optional locale id. If not specified, the `"en"` locale id is used. | ||
* @returns The date format parts. | ||
* @param format - The format string or options. | ||
* @param locale - The optional locale `id`. If not specified, the `id` of the `"en"` locale is used. | ||
* @returns - The date format parts. | ||
*/ | ||
export function splitDateFormat(format: string|DateFormatOptions, locale?: string): DateFormatPart[]; |
@@ -13,5 +13,6 @@ //The error is represented by unique name and corresponding message | ||
"NoFirstDay": "Cannot determine locale first day of week. Please load the supplemental weekData. The default culture includes only the 'en-US' first day info.", | ||
"NoValidCurrency": "Cannot determine a default currency for the {0} locale. Please specify explicitly the currency with the format options." | ||
"NoValidCurrency": "Cannot determine a default currency for the {0} locale. Please specify explicitly the currency with the format options.", | ||
"NoDateFieldNames": "Cannot determine the locale date field names. Please load the locale dateFields data." | ||
}; | ||
//# sourceMappingURL=error-details.js.map |
/** | ||
* Formats dates and numbers based on the specified format and locale. | ||
* | ||
* @param value The value to be formatted. | ||
* @param format A string representing a predefined or custom date or number format, or a configuration object. | ||
* @param locale The optional locale id. If not specified, the `"en"` locale id is used. | ||
* @returns The formatted value. | ||
* @param value - The value that will be formatted. | ||
* @param format - A string that represents a predefined or custom date or number format, or a configuration object. | ||
* @param locale - The optional locale `id`. If not specified, the `id` of the `"en"` locale is used. | ||
* @returns - The formatted value. | ||
*/ | ||
@@ -14,7 +14,7 @@ export function toString(value: string | Date | number, format: string | any, locale?: string): string; | ||
* | ||
* @param format The format string. | ||
* @param values The values that should be replaced in the format string. | ||
* @param locale The optional locale id. If not specified, the `"en"` locale id is used. | ||
* @returns The format string with replaced formatted values. | ||
* @param format - The format string. | ||
* @param values - The values that should be replaced in the format string. | ||
* @param locale - The optional locale `id`. If not specified, the `id` of the `"en"` locale is used. | ||
* @returns - The format string with replaced formatted values. | ||
*/ | ||
export function format(format: string, values: any[], locale?: string): string; |
/** | ||
* Settings for the formatNumber and parseNumber functions. | ||
* Settings for the `formatNumber` and `parseNumber` functions. | ||
*/ | ||
@@ -9,6 +9,7 @@ export interface NumberFormatOptions { | ||
*/ | ||
style?: 'decimal' | 'currency' | 'precent' | 'scientific'; | ||
style?: 'decimal' | 'currency' | 'percent' | 'scientific'; | ||
/** | ||
* Defines the currency code of the currency used in the formatting. If not specified, the default currency for the locale is used. | ||
* Defines the currency code of the currency that is used in the formatting. | ||
* If not specified, the default currency for the locale is used. | ||
*/ | ||
@@ -28,3 +29,3 @@ currency?: string; | ||
/** | ||
* Defines the minimum number of integer digits to be used in the formatting. | ||
* Defines the minimum number of integer digits that will be used in the formatting. | ||
*/ | ||
@@ -34,5 +35,6 @@ minimumIntegerDigits?: number; | ||
/** | ||
* Defines the minimum number of fraction digits to use. | ||
* The default value for the decimal and percent formatting is 0 (zero). | ||
* The default value of the currency formatting is the number of digits for the currency from the supplemental `currencyData` or 2 if no info is provided for the currency. | ||
* Defines the minimum number of fraction digits that will be used. | ||
* The default value of the decimal and percent formatting is `0` (zero). | ||
* The default value of the currency formatting is the number of digits for the currency from the supplemental `currencyData`. | ||
* If no information about the currency is provided, the default value of the currency formatting is `2`. | ||
*/ | ||
@@ -42,6 +44,7 @@ minimumFractionDigits?: number; | ||
/** | ||
* Defines the maximum number of fraction digits to be used. | ||
* The default value of the decimal formatting is the greater one between `minimumFractionDigits` and 3. | ||
* The default value of the currency formatting is the greater one between `minimumFractionDigits` and the number of digits for the currency from the supplemental `currencyData` or 2 if no info is provided for the currency. | ||
* The default value of the percent formatting is the greater one between `minimumFractionDigits` and 0 (zero). | ||
* Defines the maximum number of fraction digits that will be used. | ||
* The default value of the decimal formatting is the greater one between `minimumFractionDigits` and `3`. | ||
* The default value of the currency formatting is the greater one between `minimumFractionDigits` and the number of digits for the currency from the supplemental `currencyData`. | ||
* If no information about the currency is provided, the default value of the currency formatting is the greater one between `minimumFractionDigits` and `2`. | ||
* The default value of the percent formatting is the greater one between `minimumFractionDigits` and `0` (zero). | ||
*/ | ||
@@ -54,6 +57,6 @@ maximumFractionDigits?: number; | ||
* | ||
* @param value The string to be parsed. | ||
* @param locale The locale id defining the locale which information should be used to parse the string. | ||
* @param format The format used to parse the string. Usefull if parsing non-default currencies. | ||
* @returns The parsed number. | ||
* @param value - The string that will be parsed. | ||
* @param locale - The locale `id` that defines the locale whose information should be used to parse the string. | ||
* @param format - The format that is used to parse the string. Useful when non-default currencies are parsed. | ||
* @returns - The parsed number. | ||
*/ | ||
@@ -65,7 +68,7 @@ export function parseNumber(value: string, locale?: string, format?: string|NumberFormatOptions): number; | ||
* | ||
* @param value The number to be formatted. | ||
* @param format The format to be applied. | ||
* @param locale The locale id defining the locale which information should be used for the formatting. | ||
* @returns The formatted number. | ||
* @param value - The number that will be formatted. | ||
* @param format - The format that will be applied. | ||
* @param locale - The locale `id` that defines the locale whose information should be used for the formatting. | ||
* @returns - The formatted number. | ||
*/ | ||
export function formatNumber(value: number, format: string|NumberFormatOptions, locale?: string): string; | ||
export function formatNumber(value: number, format: string|NumberFormatOptions, locale?: string): string; |
@@ -14,9 +14,11 @@ import { localeInfo, localeCurrency, currencyDisplays } from '../cldr'; | ||
if (currency) { | ||
var displays = currencyDisplays(info, currency); | ||
for (var idx = 0; idx < displays.length; idx++) { | ||
var display = displays[idx]; | ||
if (number.includes(display)) { | ||
number = number.replace(display, ""); | ||
isCurrency = true; | ||
break; | ||
var displays = currencyDisplays(info, currency, isCurrency); | ||
if (displays) { | ||
for (var idx = 0; idx < displays.length; idx++) { | ||
var display = displays[idx]; | ||
if (number.includes(display)) { | ||
number = number.replace(display, ""); | ||
isCurrency = true; | ||
break; | ||
} | ||
} | ||
@@ -23,0 +25,0 @@ } |
{ | ||
"name": "@telerik/kendo-intl", | ||
"description": "A package exporting functions for date and number parsing and formatting", | ||
"version": "1.0.0", | ||
"version": "1.1.0-dev.201705251330", | ||
"repository": { | ||
@@ -16,4 +16,5 @@ "type": "git", | ||
"test": "gulp test", | ||
"locale-tests": "gulp test --tests=\"locale-tests/generated-locales.js\"", | ||
"lint": "gulp lint", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
"semantic-release": "semantic-release pre && semantic-prerelease publish && semantic-release post" | ||
}, | ||
@@ -30,2 +31,3 @@ "keywords": [ | ||
"@telerik/kendo-package-tasks": "^1.2.0", | ||
"@telerik/semantic-prerelease": "^0.1.9", | ||
"cz-conventional-changelog": "^1.1.5", | ||
@@ -46,3 +48,17 @@ "ghooks": "^1.0.3", | ||
} | ||
}, | ||
"release": { | ||
"debug": false, | ||
"branchTags": { | ||
"develop": "dev" | ||
}, | ||
"fallbackTags": { | ||
"dev": "latest" | ||
}, | ||
"analyzeCommits": "@telerik/semantic-prerelease/analyzeCommits", | ||
"generateNotes": "@telerik/semantic-prerelease/generateNotes", | ||
"getLastRelease": "@telerik/semantic-prerelease/getLastRelease", | ||
"verifyConditions": "@telerik/semantic-prerelease/verifyConditions", | ||
"verifyRelease": "@telerik/semantic-prerelease/verifyRelease" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
89
5914
587718
9
2
6