lingo.dev 0.77.7 → 0.78.1

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
@@ -1665,12 +1665,16 @@ function createXcodeStringsdictLoader() {
1665
1665
 
1666
1666
  // src/cli/loaders/xcode-xcstrings.ts
1667
1667
 
1668
- function createXcodeXcstringsLoader() {
1668
+ function createXcodeXcstringsLoader(defaultLocale) {
1669
1669
  return createLoader({
1670
- async pull(locale, input2) {
1670
+ async pull(locale, input2, initCtx) {
1671
1671
  const resultData = {};
1672
+ const isSourceLanguage = locale === defaultLocale;
1672
1673
  for (const [translationKey, _translationEntity] of Object.entries(input2.strings)) {
1673
1674
  const rootTranslationEntity = _translationEntity;
1675
+ if (rootTranslationEntity.shouldTranslate === false) {
1676
+ continue;
1677
+ }
1674
1678
  const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _65 => _65.localizations, 'optionalAccess', _66 => _66[locale]]);
1675
1679
  if (langTranslationEntity) {
1676
1680
  if ("stringUnit" in langTranslationEntity) {
@@ -1686,17 +1690,25 @@ function createXcodeXcstringsLoader() {
1686
1690
  }
1687
1691
  }
1688
1692
  }
1693
+ } else if (isSourceLanguage) {
1694
+ resultData[translationKey] = translationKey;
1689
1695
  }
1690
1696
  }
1697
+ console.log(resultData);
1691
1698
  return resultData;
1692
1699
  },
1693
1700
  async push(locale, payload, originalInput) {
1694
1701
  const langDataToMerge = {};
1695
1702
  langDataToMerge.strings = {};
1703
+ const input2 = _lodash2.default.cloneDeep(originalInput) || { sourceLanguage: locale, strings: {} };
1696
1704
  for (const [key, value] of Object.entries(payload)) {
1705
+ if (value === null || value === void 0) {
1706
+ continue;
1707
+ }
1708
+ const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
1697
1709
  if (typeof value === "string") {
1698
1710
  langDataToMerge.strings[key] = {
1699
- extractionState: "manual",
1711
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _70 => _70.strings, 'optionalAccess', _71 => _71[key], 'optionalAccess', _72 => _72.extractionState]),
1700
1712
  localizations: {
1701
1713
  [locale]: {
1702
1714
  stringUnit: {
@@ -1706,6 +1718,9 @@ function createXcodeXcstringsLoader() {
1706
1718
  }
1707
1719
  }
1708
1720
  };
1721
+ if (hasDoNotTranslateFlag) {
1722
+ langDataToMerge.strings[key].shouldTranslate = false;
1723
+ }
1709
1724
  } else {
1710
1725
  const updatedVariations = {};
1711
1726
  for (const form in value) {
@@ -1726,6 +1741,9 @@ function createXcodeXcstringsLoader() {
1726
1741
  }
1727
1742
  }
1728
1743
  };
1744
+ if (hasDoNotTranslateFlag) {
1745
+ langDataToMerge.strings[key].shouldTranslate = false;
1746
+ }
1729
1747
  }
1730
1748
  }
1731
1749
  const result = _lodash2.default.merge({}, originalInput, langDataToMerge);
@@ -1830,7 +1848,7 @@ function createPoDataLoader(params) {
1830
1848
  Object.entries(entries).forEach(([msgid, entry]) => {
1831
1849
  if (msgid && entry.msgid) {
1832
1850
  const context = entry.msgctxt || "";
1833
- const fullEntry = _optionalChain([parsedPo, 'access', _70 => _70.translations, 'access', _71 => _71[context], 'optionalAccess', _72 => _72[msgid]]);
1851
+ const fullEntry = _optionalChain([parsedPo, 'access', _73 => _73.translations, 'access', _74 => _74[context], 'optionalAccess', _75 => _75[msgid]]);
1834
1852
  if (fullEntry) {
1835
1853
  result[msgid] = fullEntry;
1836
1854
  }
@@ -1840,7 +1858,7 @@ function createPoDataLoader(params) {
1840
1858
  return result;
1841
1859
  },
1842
1860
  async push(locale, data, originalInput) {
1843
- const sections = _optionalChain([originalInput, 'optionalAccess', _73 => _73.split, 'call', _74 => _74("\n\n"), 'access', _75 => _75.filter, 'call', _76 => _76(Boolean)]) || [];
1861
+ const sections = _optionalChain([originalInput, 'optionalAccess', _76 => _76.split, 'call', _77 => _77("\n\n"), 'access', _78 => _78.filter, 'call', _79 => _79(Boolean)]) || [];
1844
1862
  const result = sections.map((section) => {
1845
1863
  const sectionPo = _gettextparser2.default.po.parse(section);
1846
1864
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
@@ -1882,7 +1900,7 @@ function createPoContentLoader() {
1882
1900
  entry.msgid,
1883
1901
  {
1884
1902
  ...entry,
1885
- msgstr: [_optionalChain([data, 'access', _77 => _77[entry.msgid], 'optionalAccess', _78 => _78.singular]), _optionalChain([data, 'access', _79 => _79[entry.msgid], 'optionalAccess', _80 => _80.plural]) || null].filter(Boolean)
1903
+ msgstr: [_optionalChain([data, 'access', _80 => _80[entry.msgid], 'optionalAccess', _81 => _81.singular]), _optionalChain([data, 'access', _82 => _82[entry.msgid], 'optionalAccess', _83 => _83.plural]) || null].filter(Boolean)
1886
1904
  }
1887
1905
  ]).fromPairs().value();
1888
1906
  return result;
@@ -2128,7 +2146,7 @@ function createDatoClient(params) {
2128
2146
  only_valid: "true",
2129
2147
  ids: !records.length ? void 0 : records.join(",")
2130
2148
  }
2131
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _81 => _81.response, 'optionalAccess', _82 => _82.body, 'optionalAccess', _83 => _83.data, 'optionalAccess', _84 => _84[0]]) || error));
2149
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _84 => _84.response, 'optionalAccess', _85 => _85.body, 'optionalAccess', _86 => _86.data, 'optionalAccess', _87 => _87[0]]) || error));
2132
2150
  },
2133
2151
  findRecordsForModel: async (modelId, records) => {
2134
2152
  try {
@@ -2138,9 +2156,9 @@ function createDatoClient(params) {
2138
2156
  filter: {
2139
2157
  type: modelId,
2140
2158
  only_valid: "true",
2141
- ids: !_optionalChain([records, 'optionalAccess', _85 => _85.length]) ? void 0 : records.join(",")
2159
+ ids: !_optionalChain([records, 'optionalAccess', _88 => _88.length]) ? void 0 : records.join(",")
2142
2160
  }
2143
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _86 => _86.response, 'optionalAccess', _87 => _87.body, 'optionalAccess', _88 => _88.data, 'optionalAccess', _89 => _89[0]]) || error));
2161
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _89 => _89.response, 'optionalAccess', _90 => _90.body, 'optionalAccess', _91 => _91.data, 'optionalAccess', _92 => _92[0]]) || error));
2144
2162
  return result;
2145
2163
  } catch (_error) {
2146
2164
  throw new Error(
@@ -2154,9 +2172,9 @@ function createDatoClient(params) {
2154
2172
  },
2155
2173
  updateRecord: async (id, payload) => {
2156
2174
  try {
2157
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _90 => _90.response, 'optionalAccess', _91 => _91.body, 'optionalAccess', _92 => _92.data, 'optionalAccess', _93 => _93[0]]) || error));
2175
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _93 => _93.response, 'optionalAccess', _94 => _94.body, 'optionalAccess', _95 => _95.data, 'optionalAccess', _96 => _96[0]]) || error));
2158
2176
  } catch (_error) {
2159
- if (_optionalChain([_error, 'optionalAccess', _94 => _94.attributes, 'optionalAccess', _95 => _95.details, 'optionalAccess', _96 => _96.message])) {
2177
+ if (_optionalChain([_error, 'optionalAccess', _97 => _97.attributes, 'optionalAccess', _98 => _98.details, 'optionalAccess', _99 => _99.message])) {
2160
2178
  throw new Error(
2161
2179
  [
2162
2180
  `${_error.attributes.details.message}`,
@@ -2177,9 +2195,9 @@ function createDatoClient(params) {
2177
2195
  },
2178
2196
  enableFieldLocalization: async (args) => {
2179
2197
  try {
2180
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _97 => _97.response, 'optionalAccess', _98 => _98.body, 'optionalAccess', _99 => _99.data, 'optionalAccess', _100 => _100[0]]) || error));
2198
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _100 => _100.response, 'optionalAccess', _101 => _101.body, 'optionalAccess', _102 => _102.data, 'optionalAccess', _103 => _103[0]]) || error));
2181
2199
  } catch (_error) {
2182
- if (_optionalChain([_error, 'optionalAccess', _101 => _101.attributes, 'optionalAccess', _102 => _102.code]) === "NOT_FOUND") {
2200
+ if (_optionalChain([_error, 'optionalAccess', _104 => _104.attributes, 'optionalAccess', _105 => _105.code]) === "NOT_FOUND") {
2183
2201
  throw new Error(
2184
2202
  [
2185
2203
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -2187,7 +2205,7 @@ function createDatoClient(params) {
2187
2205
  ].join("\n\n")
2188
2206
  );
2189
2207
  }
2190
- if (_optionalChain([_error, 'optionalAccess', _103 => _103.attributes, 'optionalAccess', _104 => _104.details, 'optionalAccess', _105 => _105.message])) {
2208
+ if (_optionalChain([_error, 'optionalAccess', _106 => _106.attributes, 'optionalAccess', _107 => _107.details, 'optionalAccess', _108 => _108.message])) {
2191
2209
  throw new Error(
2192
2210
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
2193
2211
  );
@@ -2253,7 +2271,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
2253
2271
  }
2254
2272
  }
2255
2273
  const records = await dato.findRecordsForModel(modelId);
2256
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _106 => _106.models, 'access', _107 => _107[modelId], 'optionalAccess', _108 => _108.records]) || [], project);
2274
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _109 => _109.models, 'access', _110 => _110[modelId], 'optionalAccess', _111 => _111.records]) || [], project);
2257
2275
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
2258
2276
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
2259
2277
  updatedConfig.models[modelId].records = selectedRecords;
@@ -2265,14 +2283,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
2265
2283
  },
2266
2284
  async pull(locale, input2, initCtx) {
2267
2285
  const result = {};
2268
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _109 => _109.models]) || {})) {
2269
- let records = _optionalChain([initCtx, 'optionalAccess', _110 => _110.models, 'access', _111 => _111[modelId], 'access', _112 => _112.records]) || [];
2286
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _112 => _112.models]) || {})) {
2287
+ let records = _optionalChain([initCtx, 'optionalAccess', _113 => _113.models, 'access', _114 => _114[modelId], 'access', _115 => _115.records]) || [];
2270
2288
  const recordIds = records.map((record) => record.id);
2271
2289
  records = await dato.findRecords(recordIds);
2272
2290
  console.log(`Fetched ${records.length} records for model ${modelId}`);
2273
2291
  if (records.length > 0) {
2274
2292
  result[modelId] = {
2275
- fields: _optionalChain([initCtx, 'optionalAccess', _113 => _113.models, 'optionalAccess', _114 => _114[modelId], 'optionalAccess', _115 => _115.fields]) || [],
2293
+ fields: _optionalChain([initCtx, 'optionalAccess', _116 => _116.models, 'optionalAccess', _117 => _117[modelId], 'optionalAccess', _118 => _118.fields]) || [],
2276
2294
  records
2277
2295
  };
2278
2296
  }
@@ -2331,7 +2349,7 @@ function createRecordChoices(records, selectedIds = [], project) {
2331
2349
  return records.map((record) => ({
2332
2350
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
2333
2351
  value: record.id,
2334
- checked: _optionalChain([selectedIds, 'optionalAccess', _116 => _116.includes, 'call', _117 => _117(record.id)])
2352
+ checked: _optionalChain([selectedIds, 'optionalAccess', _119 => _119.includes, 'call', _120 => _120(record.id)])
2335
2353
  }));
2336
2354
  }
2337
2355
  async function promptRecordSelection(modelName, choices) {
@@ -2598,7 +2616,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
2598
2616
  function createVttLoader() {
2599
2617
  return createLoader({
2600
2618
  async pull(locale, input2) {
2601
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _118 => _118.parse, 'call', _119 => _119(input2), 'optionalAccess', _120 => _120.cues]);
2619
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _121 => _121.parse, 'call', _122 => _122(input2), 'optionalAccess', _123 => _123.cues]);
2602
2620
  if (Object.keys(vtt).length === 0) {
2603
2621
  return {};
2604
2622
  } else {
@@ -2650,7 +2668,7 @@ function variableExtractLoader(params) {
2650
2668
  for (let i = 0; i < matches.length; i++) {
2651
2669
  const match = matches[i];
2652
2670
  const currentValue = result[key].value;
2653
- const newValue = _optionalChain([currentValue, 'optionalAccess', _121 => _121.replace, 'call', _122 => _122(match, `{variable:${i}}`)]);
2671
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125(match, `{variable:${i}}`)]);
2654
2672
  result[key].value = newValue;
2655
2673
  result[key].variables[i] = match;
2656
2674
  }
@@ -2664,7 +2682,7 @@ function variableExtractLoader(params) {
2664
2682
  for (let i = 0; i < valueObj.variables.length; i++) {
2665
2683
  const variable = valueObj.variables[i];
2666
2684
  const currentValue = result[key];
2667
- const newValue = _optionalChain([currentValue, 'optionalAccess', _123 => _123.replace, 'call', _124 => _124(`{variable:${i}}`, variable)]);
2685
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _126 => _126.replace, 'call', _127 => _127(`{variable:${i}}`, variable)]);
2668
2686
  result[key] = newValue;
2669
2687
  }
2670
2688
  }
@@ -2840,7 +2858,7 @@ function escapePhpString(str) {
2840
2858
  }
2841
2859
 
2842
2860
  // src/cli/loaders/index.ts
2843
- function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = false } = {}) {
2861
+ function createBucketLoader(bucketType, bucketPathPattern, options) {
2844
2862
  switch (bucketType) {
2845
2863
  default:
2846
2864
  throw new Error(`Unsupported bucket type: ${bucketType}`);
@@ -2850,7 +2868,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2850
2868
  createAndroidLoader(),
2851
2869
  createFlatLoader(),
2852
2870
  createSyncLoader(),
2853
- createUnlocalizableLoader(isCacheRestore)
2871
+ createUnlocalizableLoader(options.isCacheRestore)
2854
2872
  );
2855
2873
  case "csv":
2856
2874
  return composeLoaders(
@@ -2858,7 +2876,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2858
2876
  createCsvLoader(),
2859
2877
  createFlatLoader(),
2860
2878
  createSyncLoader(),
2861
- createUnlocalizableLoader(isCacheRestore)
2879
+ createUnlocalizableLoader(options.isCacheRestore)
2862
2880
  );
2863
2881
  case "html":
2864
2882
  return composeLoaders(
@@ -2866,7 +2884,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2866
2884
  createPrettierLoader({ parser: "html", alwaysFormat: true }),
2867
2885
  createHtmlLoader(),
2868
2886
  createSyncLoader(),
2869
- createUnlocalizableLoader(isCacheRestore)
2887
+ createUnlocalizableLoader(options.isCacheRestore)
2870
2888
  );
2871
2889
  case "json":
2872
2890
  return composeLoaders(
@@ -2875,7 +2893,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2875
2893
  createJsonLoader(),
2876
2894
  createFlatLoader(),
2877
2895
  createSyncLoader(),
2878
- createUnlocalizableLoader(isCacheRestore)
2896
+ createUnlocalizableLoader(options.isCacheRestore)
2879
2897
  );
2880
2898
  case "markdown":
2881
2899
  return composeLoaders(
@@ -2883,7 +2901,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2883
2901
  createPrettierLoader({ parser: "markdown" }),
2884
2902
  createMarkdownLoader(),
2885
2903
  createSyncLoader(),
2886
- createUnlocalizableLoader(isCacheRestore)
2904
+ createUnlocalizableLoader(options.isCacheRestore)
2887
2905
  );
2888
2906
  case "po":
2889
2907
  return composeLoaders(
@@ -2891,7 +2909,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2891
2909
  createPoLoader(),
2892
2910
  createFlatLoader(),
2893
2911
  createSyncLoader(),
2894
- createUnlocalizableLoader(isCacheRestore),
2912
+ createUnlocalizableLoader(options.isCacheRestore),
2895
2913
  createVariableLoader({ type: "python" })
2896
2914
  );
2897
2915
  case "properties":
@@ -2899,14 +2917,14 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2899
2917
  createTextFileLoader(bucketPathPattern),
2900
2918
  createPropertiesLoader(),
2901
2919
  createSyncLoader(),
2902
- createUnlocalizableLoader(isCacheRestore)
2920
+ createUnlocalizableLoader(options.isCacheRestore)
2903
2921
  );
2904
2922
  case "xcode-strings":
2905
2923
  return composeLoaders(
2906
2924
  createTextFileLoader(bucketPathPattern),
2907
2925
  createXcodeStringsLoader(),
2908
2926
  createSyncLoader(),
2909
- createUnlocalizableLoader(isCacheRestore)
2927
+ createUnlocalizableLoader(options.isCacheRestore)
2910
2928
  );
2911
2929
  case "xcode-stringsdict":
2912
2930
  return composeLoaders(
@@ -2914,17 +2932,17 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2914
2932
  createXcodeStringsdictLoader(),
2915
2933
  createFlatLoader(),
2916
2934
  createSyncLoader(),
2917
- createUnlocalizableLoader(isCacheRestore)
2935
+ createUnlocalizableLoader(options.isCacheRestore)
2918
2936
  );
2919
2937
  case "xcode-xcstrings":
2920
2938
  return composeLoaders(
2921
2939
  createTextFileLoader(bucketPathPattern),
2922
2940
  createPlutilJsonTextLoader(),
2923
2941
  createJsonLoader(),
2924
- createXcodeXcstringsLoader(),
2942
+ createXcodeXcstringsLoader(options.defaultLocale),
2925
2943
  createFlatLoader(),
2926
2944
  createSyncLoader(),
2927
- createUnlocalizableLoader(isCacheRestore),
2945
+ createUnlocalizableLoader(options.isCacheRestore),
2928
2946
  createVariableLoader({ type: "ieee" })
2929
2947
  );
2930
2948
  case "yaml":
@@ -2934,7 +2952,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2934
2952
  createYamlLoader(),
2935
2953
  createFlatLoader(),
2936
2954
  createSyncLoader(),
2937
- createUnlocalizableLoader(isCacheRestore)
2955
+ createUnlocalizableLoader(options.isCacheRestore)
2938
2956
  );
2939
2957
  case "yaml-root-key":
2940
2958
  return composeLoaders(
@@ -2944,7 +2962,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2944
2962
  createRootKeyLoader(true),
2945
2963
  createFlatLoader(),
2946
2964
  createSyncLoader(),
2947
- createUnlocalizableLoader(isCacheRestore)
2965
+ createUnlocalizableLoader(options.isCacheRestore)
2948
2966
  );
2949
2967
  case "flutter":
2950
2968
  return composeLoaders(
@@ -2954,7 +2972,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2954
2972
  createFlutterLoader(),
2955
2973
  createFlatLoader(),
2956
2974
  createSyncLoader(),
2957
- createUnlocalizableLoader(isCacheRestore)
2975
+ createUnlocalizableLoader(options.isCacheRestore)
2958
2976
  );
2959
2977
  case "xliff":
2960
2978
  return composeLoaders(
@@ -2962,7 +2980,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2962
2980
  createXliffLoader(),
2963
2981
  createFlatLoader(),
2964
2982
  createSyncLoader(),
2965
- createUnlocalizableLoader(isCacheRestore)
2983
+ createUnlocalizableLoader(options.isCacheRestore)
2966
2984
  );
2967
2985
  case "xml":
2968
2986
  return composeLoaders(
@@ -2970,28 +2988,28 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2970
2988
  createXmlLoader(),
2971
2989
  createFlatLoader(),
2972
2990
  createSyncLoader(),
2973
- createUnlocalizableLoader(isCacheRestore)
2991
+ createUnlocalizableLoader(options.isCacheRestore)
2974
2992
  );
2975
2993
  case "srt":
2976
2994
  return composeLoaders(
2977
2995
  createTextFileLoader(bucketPathPattern),
2978
2996
  createSrtLoader(),
2979
2997
  createSyncLoader(),
2980
- createUnlocalizableLoader(isCacheRestore)
2998
+ createUnlocalizableLoader(options.isCacheRestore)
2981
2999
  );
2982
3000
  case "dato":
2983
3001
  return composeLoaders(
2984
3002
  createDatoLoader(bucketPathPattern),
2985
3003
  createSyncLoader(),
2986
3004
  createFlatLoader(),
2987
- createUnlocalizableLoader(isCacheRestore)
3005
+ createUnlocalizableLoader(options.isCacheRestore)
2988
3006
  );
2989
3007
  case "vtt":
2990
3008
  return composeLoaders(
2991
3009
  createTextFileLoader(bucketPathPattern),
2992
3010
  createVttLoader(),
2993
3011
  createSyncLoader(),
2994
- createUnlocalizableLoader(isCacheRestore)
3012
+ createUnlocalizableLoader(options.isCacheRestore)
2995
3013
  );
2996
3014
  case "php":
2997
3015
  return composeLoaders(
@@ -2999,7 +3017,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2999
3017
  createPhpLoader(),
3000
3018
  createSyncLoader(),
3001
3019
  createFlatLoader(),
3002
- createUnlocalizableLoader()
3020
+ createUnlocalizableLoader(options.isCacheRestore)
3003
3021
  );
3004
3022
  }
3005
3023
  }
@@ -3173,11 +3191,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3173
3191
  const auth = await validateAuth(settings);
3174
3192
  ora.succeed(`Authenticated as ${auth.email}`);
3175
3193
  let buckets = getBuckets(i18nConfig);
3176
- if (_optionalChain([flags, 'access', _125 => _125.bucket, 'optionalAccess', _126 => _126.length])) {
3194
+ if (_optionalChain([flags, 'access', _128 => _128.bucket, 'optionalAccess', _129 => _129.length])) {
3177
3195
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
3178
3196
  }
3179
3197
  ora.succeed("Buckets retrieved");
3180
- const targetLocales = _optionalChain([flags, 'access', _127 => _127.locale, 'optionalAccess', _128 => _128.length]) ? flags.locale : i18nConfig.locale.targets;
3198
+ const targetLocales = _optionalChain([flags, 'access', _130 => _130.locale, 'optionalAccess', _131 => _131.length]) ? flags.locale : i18nConfig.locale.targets;
3181
3199
  const lockfileHelper = createLockfileHelper();
3182
3200
  ora.start("Ensuring i18n.lock exists...");
3183
3201
  if (!lockfileHelper.isLockfileExists()) {
@@ -3185,7 +3203,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3185
3203
  for (const bucket of buckets) {
3186
3204
  for (const bucketConfig of bucket.config) {
3187
3205
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3188
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3206
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3207
+ isCacheRestore: false,
3208
+ defaultLocale: sourceLocale
3209
+ });
3189
3210
  bucketLoader.setDefaultLocale(sourceLocale);
3190
3211
  await bucketLoader.init();
3191
3212
  const sourceData = await bucketLoader.pull(i18nConfig.locale.source);
@@ -3207,7 +3228,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3207
3228
  const bucketOra = _ora2.default.call(void 0, { indent: 4 });
3208
3229
  bucketOra.info(`Processing path: ${bucketConfig.pathPattern}`);
3209
3230
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3210
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, { isCacheRestore: true });
3231
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3232
+ isCacheRestore: true,
3233
+ defaultLocale: sourceLocale
3234
+ });
3211
3235
  bucketLoader.setDefaultLocale(sourceLocale);
3212
3236
  await bucketLoader.init();
3213
3237
  const sourceData = await bucketLoader.pull(sourceLocale);
@@ -3242,7 +3266,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3242
3266
  for (const bucket of buckets) {
3243
3267
  for (const bucketConfig of bucket.config) {
3244
3268
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3245
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3269
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3270
+ isCacheRestore: false,
3271
+ defaultLocale: sourceLocale
3272
+ });
3246
3273
  bucketLoader.setDefaultLocale(sourceLocale);
3247
3274
  await bucketLoader.init();
3248
3275
  const sourceData = await bucketLoader.pull(i18nConfig.locale.source);
@@ -3268,7 +3295,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3268
3295
  for (const bucketConfig of bucket.config) {
3269
3296
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3270
3297
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3271
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3298
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3299
+ isCacheRestore: false,
3300
+ defaultLocale: sourceLocale
3301
+ });
3272
3302
  bucketLoader.setDefaultLocale(sourceLocale);
3273
3303
  await bucketLoader.init();
3274
3304
  let sourceData = await bucketLoader.pull(sourceLocale);
@@ -3467,12 +3497,12 @@ function validateParams(i18nConfig, flags) {
3467
3497
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
3468
3498
  docUrl: "bucketNotFound"
3469
3499
  });
3470
- } else if (_optionalChain([flags, 'access', _129 => _129.locale, 'optionalAccess', _130 => _130.some, 'call', _131 => _131((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3500
+ } else if (_optionalChain([flags, 'access', _132 => _132.locale, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3471
3501
  throw new CLIError({
3472
3502
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
3473
3503
  docUrl: "localeTargetNotFound"
3474
3504
  });
3475
- } else if (_optionalChain([flags, 'access', _132 => _132.bucket, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((bucket) => !i18nConfig.buckets[bucket])])) {
3505
+ } else if (_optionalChain([flags, 'access', _135 => _135.bucket, 'optionalAccess', _136 => _136.some, 'call', _137 => _137((bucket) => !i18nConfig.buckets[bucket])])) {
3476
3506
  throw new CLIError({
3477
3507
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
3478
3508
  docUrl: "bucketNotFound"
@@ -3592,7 +3622,7 @@ var lockfile_default = new (0, _interactivecommander.Command)().command("lockfil
3592
3622
  for (const bucket of buckets) {
3593
3623
  for (const bucketConfig of bucket.config) {
3594
3624
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3595
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3625
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, { isCacheRestore: false, defaultLocale: sourceLocale });
3596
3626
  bucketLoader.setDefaultLocale(sourceLocale);
3597
3627
  const sourceData = await bucketLoader.pull(sourceLocale);
3598
3628
  lockfileHelper.registerSourceData(bucketConfig.pathPattern, sourceData);
@@ -3629,7 +3659,7 @@ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup"
3629
3659
  for (const bucketConfig of bucket.config) {
3630
3660
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3631
3661
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3632
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3662
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, { isCacheRestore: false, defaultLocale: sourceLocale });
3633
3663
  bucketLoader.setDefaultLocale(sourceLocale);
3634
3664
  const sourceData = await bucketLoader.pull(sourceLocale);
3635
3665
  const sourceKeys = Object.keys(sourceData);
@@ -3752,7 +3782,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
3752
3782
  // package.json
3753
3783
  var package_default = {
3754
3784
  name: "lingo.dev",
3755
- version: "0.77.7",
3785
+ version: "0.78.1",
3756
3786
  description: "Lingo.dev CLI",
3757
3787
  private: false,
3758
3788
  publishConfig: {