Skip to content

Commit 5a3c804

Browse files
committed
fix(i18n): make message extraction order deterministic
readdir file order can differ based on OS, causing extracted locale files to differ wherever duplicate namespace/keys exist. this change sorts the file list with normalized path separators so extraction output is byte-identical regardless of OS, which should prevent i18n check failures from such collisions
1 parent 58e4fa7 commit 5a3c804

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎server/i18n/extractMessages.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ async function extractMessages(
4343

4444
async function processMessages(dir: string): Promise<string> {
4545
const files = await getFiles(dir);
46-
const tsFiles = files.filter((f) => /\.tsx?$/.test(f));
46+
const tsFiles = files
47+
.filter((f) => /\.tsx?$/.test(f))
48+
.sort((a, b) => {
49+
const left = a.replace(/\\/g, '/');
50+
const right = b.replace(/\\/g, '/');
51+
return left < right ? -1 : left > right ? 1 : 0;
52+
});
4753
const extractedMessagesGroups = await Promise.all(
4854
tsFiles.map(extractMessages)
4955
);

0 commit comments

Comments
 (0)