import { DataType } from '../types/data_type'; /** * Contains internatialization functionality. */ export declare namespace i18n { export interface LocaleSettings { shortDateFormat?: string; editDateFormat?: string; longDateFormat?: string; shortTimeFormat?: string; editTimeFormat?: string; longTimeFormat?: string; shortMonthNames?: string[]; longMonthNames?: string[]; shortWeekDayNames?: string[]; longWeekDayNames?: string[]; decimalSeparator?: string; currency?: string; } export interface TextResources { [propName: string]: string | TextResources; } export interface LocaleInfo { localeId?: string; englishName?: string; displayName?: string; texts?: TextResources; settings?: LocaleSettings; } export interface LocaleInfoItem { locale: string; englishName?: string; displayName?: string; } type LocaleMapper = (info: LocaleInfo) => void; export function addMapper(mapper: LocaleMapper): void; /** * Gets added locales with their names. * @returns The locales. */ export function getLocales(): LocaleInfoItem[]; /** * Gets the current locale ID. * @returns The locale. */ export function getCurrentLocale(): string; /** * Sets the curent locale. * @deprecated Use setCurrentLocale instead * @param l The locale. */ export function setLocale(l: string): void; /** * Sets the curent locale. * @param localeId The locale. */ export function setCurrentLocale(localeId: string): void; /** * Returns localized text by the key defined in parameter. * Here we get the text of the resource string assigned to CmdClickToAddCondition key: * ``` const text = i18n.getText('CmdClickToAddCondition') ``` * @param args The keys of the resource string. * @returns Text of the resource defined by key or null if the key is not found * */ export function getText(...args: string[]): string; export function getLocaleSettings(): LocaleSettings; export function getOneLocaleSetting(key: string): any; export function getShortMonthName(monthNum: number): string; export function getLongMonthName(monthNum: number): string; export function getShortWeekDayName(dayNum: number): string; export function getLongWeekDayName(dayNum: number): string; /** * Updates the locale settings (date/time formats, separators, etc) for the specified locale. * @param settingsToUpdate a LocaleSettings object */ export function updateLocaleSettings(settingsToUpdate: LocaleSettings): void; /** * Updates the texts for the current locale * @param texts A plain JS object that contains textual resources */ export function updateLocaleTexts(texts: TextResources): void; /** * Updates the default texts for the current locale and all other locales available now * This function does rewrite the texts in the locales, it just adds new textual resources if they didn't exists previously * @param texts A plain JS object that contains textual resources */ export function updateDefaultTexts(texts: TextResources): void; /** * Updates the information for the specified locale. * @param localeId The locale ID (like 'en', 'de', 'uk', etc). * If the locale does exist yet - it will be added * @param localeInfo a LocaleInfo object that contains the locale settings and textual resources */ export function updateLocaleInfo(localeId: string, localeInfo: LocaleInfo): void; /** * Adds the locale. * @param localeId The locale ID (like 'en', 'de', 'uk', etc). * If the locale does exist yet - it will be created * @param localeInfo - a LocaleInfo object that contains the locale settings and textual resources */ export function addLocale(localeId: string, localeInfo: LocaleInfo): void; export function resetLocales(): void; /** * Returns string representation of the date/time value according to the custom format (second parameter) * The format is compatible with the one used in .NET: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings * @param date * @param format */ export function dateTimeToStr(date: Date, format: string): string; export function dateTimeToStrEx(dateTime: Date, dataType: DataType, format?: string): string; /** * Converts a numeric value to the string taking into the account the decimal separator * @param num - the number to convert * @param format - the format of the number representation (D - decimal, F - float, C - currency) * @param decimalSeparator - the symbol that represents decimal separator. If not specified the function gets the one from the current locale settings. */ export function numberToStr(num: number, format?: string, decimalSeparator?: string): string; export function booleanToStr(bool: boolean, format?: string): string; export {}; }