"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var convertLocaleToLanguage = function (locale) {
    var _a = tslib_1.__read(locale.split("-"), 1), language = _a[0];
    return language;
};
exports.createLocalizationManager = function (_a, notificationCenter) {
    var _b = _a === void 0 ? {} : _a, initialLanguage = _b.language, _c = _b.currency, initialCurrency = _c === void 0 ? "EUR" : _c, initialLocale = _b.locale;
    var language = initialLanguage;
    var currency = initialCurrency;
    var locale = initialLocale;
    var changeLanguage = function (newLanguage) {
        var newLocale = locale;
        if (newLanguage.indexOf("-") > -1 || initialLocale === undefined) {
            newLocale = newLanguage;
        }
        locale = newLocale;
        language = convertLocaleToLanguage(locale);
    };
    var changeLocale = function (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);
    }
    var getLanguage = function () { return language; };
    // const setLanguage = (newLanguage: string) => {
    // 	changeLanguage(newLanguage);
    // 	notificationCenter.send("LocalizationManager", "LocalizationChanged", {
    // 		language,
    // 		locale,
    // 	});
    // };
    var getLocale = function () { return locale; };
    // const setLocale = (newLocale: string) => {
    // 	changeLocale(newLocale);
    // 	notificationCenter.send("LocalizationManager", "LocalizationChanged", {
    // 		language,
    // 		locale,
    // 	});
    // };
    var getCurrency = function () { return currency; };
    // const setCurrency = (newCurrency: string) => {
    // 	currency = newCurrency;
    // };
    return {
        getLanguage: getLanguage,
        // setLanguage,
        getCurrency: getCurrency,
        // setCurrency,
        getLocale: getLocale,
    };
};
