"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("../index");
var Translate = /** @class */ (function () {
    function Translate() {
        var _this = this;
        this.t = {};
        this.i18n = index_1.i18n;
        this.defaultLanguage = 'en-US';
        this.supportedLanguages = [
            'en-US',
            'nl-NL'
        ];
        this.translations = {};
        Object.keys(index_1.i18n).forEach(function (k) {
            _this.supportedLanguages.push(k);
        });
        this.translations = index_1.Util.copy(index_1.i18n);
        this.translations['nl-NL'] = index_1.Util.copy(this.translations['nl']);
        this.translations['en-US'] = index_1.Util.copy(this.translations['en']);
        this.translations['en-BE'] = index_1.Util.copy(this.translations['en']);
        this.translations['en_BE'] = index_1.Util.copy(this.translations['en']);
        this.use(this.defaultLanguage);
    }
    Translate.prototype.use = function (language) {
        this.language = language;
        if (!this.translations[language]) {
            // todo: http fetch json
        }
        this.t = this.translations[language];
    };
    Translate.prototype.get = function (string) {
        return this.instant(string);
    };
    Translate.prototype.instant = function (string) {
        var translation;
        var t = this.t;
        Object.keys(t).forEach(function (k) {
            if (k === string) {
                translation = t[k];
            }
        });
        if (translation) {
            return translation;
        }
        else {
            return string;
        }
    };
    return Translate;
}());
exports.Translate = Translate;
//# sourceMappingURL=translate.js.map