Skip to content

fix: untranslated messages - #326

Merged
Anyesh merged 9 commits into
mainfrom
fix/untranslated-messages
Nov 10, 2026
Merged

Anyesh merged 9 commits into
mainfrom
fix/untranslated-messages

Conversation

@Anyesh

@Anyesh Anyesh commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Description

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's coding style
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • I have updated documentation as needed
  • My changes don't introduce new warnings or errors

Testing

Test Environment

  • Docker Compose
  • Kubernetes
  • Local development

Tests Performed

Screenshots (if applicable)

Additional Notes

Summary by Sourcery

Prevent untranslated messages from reaching the application by correcting locale data and expanding internationalization checks.

Bug Fixes:

  • Correct untranslated and stale message entries across the supported locale files.

Enhancements:

  • Strengthen internationalization validation to detect identical translations, untranslated CJK strings, and untranslated plural or select branches while allowing approved shared values.

@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Extend the i18n checker to detect identical translations, missing native-script text, and untranslated text in nested ICU branches, while allowing known exceptions.

  • frontend/scripts/i18n-check.mjs L48-69, L77-86, L124-172

UI

Translate and align common and wardrobe messages across locales, including queue, image-tool, upload, rotation, and background wording.

  • frontend/messages/de/common.json L14-16
  • frontend/messages/de/wardrobe.json L63-100, L105-116, L271-280 (+2 small edits)
  • frontend/messages/en/wardrobe.json L80, L281 (removed lines)
  • frontend/messages/fr/common.json L14-16
  • frontend/messages/fr/wardrobe.json L63-100, L105-116, L271-280 (+2 small edits)
  • frontend/messages/it/common.json L14-16
  • frontend/messages/it/wardrobe.json L63-100, L105-116, L271-280 (+2 small edits)
  • frontend/messages/ja/common.json L14-16
  • frontend/messages/ja/wardrobe.json L63-100, L105-116, L271-280 (+2 small edits)
  • frontend/messages/ko/common.json L14-16
  • frontend/messages/ko/wardrobe.json L63-100, L105-116, L271-280 (+2 small edits)
  • frontend/messages/zh-CN/common.json L14-16
  • frontend/messages/zh-CN/wardrobe.json L63-100, L105-116, L271-280 (+2 small edits)
  • frontend/messages/zh-TW/common.json L14-16
  • frontend/messages/zh-TW/wardrobe.json L63-100, L105-116, L271-280 (+2 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added the javascript Pull requests that update javascript code label Nov 10, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 4 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="frontend/scripts/i18n-check.mjs" line_range="131-132" />
<code_context>
+  // Argument names are stripped first so that a format-only pattern like '{time} - {occasion}'
+  // does not count as words.
+  if (SAME_IN_EVERY_LOCALE.has(key) || !/\p{L}/u.test(words(source[key]))) continue;
+  if (translations.length > 1 && new Set(translations.map((t) => t[key])).size === 1) {
+    problems.push(`every locale: '${key}' is identical in every translation, so it is untranslated or stale`);
+  }
+}
</code_context>
<issue_to_address>
**Valid shared strings fail parity**

When the parity check evaluates an intentionally shared key such as `nav.brandName` or `notifications.channels.placeholders.emailAddress`, the identical-translation check reports the key as untranslated or stale, including when the source and every translation use `wardrowbe`, so `i18n:parity` and `i18n:check` fail on valid locale data.

Exclude intentionally shared keys from the identical-translation check.
</issue_to_address>

### Comment 2
<location path="frontend/scripts/i18n-check.mjs" line_range="64" />
<code_context>
+      if (depth % 2 === 0) open.pop();
+      depth--;
+    } else if (depth > 0 && depth % 2 === 0) {
+      texts[open[open.length - 1]] += ch;
+    }
+  }
</code_context>
<issue_to_address>
**CJK plural translations fail validation**

When the parity check runs on the existing CJK ICU plural messages, `branchTexts` includes ICU selectors such as `one` and `other` in each branch’s text, so the CJK Latin-script check treats these required selector tokens as untranslated copy and fails the parity check on valid translations.

Exclude ICU branch selectors from the text returned by `branchTexts` before checking for Latin-script copy.
</issue_to_address>

### Comment 3
<location path="frontend/scripts/i18n-check.mjs" line_range="124" />
<code_context>
   for (const key of targetKeys) if (!sourceKeys.has(key)) problems.push(`${locale}: extra key '${key}' not in ${SOURCE_LOCALE}`);
 }

+const words = (value) => (typeof value === 'string' ? value.replace(/\{\w+\}/g, '') : '');
+
+const translations = locales.filter((l) => l !== SOURCE_LOCALE).map(loadLocale);
</code_context>
<issue_to_address>
**Numeric-only plurals fail checks**

When a message consists only of a number-only ICU plural or another ICU-formatted argument with no translatable literal text, `words()` strips only simple `{name}` arguments, so a valid count-only ICU message such as `{count, plural, one {#} other {#}}` still contains Latin syntax words. The CJK check then rejects a translation that correctly renders only a number, causing `i18n:check` to fail.

Parse ICU messages and apply script checks only to their literal text, excluding argument syntax and format keywords.

Also at `frontend/scripts/i18n-check.mjs:164-166`.
</issue_to_address>

### Comment 4
<location path="frontend/scripts/i18n-check.mjs" line_range="165-168" />
<code_context>
+  for (const key of sourceKeys) {
+    if (SAME_IN_EVERY_LOCALE.has(key) || LATIN_IN_CJK.has(key)) continue;
+    if (!/\p{Script=Latin}/u.test(words(source[key]))) continue;
+    if (!script.test(words(target[key]))) {
+      problems.push(`${locale}: '${key}' has no ${locale} text, so it is untranslated or stale`);
+    } else if (branchTexts(target[key]).some((t) => /\p{Script=Latin}/u.test(t) && !script.test(t))) {
+      problems.push(`${locale}: '${key}' has a plural or select branch with no ${locale} text`);
+    }
+  }
</code_context>
<issue_to_address>
**English copy passes CJK checks**

When a CJK message mixes English with native-script text inside a branch or outside an ICU branch, `branchTexts` checks branch bodies but misses ordinary text outside branches, and the script checks pass when a segment contains any native-script character. English copy therefore remains undetected and `i18n:check` accepts the mixed-language message.

Check all literal text segments, both inside and outside ICU branches, for untranslated English copy even when they also contain native-script text.
</issue_to_address>

Sourcery assessment

Approval pending. 4 findings to address first.

Blocking findings: frontend/scripts/i18n-check.mjs:132, frontend/scripts/i18n-check.mjs:64, frontend/scripts/i18n-check.mjs:124, frontend/scripts/i18n-check.mjs:168


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines +131 to +132
if (translations.length > 1 && new Set(translations.map((t) => t[key])).size === 1) {
problems.push(`every locale: '${key}' is identical in every translation, so it is untranslated or stale`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Valid shared strings fail parity

When the parity check evaluates an intentionally shared key such as nav.brandName or notifications.channels.placeholders.emailAddress, the identical-translation check reports the key as untranslated or stale, including when the source and every translation use wardrowbe, so i18n:parity and i18n:check fail on valid locale data.

Exclude intentionally shared keys from the identical-translation check.

Prompt for AI agents
In `frontend/scripts/i18n-check.mjs` at lines 131-132:

**Valid shared strings fail parity**

When the parity check evaluates an intentionally shared key such as `nav.brandName` or `notifications.channels.placeholders.emailAddress`, the identical-translation check reports the key as untranslated or stale, including when the source and every translation use `wardrowbe`, so `i18n:parity` and `i18n:check` fail on valid locale data.

Exclude intentionally shared keys from the identical-translation check.

if (depth % 2 === 0) open.pop();
depth--;
} else if (depth > 0 && depth % 2 === 0) {
texts[open[open.length - 1]] += ch;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · CJK plural translations fail validation

When the parity check runs on the existing CJK ICU plural messages, branchTexts includes ICU selectors such as one and other in each branch’s text, so the CJK Latin-script check treats these required selector tokens as untranslated copy and fails the parity check on valid translations.

Exclude ICU branch selectors from the text returned by branchTexts before checking for Latin-script copy.

Prompt for AI agents
In `frontend/scripts/i18n-check.mjs` at line 64:

**CJK plural translations fail validation**

When the parity check runs on the existing CJK ICU plural messages, `branchTexts` includes ICU selectors such as `one` and `other` in each branch’s text, so the CJK Latin-script check treats these required selector tokens as untranslated copy and fails the parity check on valid translations.

Exclude ICU branch selectors from the text returned by `branchTexts` before checking for Latin-script copy.

for (const key of targetKeys) if (!sourceKeys.has(key)) problems.push(`${locale}: extra key '${key}' not in ${SOURCE_LOCALE}`);
}

const words = (value) => (typeof value === 'string' ? value.replace(/\{\w+\}/g, '') : '');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Numeric-only plurals fail checks

When a message consists only of a number-only ICU plural or another ICU-formatted argument with no translatable literal text, words() strips only simple {name} arguments, so a valid count-only ICU message such as {count, plural, one {#} other {#}} still contains Latin syntax words. The CJK check then rejects a translation that correctly renders only a number, causing i18n:check to fail.

Parse ICU messages and apply script checks only to their literal text, excluding argument syntax and format keywords.

Also at frontend/scripts/i18n-check.mjs:164-166.

Prompt for AI agents
In `frontend/scripts/i18n-check.mjs` at line 124:

**Numeric-only plurals fail checks**

When a message consists only of a number-only ICU plural or another ICU-formatted argument with no translatable literal text, `words()` strips only simple `{name}` arguments, so a valid count-only ICU message such as `{count, plural, one {#} other {#}}` still contains Latin syntax words. The CJK check then rejects a translation that correctly renders only a number, causing `i18n:check` to fail.

Parse ICU messages and apply script checks only to their literal text, excluding argument syntax and format keywords.

Also at `frontend/scripts/i18n-check.mjs:164-166`.

Comment on lines +165 to +168
if (!script.test(words(target[key]))) {
problems.push(`${locale}: '${key}' has no ${locale} text, so it is untranslated or stale`);
} else if (branchTexts(target[key]).some((t) => /\p{Script=Latin}/u.test(t) && !script.test(t))) {
problems.push(`${locale}: '${key}' has a plural or select branch with no ${locale} text`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · English copy passes CJK checks

When a CJK message mixes English with native-script text inside a branch or outside an ICU branch, branchTexts checks branch bodies but misses ordinary text outside branches, and the script checks pass when a segment contains any native-script character. English copy therefore remains undetected and i18n:check accepts the mixed-language message.

Check all literal text segments, both inside and outside ICU branches, for untranslated English copy even when they also contain native-script text.

Prompt for AI agents
In `frontend/scripts/i18n-check.mjs` at lines 165-168:

**English copy passes CJK checks**

When a CJK message mixes English with native-script text inside a branch or outside an ICU branch, `branchTexts` checks branch bodies but misses ordinary text outside branches, and the script checks pass when a segment contains any native-script character. English copy therefore remains undetected and `i18n:check` accepts the mixed-language message.

Check all literal text segments, both inside and outside ICU branches, for untranslated English copy even when they also contain native-script text.

@Anyesh
Anyesh merged commit c2dd4cf into main Nov 10, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant