Skip to content

Commit 1a3cbc1

Browse files
fix(cli): bug in status command when delimiter is used (#933)
* fix: fix a bug that status command appears to be stuck when `delimiter` is set in config * chore: add changeset * chore: update changeset
1 parent ae4d0b8 commit 1a3cbc1

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

.changeset/thick-planets-eat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lingo.dev": patch
3+
---
4+
5+
fix a bug in cli status command when delimiter is used

packages/cli/src/cli/cmd/status.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ export default new Command()
219219

220220
if (!fileExists) {
221221
// All keys are missing for this locale
222-
fileStats[filePath].languageStats[targetLocale].missing = sourceKeys.length;
223-
fileStats[filePath].languageStats[targetLocale].words = sourceWordCount;
224-
languageStats[targetLocale].missing += sourceKeys.length;
225-
languageStats[targetLocale].words += sourceWordCount;
226-
totalWordCount.set(targetLocale, (totalWordCount.get(targetLocale) || 0) + sourceWordCount);
222+
fileStats[filePath].languageStats[_targetLocale].missing = sourceKeys.length;
223+
fileStats[filePath].languageStats[_targetLocale].words = sourceWordCount;
224+
languageStats[_targetLocale].missing += sourceKeys.length;
225+
languageStats[_targetLocale].words += sourceWordCount;
226+
totalWordCount.set(_targetLocale, (totalWordCount.get(_targetLocale) || 0) + sourceWordCount);
227227

228228
bucketOra.succeed(
229229
`[${sourceLocale} -> ${targetLocale}] ${chalk.red(`0% complete`)} (0/${sourceKeys.length} keys) - file not found`,
@@ -257,17 +257,17 @@ export default new Command()
257257
}
258258

259259
// Update file stats
260-
fileStats[filePath].languageStats[targetLocale].missing = missingKeys.length;
261-
fileStats[filePath].languageStats[targetLocale].updated = updatedKeys.length;
262-
fileStats[filePath].languageStats[targetLocale].complete = completeKeys.length;
263-
fileStats[filePath].languageStats[targetLocale].words = wordsToTranslate;
260+
fileStats[filePath].languageStats[_targetLocale].missing = missingKeys.length;
261+
fileStats[filePath].languageStats[_targetLocale].updated = updatedKeys.length;
262+
fileStats[filePath].languageStats[_targetLocale].complete = completeKeys.length;
263+
fileStats[filePath].languageStats[_targetLocale].words = wordsToTranslate;
264264

265265
// Update global stats
266-
languageStats[targetLocale].missing += missingKeys.length;
267-
languageStats[targetLocale].updated += updatedKeys.length;
268-
languageStats[targetLocale].complete += completeKeys.length;
269-
languageStats[targetLocale].words += wordsToTranslate;
270-
totalWordCount.set(targetLocale, (totalWordCount.get(targetLocale) || 0) + wordsToTranslate);
266+
languageStats[_targetLocale].missing += missingKeys.length;
267+
languageStats[_targetLocale].updated += updatedKeys.length;
268+
languageStats[_targetLocale].complete += completeKeys.length;
269+
languageStats[_targetLocale].words += wordsToTranslate;
270+
totalWordCount.set(_targetLocale, (totalWordCount.get(_targetLocale) || 0) + wordsToTranslate);
271271

272272
// Display progress
273273
const totalKeysInFile = sourceKeys.length;

0 commit comments

Comments
 (0)