Skip to content

Commit

Permalink
Merge branch 'km/beeep-detecting-messages-modified-keys' into km/beee…
Browse files Browse the repository at this point in the history
…p-detecting-messages-modified-keys-test
  • Loading branch information
mzieniukbw committed Oct 5, 2024
2 parents 4ec78ec + 7c6b139 commit 220d2f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/test-locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function findLocaleFiles(dir: string): string[] {
return fs
.readdirSync(dir, { encoding: null, recursive: true })
.filter((file) => path.basename(file) === "messages.json")
.filter((file) => path.dirname(file).endsWith("en"))
.map((file) => path.join(dir, file));
}

Expand Down Expand Up @@ -53,7 +54,7 @@ function compareMessagesJson(beforeFile: string, afterFile: string): boolean {
}

if (messagesIdMapBefore.get(id) !== message) {
console.warn(`Message changed: "${id}" message ${message} file ${afterFile}`);
console.error(`Message changed: "${id}" message ${message} file ${afterFile}`);
changed = true;
}
}
Expand All @@ -77,12 +78,14 @@ const baseBranchRootDir = path.join(rootDir, "base");

const files = findAllLocaleFiles(rootDir);

console.log("Detected valid English locale files:", files);

let changedFiles = false;

for (const file of files) {
const baseBranchFile = path.join(baseBranchRootDir, file);
if (!fs.existsSync(baseBranchFile)) {
console.warn(`File not found in base branch: ${file}`);
console.warn("File not found in base branch:", file);
continue;
}

Expand Down

0 comments on commit 220d2f6

Please sign in to comment.