Skip to content

feat(i18n): expand locale coverage from 8 to 20 languages#64

Merged
hieuck merged 6 commits into
mainfrom
feat/i18n-expansion-phase1
Jul 8, 2026
Merged

feat(i18n): expand locale coverage from 8 to 20 languages#64
hieuck merged 6 commits into
mainfrom
feat/i18n-expansion-phase1

Conversation

@hieuck

@hieuck hieuck commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Description

Expand KeePass Browser Bridge locale coverage from 8 to 20 languages (Phase 1), matching Kee.

Changes

  • Add scripts/validate-locales.mjs to validate all _locales/<lang>/messages.json files against English.
  • Add tests/unit/locales.test.mjs to run the validator in the Vitest suite.
  • Add 12 new locale files: pt_BR, ru, it, pl, nl, tr, ar, th, id, sv, cs, uk.
  • Keep existing chrome.i18n / browser.i18n wrapper unchanged.

Motivation

Kee supports ~20 locales while KBB only had 8. This change closes the i18n gap with Kee and lays the validator foundation for Phase 2 (45 locales to match KeePassXC-Browser).

Testing

  • npm test passes (1025 tests, 78 files)
  • npm run lint passes (0 errors, 0 warnings)
  • npx vitest run tests/unit/locales.test.mjs passes
  • New locales validated for key consistency against English

Browser / Plugin Impact

  • Chrome MV3 extension
  • Firefox extension
  • KeePass C# plugin / bridge protocol
  • No runtime impact (docs, build, repo hygiene only)

Security & Compatibility

  • No secrets, credentials, or private keys committed
  • Passkeys / WebAuthn behavior unchanged
  • Backward compatible with existing KeePass plugin versions

Summary by CodeRabbit

  • New Features

    • Expanded language support with 12 new translations, increasing the extension’s available locales to 20.
    • Added Arabic, Czech, Indonesian, Italian, Dutch, Polish, Portuguese (Brazil), Russian, Swedish, Thai, Turkish, and Ukrainian UI strings.
  • Bug Fixes

    • Added automated checks to keep translations consistent and catch missing or extra text before release.
    • Added a test to verify locale validation runs successfully.

@github-actions github-actions Bot added documentation Improvements or additions to documentation extension tests build labels Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@hieuck, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 34ec3317-5f02-474b-869d-afd6d82dbf0c

📥 Commits

Reviewing files that changed from the base of the PR and between 000d93a and f1804d0.

📒 Files selected for processing (3)
  • scripts/validate-locales.mjs
  • tests/unit/i18n.test.mjs
  • tests/unit/locales.test.mjs
📝 Walkthrough

Walkthrough

This PR expands locale support for the KeePass Browser Bridge extension by adding 12 new messages.json locale files (pt_BR, ru, it, pl, nl, tr, ar, th, id, sv, cs, uk), a Node.js validator script checking key parity against English, a Vitest test running the validator, and supporting plan/design documents.

Changes

i18n Expansion Phase 1

Layer / File(s) Summary
Planning and design documentation
docs/superpowers/plans/2026-07-08-i18n-expansion-phase1.md, docs/superpowers/specs/2026-07-08-i18n-expansion-design.md
Documents the phased locale expansion plan, tasks, workflow, and design constraints including validator and test requirements.
Locale validator script and test
scripts/validate-locales.mjs, tests/unit/locales.test.mjs
Adds a script that loads English messages, compares each locale's key set for missing/extra keys, exits non-zero on mismatch, and a Vitest test that runs it via execSync.
New locale message files
extension/_locales/{pt_BR,ru,it,pl,nl,tr,ar,th,id,sv,cs,uk}/messages.json
Adds translated UI message strings for 12 new locales, keeping keys consistent with English.

Estimated code review effort: 2 (Simple) | ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: expanding i18n locale coverage from 8 to 20 languages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/i18n-expansion-phase1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
scripts/validate-locales.mjs (1)

10-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Validator only checks key parity, not message structure.

The validator confirms that locale keys match English keys but doesn't verify that each entry contains a non-empty message property. A malformed entry like "appName": {} or "appName": { "foo": "bar" } would pass validation silently, potentially causing chrome.i18n.getMessage() to return empty strings at runtime.

Consider enhancing the validator to check that each value is an object with a non-empty message string property.

♻️ Proposed enhancement to validate message structure
 function getKeys(obj) {
   return Object.keys(obj).sort();
 }

+function validateMessages(obj, locale) {
+  const errors = [];
+  for (const [key, value] of Object.entries(obj)) {
+    if (typeof value !== "object" || value === null) {
+      errors.push(`${key}: expected an object`);
+    } else if (typeof value.message !== "string" || value.message.length === 0) {
+      errors.push(`${key}: missing or empty "message" property`);
+    }
+  }
+  return errors;
+}
+

Then inside the loop, after loading data:

     const keys = getKeys(data);
+    const structErrors = validateMessages(data, locale);
+    if (structErrors.length > 0) {
+      console.error(`Locale ${locale} has invalid entries:\n  ${structErrors.join("\n  ")}`);
+      hasError = true;
+    }
     const missing = englishKeys.filter((k) => !keys.includes(k));

Also applies to: 46-57

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/validate-locales.mjs` around lines 10 - 17, The locale validator
currently only compares key sets and can miss malformed entries that lack a
valid message payload. Update the validation logic in validate-locales.mjs,
especially around loadJson and the loop that compares locale data, to also
assert each locale value is an object with a non-empty message string property.
Make sure the existing parity check still runs, but extend it so entries like
empty objects or objects with unrelated fields fail validation instead of
passing silently.
tests/unit/locales.test.mjs (1)

6-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using import.meta.url for path resolution and stdio: "inherit" for error visibility.

process.cwd() assumes the test is always run from the project root. If the working directory differs, the test fails with a confusing file-not-found error. Using import.meta.url makes the path resolution independent of the working directory. Additionally, stdio: "inherit" would display the validator's error output inline on failure, making debugging easier.

♻️ Proposed improvements
 import { describe, test, expect } from "vitest";
 import { execSync } from "node:child_process";
-import path from "node:path";
-import process from "node:process";
+import path from "node:path";
+import { fileURLToPath } from "node:url";

-const scriptPath = path.resolve(process.cwd(), "scripts", "validate-locales.mjs");
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const scriptPath = path.resolve(__dirname, "..", "..", "scripts", "validate-locales.mjs");

 describe("locale validation", () => {
   test("all locale files are valid and consistent", () => {
     expect(() =>
-      execSync(`node "${scriptPath}"`, { stdio: "pipe" }),
+      execSync(`node "${scriptPath}"`, { stdio: "inherit" }),
     ).not.toThrow();
   });
 });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/locales.test.mjs` around lines 6 - 12, The locale validation test
is resolving the validator script from process.cwd(), which makes it dependent
on the current working directory and hides useful failures. Update the path
construction in locales.test.mjs to resolve the script relative to the test
module using import.meta.url, and change the execSync call in the "all locale
files are valid and consistent" test to use stdio: "inherit" so validator errors
are shown directly when the test fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/validate-locales.mjs`:
- Around line 10-17: The locale validator currently only compares key sets and
can miss malformed entries that lack a valid message payload. Update the
validation logic in validate-locales.mjs, especially around loadJson and the
loop that compares locale data, to also assert each locale value is an object
with a non-empty message string property. Make sure the existing parity check
still runs, but extend it so entries like empty objects or objects with
unrelated fields fail validation instead of passing silently.

In `@tests/unit/locales.test.mjs`:
- Around line 6-12: The locale validation test is resolving the validator script
from process.cwd(), which makes it dependent on the current working directory
and hides useful failures. Update the path construction in locales.test.mjs to
resolve the script relative to the test module using import.meta.url, and change
the execSync call in the "all locale files are valid and consistent" test to use
stdio: "inherit" so validator errors are shown directly when the test fails.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 63de00e0-6f32-4d94-849e-e65d7eecab86

📥 Commits

Reviewing files that changed from the base of the PR and between 74c00db and 000d93a.

📒 Files selected for processing (16)
  • docs/superpowers/plans/2026-07-08-i18n-expansion-phase1.md
  • docs/superpowers/specs/2026-07-08-i18n-expansion-design.md
  • extension/_locales/ar/messages.json
  • extension/_locales/cs/messages.json
  • extension/_locales/id/messages.json
  • extension/_locales/it/messages.json
  • extension/_locales/nl/messages.json
  • extension/_locales/pl/messages.json
  • extension/_locales/pt_BR/messages.json
  • extension/_locales/ru/messages.json
  • extension/_locales/sv/messages.json
  • extension/_locales/th/messages.json
  • extension/_locales/tr/messages.json
  • extension/_locales/uk/messages.json
  • scripts/validate-locales.mjs
  • tests/unit/locales.test.mjs

Lê Trung Hiếu and others added 2 commits July 8, 2026 22:15
Co-Authored-By: Kimchi <noreply@kimchi.dev>
Co-Authored-By: Kimchi <noreply@kimchi.dev>
@hieuck hieuck merged commit f0607a7 into main Jul 8, 2026
18 checks passed
@hieuck hieuck deleted the feat/i18n-expansion-phase1 branch July 8, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build documentation Improvements or additions to documentation extension tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant