UNPKG

@odoo/o-spreadsheet

Version:
61 lines (60 loc) 3.23 kB
import { ConditionalFormatRule } from "../types/conditional_formatting"; import { DataValidationRule } from "../types/data_validation"; import { Locale } from "../types/locale"; export declare function isValidLocale(locale: any): locale is Locale; /** * Change a content string from the given locale to its canonical form (en_US locale). Don't convert date string. * * @example * canonicalizeNumberContent("=SUM(1,5; 02/12/2012)", FR_LOCALE) // "=SUM(1.5, 02/12/2012)" * canonicalizeNumberContent("125,9", FR_LOCALE) // "125.9" * canonicalizeNumberContent("02/12/2012", FR_LOCALE) // "02/12/2012" */ export declare function canonicalizeNumberContent(content: string, locale: Locale): string; /** * Change a content string from the given locale to its canonical form (en_US locale). Also convert date string. * This is destructive and won't preserve the original format. * * @example * canonicalizeContent("=SUM(1,5; 5)", FR_LOCALE) // "=SUM(1.5, 5)" * canonicalizeContent("125,9", FR_LOCALE) // "125.9" * canonicalizeContent("02/12/2012", FR_LOCALE) // "12/02/2012" * canonicalizeContent("02-12-2012", FR_LOCALE) // "12/02/2012" */ export declare function canonicalizeContent(content: string, locale: Locale): string; /** * Change a content string from its canonical form (en_US locale) to the given locale. Don't convert date string. * This is destructive and won't preserve the original format. * * @example * localizeNumberContent("=SUM(1.5, 5)", FR_LOCALE) // "=SUM(1,5; 5)" * localizeNumberContent("125.9", FR_LOCALE) // "125,9" * localizeNumberContent("02/12/2012", FR_LOCALE) // "12/02/2012" * localizeNumberContent("02-12-2012", FR_LOCALE) // "12/02/2012" */ export declare function localizeNumberContent(content: string, locale: Locale): string; /** * Change a content string from its canonical form (en_US locale) to the given locale. Also convert date string. * * @example * localizeContent("=SUM(1.5, 5)", FR_LOCALE) // "=SUM(1,5; 5)" * localizeContent("125.9", FR_LOCALE) // "125,9" * localizeContent("12/02/2012", FR_LOCALE) // "02/12/2012" */ export declare function localizeContent(content: string, locale: Locale): string; /** Change a number string to its canonical form (en_US locale) */ export declare function canonicalizeNumberValue(content: string, locale: Locale): string; /** Change a formula from the canonical form to the given locale */ export declare function localizeFormula(formula: string, locale: Locale): string; /** * Change a literal string from the given locale to its canonical form (en_US locale). Don't convert date string. * * @example * canonicalizeNumberLiteral("125,9", FR_LOCALE) // "125.9" * canonicalizeNumberLiteral("02/12/2012", FR_LOCALE) // "02/12/2012" */ export declare function canonicalizeNumberLiteral(content: string, locale: Locale): string; export declare function canonicalizeCFRule(cf: ConditionalFormatRule, locale: Locale): ConditionalFormatRule; export declare function localizeCFRule(cf: ConditionalFormatRule, locale: Locale): ConditionalFormatRule; export declare function localizeDataValidationRule(rule: DataValidationRule, locale: Locale): DataValidationRule; export declare function getDateTimeFormat(locale: Locale): string;