import { InjectionToken, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject, Optional, Pipe, NgModule } from '@angular/core';

const TRANSLATE_CONFIG = new InjectionToken('translate.configuration');

class SdTranslateService {
    constructor(configuration) {
        var _a, _b, _c;
        this.configuration = configuration;
        this.undeclaredLanguage = {};
        this.dictionary = {};
        this.translate = (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 = (language, keyWord, value) => {
            if (!this.dictionary[language]) {
                this.dictionary[language] = {
                    [keyWord]: value
                };
            }
            else {
                this.dictionary[language][keyWord] = value;
            }
        };
        this.setDictionaries = (language, dictionary) => {
            this.dictionary[language] = dictionary;
        };
        this.setDefaultLanguage = (language) => {
            this.currentLanguage = language;
        };
        this.getUndeclaredLanguage = () => 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)) || {};
    }
}
SdTranslateService.ɵprov = ɵɵdefineInjectable({ factory: function SdTranslateService_Factory() { return new SdTranslateService(ɵɵinject(TRANSLATE_CONFIG, 8)); }, token: SdTranslateService, providedIn: "root" });
SdTranslateService.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
SdTranslateService.ctorParameters = () => [
    { type: undefined, decorators: [{ type: Inject, args: [TRANSLATE_CONFIG,] }, { type: Optional }] }
];

class SdTranslatePipe {
    constructor(translateService) {
        this.translateService = translateService;
    }
    transform(value) {
        return this.translateService.translate(value);
    }
}
SdTranslatePipe.decorators = [
    { type: Pipe, args: [{
                name: 'sdTranslate'
            },] }
];
SdTranslatePipe.ctorParameters = () => [
    { type: SdTranslateService }
];

class SdTranslateModule {
}
SdTranslateModule.decorators = [
    { type: NgModule, args: [{
                imports: [],
                declarations: [
                    SdTranslatePipe
                ],
                exports: [
                    SdTranslatePipe
                ],
                providers: []
            },] }
];

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

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

export { SdTranslateModule, SdTranslatePipe, SdTranslateService, TRANSLATE_CONFIG };
//# sourceMappingURL=sd-angular-core-translate.js.map
