UNPKG

rucken

Version:

Console tools and scripts for nx and not only that I (EndyKaufman) use to automate the workflow and speed up the development process

28 lines 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.i18nextToPo = i18nextToPo; exports.i18nextToPot = i18nextToPot; exports.i18nextToMo = i18nextToMo; const gettext_parser_1 = require("gettext-parser"); // @ts-expect-error - No type definitions available for gettext-converter const gettext_converter_1 = require("gettext-converter"); function i18nextToPo(locale, body, options = {}) { return i18nextToGettext(locale, body.toString('utf8'), gettext_parser_1.po, options); } function i18nextToPot(locale, body, options = {}) { return i18nextToGettext(locale, body.toString('utf8'), gettext_parser_1.po, options); } function i18nextToMo(locale, body, options = {}) { return i18nextToGettext(locale, body.toString('utf8'), gettext_parser_1.mo, options); } function i18nextToGettext(locale, body, parser, options) { const parserOptions = options.foldLength === undefined ? {} : { foldLength: options.foldLength }; return Promise.resolve(parser.compile((0, gettext_converter_1.i18next2js)(locale, // i18next2js does not support buffers Buffer.isBuffer(body) ? body.toString('utf8') : body, { ...options, project: options.project ?? 'i18next-conv', setLocaleAsLanguageHeader: false, }), parserOptions)); } //# sourceMappingURL=i18next-conv.js.map