vue3-gettext
Advanced tools
Comparing version 2.1.0 to 2.2.0-alpha.1
@@ -125,6 +125,8 @@ #!/usr/bin/env node | ||
potPath: joinPathIfRelative((_e = config.output) === null || _e === void 0 ? void 0 : _e.potPath) || joinPath("./messages.pot"), | ||
jsonPath: joinPathIfRelative((_f = config.output) === null || _f === void 0 ? void 0 : _f.jsonPath) || joinPath("./translations.json"), | ||
locales: ((_g = config.output) === null || _g === void 0 ? void 0 : _g.locales) || ["en"], | ||
flat: ((_h = config.output) === null || _h === void 0 ? void 0 : _h.flat) === undefined ? false : (_j = config.output) === null || _j === void 0 ? void 0 : _j.flat, | ||
linguas: ((_k = config.output) === null || _k === void 0 ? void 0 : _k.linguas) === undefined ? true : (_l = config.output) === null || _l === void 0 ? void 0 : _l.linguas, | ||
jsonPath: joinPathIfRelative((_f = config.output) === null || _f === void 0 ? void 0 : _f.jsonPath) || | ||
(((_g = config.output) === null || _g === void 0 ? void 0 : _g.splitJson) ? joinPath("./") : joinPath("./translations.json")), | ||
locales: ((_h = config.output) === null || _h === void 0 ? void 0 : _h.locales) || ["en"], | ||
flat: ((_j = config.output) === null || _j === void 0 ? void 0 : _j.flat) === undefined ? false : config.output.flat, | ||
linguas: ((_k = config.output) === null || _k === void 0 ? void 0 : _k.linguas) === undefined ? true : config.output.linguas, | ||
splitJson: ((_l = config.output) === null || _l === void 0 ? void 0 : _l.splitJson) === undefined ? false : config.output.splitJson, | ||
}, | ||
@@ -151,22 +153,44 @@ }; | ||
(function () { return tslib.__awaiter(void 0, void 0, void 0, function () { | ||
var outputPath, jsonRes, _a, _b; | ||
return tslib.__generator(this, function (_c) { | ||
switch (_c.label) { | ||
var jsonRes, outputPath; | ||
return tslib.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, fsPromises__default["default"].mkdir(config.output.path, { recursive: true })]; | ||
case 1: | ||
_c.sent(); | ||
outputPath = config.output.jsonPath; | ||
_b = (_a = JSON).stringify; | ||
_a.sent(); | ||
return [4 /*yield*/, compilePoFiles(localesPaths)]; | ||
case 2: | ||
jsonRes = _b.apply(_a, [_c.sent()]); | ||
console.info("".concat(chalk__default["default"].green("Compiled json"), ": ").concat(chalk__default["default"].grey(jsonRes))); | ||
return [4 /*yield*/, fsPromises__default["default"].writeFile(outputPath, jsonRes)]; | ||
jsonRes = _a.sent(); | ||
console.info("".concat(chalk__default["default"].green("Compiled json"), ": ").concat(chalk__default["default"].grey(JSON.stringify(jsonRes)))); | ||
console.info(); | ||
if (!config.output.splitJson) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, Promise.all(config.output.locales.map(function (locale) { return tslib.__awaiter(void 0, void 0, void 0, function () { | ||
var outputPath; | ||
var _a; | ||
return tslib.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
outputPath = path__default["default"].join(config.output.jsonPath, "".concat(locale, ".json")); | ||
return [4 /*yield*/, fsPromises__default["default"].writeFile(outputPath, JSON.stringify((_a = {}, | ||
_a[locale] = jsonRes[locale], | ||
_a)))]; | ||
case 1: | ||
_b.sent(); | ||
console.info("".concat(chalk__default["default"].green("Created"), ": ").concat(chalk__default["default"].blueBright(outputPath))); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }))]; | ||
case 3: | ||
_c.sent(); | ||
console.info(); | ||
_a.sent(); | ||
return [3 /*break*/, 6]; | ||
case 4: | ||
outputPath = config.output.jsonPath; | ||
return [4 /*yield*/, fsPromises__default["default"].writeFile(outputPath, JSON.stringify(jsonRes))]; | ||
case 5: | ||
_a.sent(); | ||
console.info("".concat(chalk__default["default"].green("Created"), ": ").concat(chalk__default["default"].blueBright(outputPath))); | ||
return [2 /*return*/]; | ||
_a.label = 6; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
}); })(); |
@@ -60,6 +60,8 @@ #!/usr/bin/env node | ||
potPath: joinPathIfRelative((_e = config.output) === null || _e === void 0 ? void 0 : _e.potPath) || joinPath("./messages.pot"), | ||
jsonPath: joinPathIfRelative((_f = config.output) === null || _f === void 0 ? void 0 : _f.jsonPath) || joinPath("./translations.json"), | ||
locales: ((_g = config.output) === null || _g === void 0 ? void 0 : _g.locales) || ["en"], | ||
flat: ((_h = config.output) === null || _h === void 0 ? void 0 : _h.flat) === undefined ? false : (_j = config.output) === null || _j === void 0 ? void 0 : _j.flat, | ||
linguas: ((_k = config.output) === null || _k === void 0 ? void 0 : _k.linguas) === undefined ? true : (_l = config.output) === null || _l === void 0 ? void 0 : _l.linguas, | ||
jsonPath: joinPathIfRelative((_f = config.output) === null || _f === void 0 ? void 0 : _f.jsonPath) || | ||
(((_g = config.output) === null || _g === void 0 ? void 0 : _g.splitJson) ? joinPath("./") : joinPath("./translations.json")), | ||
locales: ((_h = config.output) === null || _h === void 0 ? void 0 : _h.locales) || ["en"], | ||
flat: ((_j = config.output) === null || _j === void 0 ? void 0 : _j.flat) === undefined ? false : config.output.flat, | ||
linguas: ((_k = config.output) === null || _k === void 0 ? void 0 : _k.linguas) === undefined ? true : config.output.linguas, | ||
splitJson: ((_l = config.output) === null || _l === void 0 ? void 0 : _l.splitJson) === undefined ? false : config.output.splitJson, | ||
}, | ||
@@ -66,0 +68,0 @@ }; |
@@ -576,3 +576,3 @@ 'use strict'; | ||
var mergedOptions = __assign(__assign({}, defaultOptions), options); | ||
var translations = vue.reactive({ value: normalizeTranslations(mergedOptions.translations) }); | ||
var translations = vue.ref(normalizeTranslations(mergedOptions.translations)); | ||
var gettext = vue.reactive({ | ||
@@ -579,0 +579,0 @@ available: mergedOptions.availableLanguages, |
@@ -150,2 +150,3 @@ import * as vue from 'vue'; | ||
linguas: boolean; | ||
splitJson: boolean; | ||
}; | ||
@@ -152,0 +153,0 @@ } |
{ | ||
"name": "vue3-gettext", | ||
"version": "2.1.0", | ||
"version": "2.2.0-alpha.1", | ||
"description": "Translate Vue 3 applications with gettext", | ||
@@ -5,0 +5,0 @@ "homepage": "https://jshmrtn.github.io/vue3-gettext/", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95447
2015
1