const convertLocaleToLanguage = (locale) => {
    const [language] = locale.split("-");
    return language;
};
export const createLocalizationManager = ({ language: initialLanguage, currency: initialCurrency = "EUR", locale: initialLocale, } = {}, notificationCenter) => {
    let language = initialLanguage;
    let currency = initialCurrency;
    let locale = initialLocale;
    const changeLanguage = (newLanguage) => {
        let newLocale = locale;
        if (newLanguage.indexOf("-") > -1 || initialLocale === undefined) {
            newLocale = newLanguage;
        }
        locale = newLocale;
        language = convertLocaleToLanguage(locale);
    };
    const changeLocale = (newLocale) => {
        if (initialLanguage === undefined) {
            language = convertLocaleToLanguage(newLocale);
        }
        locale = newLocale;
    };
    if (initialLocale === undefined && initialLanguage === undefined) {
        changeLanguage("de");
    }
    else if (initialLanguage !== undefined) {
        changeLanguage(initialLanguage);
    }
    else if (initialLocale !== undefined) {
        changeLocale(initialLocale);
    }
    const getLanguage = () => language;
    // const setLanguage = (newLanguage: string) => {
    // 	changeLanguage(newLanguage);
    // 	notificationCenter.send("LocalizationManager", "LocalizationChanged", {
    // 		language,
    // 		locale,
    // 	});
    // };
    const getLocale = () => locale;
    // const setLocale = (newLocale: string) => {
    // 	changeLocale(newLocale);
    // 	notificationCenter.send("LocalizationManager", "LocalizationChanged", {
    // 		language,
    // 		locale,
    // 	});
    // };
    const getCurrency = () => currency;
    // const setCurrency = (newCurrency: string) => {
    // 	currency = newCurrency;
    // };
    return {
        getLanguage,
        // setLanguage,
        getCurrency,
        // setCurrency,
        getLocale,
    };
};
