import { ComponentInterface } from "../stencil-public-runtime"; import { DuetLanguage, DuetLanguageWithUs, DuetLocale } from "../common-types"; /** * These utilities are helpfull in getting languages and returning default strings accordingly * * Everything has been coded to rely on a reload on language change and is hooked up to th * * @example * changing language on a page should result in reload and a new lang attribute * * -> user changes language to en * -> browser should reload with: * */ export interface DuetLangObject { fi: any; en: any; us?: any; sv: any; } export type DuetMonetaryDefaults = "$" | "€" | "£"; export declare const getCurrentLanguage: () => string; export declare const isOfTypeLanguage: (keyInput: string) => keyInput is DuetLanguage; /** * Returns the current language as a string representation (taken from html lang attribute) * If language is not fi|sv|en it will default to "fi" * @param {string} lang=fi - "fi" | "sv" | "en" * @default {string} "fi" */ export declare const getLanguage: (languageString?: string) => DuetLanguage; /** * Returns the current language and locale * If language is not fi|sv|en it will default to "fi" * special case where lang can be ALSO be "us" in addition to other types - if user decides to override local language * @param {string} lang="fi" - "fi" | "sv" | "en" | "us" * @default {object} {locale: "fi-FI", money: "€"} */ export declare const getLocale: (lang: DuetLanguageWithUs) => { money: DuetMonetaryDefaults; locale: DuetLocale; }; /** * Takes any json object that is passed and/or htmlencoded and converts it to proper json */ export declare const sanitizeString: (string: any) => Record | string; /** * Returns the current string / object from a given translation object * If language is not fi|sv|en it will default to "fi" * special case where lang can be ALSO be "us" in addition to other types - if user decides to override local language * @param {object} langObject - {fi: "finnish", sv: "swedish", en: "english"} | string will get JSON.parsed * @param {boolean} languageOverride = false - in case you want to override the actual language set in html tag * @default {object} {locale: "fi-FI", money: "€"} * @returns {(string|Object)} given example contains {fi:"something"} and language===fi this will return "something" */ export declare const getLocaleString: (langObject: DuetLangObject | string, languageOverride?: string) => any; export declare const formatNumber: (num: number, decimals?: number, lang?: string) => string; export declare const connectLanguageChangeObserver: (component: ComponentInterface, targets?: { prop: string; defaults: string; }[] | { prop: string; defaults: string; }) => void; export declare const disconnectLanguageChangeObserver: (component: ComponentInterface) => void;