UNPKG

@progress/kendo-react-intl

Version:

React Internationalization package provides services for parsing and formatting of dates and numbers. KendoReact Internationalization package

110 lines (109 loc) 4.23 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { DateFormatOptions, NumberFormatOptions, DateFieldNameOptions, DateFormatNameOptions, DateFormatPart } from './../coreExports.js'; /** * A service which provides internationalization methods and is bound to a specific locale. */ export declare class IntlService { locale: string; /** * Creates a new instance of the internationalization service. * * @param locale - The locale that will be used by the internationalization methods. */ constructor(locale: string); /** * Formats a string with placeholders such as `Total amount {0:c}`. * * @param format - The format string. * @param values - One or more values to output in the format string placeholders. * @return - The formatted string. */ format(format: string, ...values: any[]): string; /** * Converts a `Date` object to a string based on the specified format. If no format is provided, the default short date format is used. * * @param value - The date which will be formatted. * @param format - The format string or options. * @return - The formatted date. */ formatDate(value: Date, format?: string | DateFormatOptions): string; /** * Converts an object to a string based on the specified format. * * @param value - The value which will be formatted. * @param format - The format to use. * @return - The formatted object. */ toString(value: any, format: string | any): string; /** * Converts a string to a `Number`. * * @param value - The string which will be parsed. * @param format - The format string or options. * @return - The parsed number. */ parseNumber(value: string, format?: string | NumberFormatOptions): number; /** * Converts a string to a `Date` object based on the specified format. * * @param value - The string which will be converted. * @param format - The format strings or options. * @return - The parsed date. */ parseDate(value: string, format?: string | DateFormatOptions | string[] | DateFormatOptions[]): Date; /** * Converts a `Number` to a string based on the specified format. * * @param value - The number which will be formatted. * @param format - The format string or options. * @return - The formatted number. */ formatNumber(value: number, format: string | NumberFormatOptions): string; /** * Returns a localized date field name based on specific `dateFieldName` options. * * @param options - The detailed configuration for the desired date field name. * @returns - The localized date field name from the current locale based on the option. */ dateFieldName(options: DateFieldNameOptions): string; /** * Returns the day names from the current locale based on the option. * * @param options - The detailed configuration for the desired date format. * @return - The day names from the current locale based on the option. */ dateFormatNames(options: DateFormatNameOptions): any; /** * Splits the date format into objects which contain information about each part of the pattern. * * @param format - The format string or options. * @returns - The date format parts. */ splitDateFormat(format: string | DateFormatOptions): DateFormatPart[]; /** * Returns the number symbols from the current locale. * * @return - The number symbols from the current locale. */ numberSymbols(): any; /** * Returns the first day index, starting from Sunday. * * @return - The index of the first day of the week (0 == Sunday). */ firstDay(): number; /** * @hidden */ localeInfo(): any; /** * @hidden */ localeCurrency(): any; }