import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';
import { ModulVue } from '../../utils/vue/vue';
import { I18N_NAME } from '../component-names';
import WithRender from './i18n.html';
var MI18n = /** @class */ (function (_super) {
    __extends(MI18n, _super);
    function MI18n() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MI18n.prototype.created = function () {
        if (!this.$i18n) {
            throw new Error('<' + I18N_NAME + '>: this.$i18n is undefined, you must register the i18n plugin.');
        }
    };
    Object.defineProperty(MI18n.prototype, "text", {
        get: function () {
            var result = '';
            if (this.k) {
                result = this.$i18n.translate(this.k, this.params, this.nb, this.modifier, this.htmlEncode, this.formatMode ? this.formatMode : undefined);
            }
            return result;
        },
        enumerable: false,
        configurable: true
    });
    __decorate([
        Prop()
    ], MI18n.prototype, "k", void 0);
    __decorate([
        Prop({ default: function () { return []; } })
    ], MI18n.prototype, "params", void 0);
    __decorate([
        Prop()
    ], MI18n.prototype, "nb", void 0);
    __decorate([
        Prop()
    ], MI18n.prototype, "modifier", void 0);
    __decorate([
        Prop({ default: true })
    ], MI18n.prototype, "htmlEncode", void 0);
    __decorate([
        Prop()
    ], MI18n.prototype, "formatMode", void 0);
    MI18n = __decorate([
        WithRender,
        Component
    ], MI18n);
    return MI18n;
}(ModulVue));
export { MI18n };
var I18nPlugin = {
    install: function (v, options) {
        v.prototype.$log.debug(I18N_NAME, 'plugin.install');
        v.component(I18N_NAME, MI18n);
    }
};
export default I18nPlugin;
//# sourceMappingURL=i18n.js.map