UNPKG

@softkit/i18n

Version:

This library is a simple wrapper based on [nestjs-i18n](https://nestjs-i18n.com/)

40 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CatService = void 0; const tslib_1 = require("tslib"); const common_1 = require("@nestjs/common"); const i18n_context_1 = require("../../../i18n.context"); let CatService = class CatService { constructor() { this.cats = [ { id: 1, name: 'foo', age: 4, }, { id: 2, name: 'bar', age: 6, }, ]; } findAll() { return this.cats; } findById(id) { const cat = this.cats.find((cat) => cat.id === id); if (!cat) { throw new Error('Cat not found'); } cat.description = i18n_context_1.I18nContext.current()?.translate('test.cat'); return cat; } }; exports.CatService = CatService; exports.CatService = CatService = tslib_1.__decorate([ (0, common_1.Injectable)(), tslib_1.__metadata("design:paramtypes", []) ], CatService); //# sourceMappingURL=cat.service.js.map