UNPKG

@softkit/i18n

Version:

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

27 lines 955 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.I18nYamlLoader = void 0; const tslib_1 = require("tslib"); const i18n_error_1 = require("../i18n.error"); const i18n_abstract_file_loader_1 = require("./i18n.abstract-file.loader"); const js_yaml_1 = tslib_1.__importDefault(require("js-yaml")); class I18nYamlLoader extends i18n_abstract_file_loader_1.I18nAbstractFileLoader { getDefaultOptions() { return { filePattern: '*.yml', }; } formatData(data) { try { return js_yaml_1.default.load(data, { json: true }); } catch (error) { if (error instanceof js_yaml_1.default.YAMLException) { throw new i18n_error_1.I18nError('Invalid YAML file. Please check your YAML syntax.'); } throw error; } } } exports.I18nYamlLoader = I18nYamlLoader; //# sourceMappingURL=i18n.yaml.loader.js.map