@softkit/i18n
Version:
This library is a simple wrapper based on [nestjs-i18n](https://nestjs-i18n.com/)
28 lines • 868 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.I18nJsonLoader = void 0;
const i18n_error_1 = require("../i18n.error");
const i18n_abstract_file_loader_1 = require("./i18n.abstract-file.loader");
class I18nJsonLoader extends i18n_abstract_file_loader_1.I18nAbstractFileLoader {
constructor(options) {
super(options);
}
getDefaultOptions() {
return {
filePattern: '*.json',
};
}
formatData(data) {
try {
return JSON.parse(data);
}
catch (error) {
if (error instanceof SyntaxError) {
throw new i18n_error_1.I18nError('Invalid JSON file. Please check your JSON syntax.');
}
throw error;
}
}
}
exports.I18nJsonLoader = I18nJsonLoader;
//# sourceMappingURL=i18n.json.loader.js.map