From 159f79f9d8a21df8b806dfe1737802bd7bdbcf94 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Wed, 9 Apr 2025 16:45:11 -0400 Subject: [PATCH] fix i18n script (#7783) --- frontend/scripts/check-unlocalized-strings.cjs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/scripts/check-unlocalized-strings.cjs b/frontend/scripts/check-unlocalized-strings.cjs index c8e2575025..16342fb96b 100755 --- a/frontend/scripts/check-unlocalized-strings.cjs +++ b/frontend/scripts/check-unlocalized-strings.cjs @@ -47,6 +47,7 @@ const SCAN_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx"]; // Attributes that typically don't contain user-facing text const NON_TEXT_ATTRIBUTES = [ "className", + "i18nKey", "testId", "id", "name", @@ -685,23 +686,23 @@ function scanDirectoryForUnlocalizedStrings(dirPath) { try { const srcPath = path.resolve(__dirname, '../src'); console.log('Checking for unlocalized strings in frontend code...'); - + // Get unlocalized strings using the AST scanner const results = scanDirectoryForUnlocalizedStrings(srcPath); - + // If we found any unlocalized strings, format them for output and exit with error if (results.size > 0) { const formattedResults = Array.from(results.entries()) .map(([file, strings]) => `\n${file}:\n ${strings.join('\n ')}`) .join('\n'); - + console.error(`Error: Found unlocalized strings in the following files:${formattedResults}`); process.exit(1); } - + console.log('✅ No unlocalized strings found in frontend code.'); process.exit(0); } catch (error) { console.error('Error running unlocalized strings check:', error); process.exit(1); -} \ No newline at end of file +}