(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
    typeof define === 'function' && define.amd ? define('@sd-angular/core/translate', ['exports', '@angular/core'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core.translate = {}), global.ng.core));
}(this, (function (exports, i0) { 'use strict';

    var TRANSLATE_CONFIG = new i0.InjectionToken('translate.configuration');

    var SdTranslateService = /** @class */ (function () {
        function SdTranslateService(configuration) {
            var _this = this;
            var _a, _b, _c;
            this.configuration = configuration;
            this.undeclaredLanguage = {};
            this.dictionary = {};
            this.translate = function (keyWord, language) {
                var _a;
                if (!keyWord) {
                    return '';
                }
                keyWord = keyWord.toString().trim();
                language = language || _this.currentLanguage;
                if (!keyWord || !language) {
                    return keyWord;
                }
                if (!((_a = _this.dictionary[language]) === null || _a === void 0 ? void 0 : _a[keyWord])) {
                    if (!_this.undeclaredLanguage[keyWord]) {
                        _this.undeclaredLanguage[keyWord] = true;
                    }
                    return keyWord;
                }
                return _this.dictionary[language][keyWord];
            };
            this.setDictionary = function (language, keyWord, value) {
                var _d;
                if (!_this.dictionary[language]) {
                    _this.dictionary[language] = (_d = {},
                        _d[keyWord] = value,
                        _d);
                }
                else {
                    _this.dictionary[language][keyWord] = value;
                }
            };
            this.setDictionaries = function (language, dictionary) {
                _this.dictionary[language] = dictionary;
            };
            this.setDefaultLanguage = function (language) {
                _this.currentLanguage = language;
            };
            this.getUndeclaredLanguage = function () { return _this.undeclaredLanguage; };
            this.currentLanguage = ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.defaultLanguage) || 'EN';
            this.dictionary = ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.initializeDictionary) === null || _c === void 0 ? void 0 : _c.call(_b)) || {};
        }
        return SdTranslateService;
    }());
    SdTranslateService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SdTranslateService_Factory() { return new SdTranslateService(i0.ɵɵinject(TRANSLATE_CONFIG, 8)); }, token: SdTranslateService, providedIn: "root" });
    SdTranslateService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    SdTranslateService.ctorParameters = function () { return [
        { type: undefined, decorators: [{ type: i0.Inject, args: [TRANSLATE_CONFIG,] }, { type: i0.Optional }] }
    ]; };

    var SdTranslatePipe = /** @class */ (function () {
        function SdTranslatePipe(translateService) {
            this.translateService = translateService;
        }
        SdTranslatePipe.prototype.transform = function (value) {
            return this.translateService.translate(value);
        };
        return SdTranslatePipe;
    }());
    SdTranslatePipe.decorators = [
        { type: i0.Pipe, args: [{
                    name: 'sdTranslate'
                },] }
    ];
    SdTranslatePipe.ctorParameters = function () { return [
        { type: SdTranslateService }
    ]; };

    var SdTranslateModule = /** @class */ (function () {
        function SdTranslateModule() {
        }
        return SdTranslateModule;
    }());
    SdTranslateModule.decorators = [
        { type: i0.NgModule, args: [{
                    imports: [],
                    declarations: [
                        SdTranslatePipe
                    ],
                    exports: [
                        SdTranslatePipe
                    ],
                    providers: []
                },] }
    ];

    /*
     * Public API Surface of superdev-angular-core
     */

    /**
     * Generated bundle index. Do not edit.
     */

    exports.SdTranslateModule = SdTranslateModule;
    exports.SdTranslatePipe = SdTranslatePipe;
    exports.SdTranslateService = SdTranslateService;
    exports.TRANSLATE_CONFIG = TRANSLATE_CONFIG;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=sd-angular-core-translate.umd.js.map
