lingo.dev 0.87.11 → 0.87.12

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 CHANGED
@@ -1066,7 +1066,12 @@ function createLoader(lDefinition) {
1066
1066
  state.originalInput = input2 || null;
1067
1067
  }
1068
1068
  state.pullInput = input2;
1069
- const result = await lDefinition.pull(locale, input2, state.initCtx);
1069
+ const result = await lDefinition.pull(
1070
+ locale,
1071
+ input2,
1072
+ state.initCtx,
1073
+ state.defaultLocale
1074
+ );
1070
1075
  state.pullOutput = result;
1071
1076
  return result;
1072
1077
  },
@@ -1990,7 +1995,9 @@ function createPoDataLoader(params) {
1990
1995
  const csPo = _gettextparser2.default.po.parse(cs);
1991
1996
  const csContextKey = _lodash2.default.keys(csPo.translations)[0];
1992
1997
  const csEntries = csPo.translations[csContextKey];
1993
- const csMsgid = Object.keys(csEntries).find((key) => csEntries[key].msgid);
1998
+ const csMsgid = Object.keys(csEntries).find(
1999
+ (key) => csEntries[key].msgid
2000
+ );
1994
2001
  return csMsgid === msgid;
1995
2002
  });
1996
2003
  if (currentSection) {
@@ -2008,7 +2015,10 @@ function createPoDataLoader(params) {
2008
2015
  }
2009
2016
  }
2010
2017
  });
2011
- return _gettextparser2.default.po.compile(updatedPo, { foldLength: params.multiline ? 76 : false }).toString().replace([`msgid ""`, `msgstr "Content-Type: text/plain\\n"`].join("\n"), "").trim();
2018
+ return _gettextparser2.default.po.compile(updatedPo, { foldLength: params.multiline ? 76 : false }).toString().replace(
2019
+ [`msgid ""`, `msgstr "Content-Type: text/plain\\n"`].join("\n"),
2020
+ ""
2021
+ ).trim();
2012
2022
  }
2013
2023
  return section.trim();
2014
2024
  }).join("\n\n");
@@ -2018,14 +2028,19 @@ function createPoDataLoader(params) {
2018
2028
  }
2019
2029
  function createPoContentLoader() {
2020
2030
  return createLoader({
2021
- async pull(locale, input2) {
2022
- const result = _lodash2.default.chain(input2).entries().filter(([, entry]) => !!entry.msgid).map(([, entry]) => [
2023
- entry.msgid,
2024
- {
2025
- singular: entry.msgstr[0] || entry.msgid,
2026
- plural: entry.msgstr[1] || entry.msgid_plural || null
2027
- }
2028
- ]).fromPairs().value();
2031
+ async pull(locale, input2, initCtx, originalLocale) {
2032
+ const result = _lodash2.default.chain(input2).entries().filter(([, entry]) => !!entry.msgid).map(([, entry]) => {
2033
+ const singularFallback = locale === originalLocale ? entry.msgid : null;
2034
+ const pluralFallback = locale === originalLocale ? entry.msgid_plural || entry.msgid : null;
2035
+ const hasPlural = entry.msgstr.length > 1;
2036
+ return [
2037
+ entry.msgid,
2038
+ {
2039
+ singular: entry.msgstr[0] || singularFallback,
2040
+ plural: hasPlural ? entry.msgstr[1] || pluralFallback : null
2041
+ }
2042
+ ];
2043
+ }).fromPairs().value();
2029
2044
  return result;
2030
2045
  },
2031
2046
  async push(locale, data, originalInput) {
@@ -2033,7 +2048,10 @@ function createPoContentLoader() {
2033
2048
  entry.msgid,
2034
2049
  {
2035
2050
  ...entry,
2036
- msgstr: [_optionalChain([data, 'access', _95 => _95[entry.msgid], 'optionalAccess', _96 => _96.singular]), _optionalChain([data, 'access', _97 => _97[entry.msgid], 'optionalAccess', _98 => _98.plural]) || null].filter(Boolean)
2051
+ msgstr: [
2052
+ _optionalChain([data, 'access', _95 => _95[entry.msgid], 'optionalAccess', _96 => _96.singular]),
2053
+ _optionalChain([data, 'access', _97 => _97[entry.msgid], 'optionalAccess', _98 => _98.plural]) || null
2054
+ ].filter(Boolean)
2037
2055
  }
2038
2056
  ]).fromPairs().value();
2039
2057
  return result;
@@ -3282,11 +3300,11 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3282
3300
  case "mdx":
3283
3301
  return composeLoaders(
3284
3302
  createTextFileLoader(bucketPathPattern),
3285
- createMdxCodePlaceholderLoader(),
3286
3303
  createPrettierLoader({
3287
3304
  parser: "mdx",
3288
3305
  bucketPathPattern
3289
3306
  }),
3307
+ createMdxCodePlaceholderLoader(),
3290
3308
  createMdxFrontmatterSplitLoader(),
3291
3309
  createMdxSectionsSplit2Loader(),
3292
3310
  createLocalizableMdxDocumentLoader(),
@@ -5661,7 +5679,7 @@ function validateParams2(i18nConfig, flags) {
5661
5679
  // package.json
5662
5680
  var package_default = {
5663
5681
  name: "lingo.dev",
5664
- version: "0.87.11",
5682
+ version: "0.87.12",
5665
5683
  description: "Lingo.dev CLI",
5666
5684
  private: false,
5667
5685
  publishConfig: {