From a057e2a4e67a5a526b3133a33a8572a3932091ce Mon Sep 17 00:00:00 2001 From: sspanak Date: Tue, 30 Apr 2024 16:31:32 +0300 Subject: [PATCH] fixed the remove-foreign-words script not to add extra words when used in whitelist mode --- scripts/remove-foreign-words.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/remove-foreign-words.js b/scripts/remove-foreign-words.js index 33235f4d..dda650e2 100644 --- a/scripts/remove-foreign-words.js +++ b/scripts/remove-foreign-words.js @@ -47,7 +47,7 @@ async function work({ isBlacklist, locale, fileName, foreignWordsLocale, foreign let lineReader = createInterface({ input: createReadStream(fileName) }); for await (const line of lineReader) { - originalWords.set(line.toLocaleLowerCase(foreignWordsLocale), line); + originalWords.set(line.toLocaleLowerCase(locale), line); } const goodWords = new Set(); @@ -58,14 +58,14 @@ async function work({ isBlacklist, locale, fileName, foreignWordsLocale, foreign continue; } - const wordKey = line.toLocaleLowerCase(locale); + const wordKey = line.toLocaleLowerCase(foreignWordsLocale); if (isBlacklist && originalWords.has(wordKey)) { originalWords.delete(wordKey); } if (!isBlacklist && originalWords.has(wordKey)) { - goodWords.add(line); + goodWords.add(originalWords.get(wordKey)); } }