UNPKG

@progress/kendo-vue-intl

Version:
247 lines (230 loc) 8.64 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { ComponentOptionsMixin } from 'vue'; import { DateFieldNameOptions } from '@progress/kendo-intl'; import { DateFormatNameOptions } from '@progress/kendo-intl'; import { DateFormatOptions } from '@progress/kendo-intl'; import { DateFormatPart } from '@progress/kendo-intl'; import { DefineComponent } from 'vue'; import { ExtractPropTypes } from 'vue'; import { load } from '@progress/kendo-intl'; import { NumberFormatOptions } from '@progress/kendo-intl'; import { PropType } from 'vue'; import { PublicProps } from 'vue'; export { DateFieldNameOptions } export { DateFormatNameOptions } export { DateFormatOptions } export { DateFormatPart } /** * @hidden */ export declare const IntlProvider: DefineComponent<ExtractPropTypes< { locale: PropType<string>; }>, void, any, {}, { /** * Returns an internationalization service. * The method is suitable for overriding when you * implement custom internationalization behavior. */ getIntlService(): IntlService; /** * @hidden */ getChildContext(): { kendoIntlService: IntlService; }; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< { locale: PropType<string>; }>> & Readonly<{}>, {}, {}, {}, {}, string, () => { kendoIntlService: any; }, true, {}, any>; /** * Represents the props of the KendoVue IntlProvider component. */ export declare interface IntlProviderProps { /** * The locale that will be used by the child components. */ locale: string; } /** * A service which provides internationalization methods * and is bound to a specific locale. */ export declare class IntlService { private locale; /** * 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; } export { load } /** * Provides mechanism to load language-specific messages for the KendoVue components. * * @param messages - An iterable object which contains key-value pairs. * @param languages - The language to which the messages are associated. */ export declare function loadMessages(messages: any, language: string): void; /** * @hidden */ export declare const LocalizationProvider: DefineComponent<ExtractPropTypes< { language: StringConstructor; }>, void, any, {}, { /** * Returns a localization service. * The method is suitable for overriding when you * implement custom localization behavior. */ getLocalizationService(): LocalizationService; /** * @hidden */ getChildContext(): { kendoLocalizationService: LocalizationService; }; }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< { language: StringConstructor; }>> & Readonly<{}>, {}, {}, {}, {}, string, () => { kendoLocalizationService: any; }, true, {}, any>; /** * Represents the props of the KendoVue LocalizationProvider component. */ export declare interface LocalizationProviderProps { /** * The language that will be used by the child components. */ language: string; } /** * A service which provides localization methods. */ export declare class LocalizationService { private language?; constructor(language?: string); /** * Provides a string based on a key for the current language. * When no string for the current language is available under this key, * the `defaultValue` is returned. * * @param key - The key which identifies the string for the current language. * @param defaultValue - The default value which will be returned when no string * for the current language is available under the key. * @return - The string for the current language. */ toLanguageString(key: string, defaultValue: string): string; } export { NumberFormatOptions } /** * Provides an internationalization service. * When the passed component is a direct or indirect child of * `IntlProvider`, the returned service uses the locale of the provider. * Otherwise, uses `en` as a default locale. * To handle locale changes, call the method on each `render`. * * @param componentClass - The Vue component class that will use the internationalization service. */ export declare function provideIntlService(component: any): IntlService; /** * Provides a localization service. * When the passed component is a direct or indirect child of * `LocalizationProvider`, the returned service uses the language of the provider. * To handle locale changes, call the method on each `render`. * * @param componentClass - The Vue component class that will use the internationalization service. */ export declare function provideLocalizationService(component: any): LocalizationService; export { }