lingo.dev 0.85.6 → 0.85.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.cjs +75 -50
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +32 -7
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.mjs
CHANGED
|
@@ -1032,6 +1032,8 @@ function createLoader(lDefinition) {
|
|
|
1032
1032
|
const state = {
|
|
1033
1033
|
defaultLocale: void 0,
|
|
1034
1034
|
originalInput: void 0,
|
|
1035
|
+
pullInput: void 0,
|
|
1036
|
+
pullOutput: void 0,
|
|
1035
1037
|
initCtx: void 0
|
|
1036
1038
|
};
|
|
1037
1039
|
return {
|
|
@@ -1059,7 +1061,10 @@ function createLoader(lDefinition) {
|
|
|
1059
1061
|
if (locale === state.defaultLocale) {
|
|
1060
1062
|
state.originalInput = input2 || null;
|
|
1061
1063
|
}
|
|
1062
|
-
|
|
1064
|
+
state.pullInput = input2;
|
|
1065
|
+
const result = await lDefinition.pull(locale, input2, state.initCtx);
|
|
1066
|
+
state.pullOutput = result;
|
|
1067
|
+
return result;
|
|
1063
1068
|
},
|
|
1064
1069
|
async push(locale, data) {
|
|
1065
1070
|
if (!state.defaultLocale) {
|
|
@@ -1068,7 +1073,14 @@ function createLoader(lDefinition) {
|
|
|
1068
1073
|
if (state.originalInput === void 0) {
|
|
1069
1074
|
throw new Error("Cannot push data without pulling first");
|
|
1070
1075
|
}
|
|
1071
|
-
const pushResult = await lDefinition.push(
|
|
1076
|
+
const pushResult = await lDefinition.push(
|
|
1077
|
+
locale,
|
|
1078
|
+
data,
|
|
1079
|
+
state.originalInput,
|
|
1080
|
+
state.defaultLocale,
|
|
1081
|
+
state.pullInput,
|
|
1082
|
+
state.pullOutput
|
|
1083
|
+
);
|
|
1072
1084
|
return pushResult;
|
|
1073
1085
|
}
|
|
1074
1086
|
};
|
|
@@ -1996,14 +2008,27 @@ function createPoDataLoader(params) {
|
|
|
1996
2008
|
}
|
|
1997
2009
|
return result;
|
|
1998
2010
|
},
|
|
1999
|
-
async push(locale, data, originalInput) {
|
|
2000
|
-
const
|
|
2001
|
-
const
|
|
2011
|
+
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
2012
|
+
const currentSections = pullInput?.split("\n\n").filter(Boolean) || [];
|
|
2013
|
+
const originalSections = originalInput?.split("\n\n").filter(Boolean) || [];
|
|
2014
|
+
const result = originalSections.map((section) => {
|
|
2002
2015
|
const sectionPo = gettextParser.po.parse(section);
|
|
2003
2016
|
const contextKey = _12.keys(sectionPo.translations)[0];
|
|
2004
2017
|
const entries = sectionPo.translations[contextKey];
|
|
2005
2018
|
const msgid = Object.keys(entries).find((key) => entries[key].msgid);
|
|
2006
|
-
if (!msgid)
|
|
2019
|
+
if (!msgid) {
|
|
2020
|
+
const currentSection = currentSections.find((cs) => {
|
|
2021
|
+
const csPo = gettextParser.po.parse(cs);
|
|
2022
|
+
const csContextKey = _12.keys(csPo.translations)[0];
|
|
2023
|
+
const csEntries = csPo.translations[csContextKey];
|
|
2024
|
+
const csMsgid = Object.keys(csEntries).find((key) => csEntries[key].msgid);
|
|
2025
|
+
return csMsgid === msgid;
|
|
2026
|
+
});
|
|
2027
|
+
if (currentSection) {
|
|
2028
|
+
return currentSection;
|
|
2029
|
+
}
|
|
2030
|
+
return section;
|
|
2031
|
+
}
|
|
2007
2032
|
if (data[msgid]) {
|
|
2008
2033
|
const updatedPo = _12.merge({}, sectionPo, {
|
|
2009
2034
|
translations: {
|
|
@@ -5460,7 +5485,7 @@ function validateParams2(i18nConfig, flags) {
|
|
|
5460
5485
|
// package.json
|
|
5461
5486
|
var package_default = {
|
|
5462
5487
|
name: "lingo.dev",
|
|
5463
|
-
version: "0.85.
|
|
5488
|
+
version: "0.85.7",
|
|
5464
5489
|
description: "Lingo.dev CLI",
|
|
5465
5490
|
private: false,
|
|
5466
5491
|
publishConfig: {
|