Skip to content

Commit aac1a3e

Browse files
committed
refactor: precompute English keys in checkAreaTranslations for improved performance
1 parent ec33eda commit aac1a3e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/find-missing-translations.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ async function checkAreaTranslations(area) {
190190
`Checking ${englishFileContents.length} translation file(s): ${englishFileContents.map((f) => f.name).join(", ")}`,
191191
)
192192

193+
// Precompute English keys per file
194+
const englishFileKeys = new Map(englishFileContents.map((f) => [f.name, findKeys(f.content)]))
195+
193196
// Results object to store missing translations
194197
const missingTranslations = {}
195198

@@ -211,7 +214,7 @@ async function checkAreaTranslations(area) {
211214
}
212215

213216
// Find all keys in the English file
214-
const englishKeys = findKeys(englishContent)
217+
const englishKeys = englishFileKeys.get(name) || []
215218

216219
// Check for missing keys in the locale file
217220
const missingKeys = []

0 commit comments

Comments
 (0)