Skip to content

fix(i18n): extract translateSearchKeyword calls so settings-search keywords reach en.json - #18040

Merged
OrcaWin merged 2 commits into
stablyai:mainfrom
imgusev:i18n-extract-search-keywords
Sep 3, 2026
Merged

OrcaWin merged 2 commits into
stablyai:mainfrom
imgusev:i18n-extract-search-keywords

Conversation

@imgusev

@imgusev imgusev commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Settings search keywords are declared through translateSearchKeyword(key, fallback), but neither the i18next extractor nor the catalog sync knew about that wrapper. So keys added through it never reached en.json, and no locale — built-in or language pack — could translate them.

What Changed

  • config/i18next.config.ts — added translateSearchKeyword to extract.functions, so verify:localization-extraction sees the wrapper's keys.
  • config/scripts/verify-localization-catalog.mjs — added it to LOCALIZATION_FUNCTION_NAMES, so sync:localization-catalog collects and bootstraps them. The two lists have to move together: the first one alone turns verify:localization-extraction red, because the extractor then finds keys the sync tool still cannot write.
  • src/renderer/src/i18n/locales/en.json — regenerated with pnpm run sync:localization-catalog: 154 keys added, 0 changed, 0 removed (155 at the time of opening; agentDashboard.dashboard has since landed in main).
  • config/scripts/verify-localization-catalog.test.mjs — a test that bootstraps a key referenced only through the wrapper.

The wrapper's signature is (key, fallback, options?), the same shape as translate, so both tools read it the same way they already read translateMain.

Why

Measured against v1.4.194:

  • translateSearchKeyword is called with 1 090 distinct keys. 935 were in en.json; 155 were not, and were therefore missing from ko, ja, zh and es as well. All of them are settings-search keywords (auto.components.settings.*.search.*) plus the keyword* entries under orcaAccount and artifacts.
  • The wrapper (src/renderer/src/components/settings/settings-search-keywords.ts) calls translate(key, fallback) internally, so the keys are fully localizable at runtime — they were just invisible to both tools.
  • verify-localization-extraction.mjs could not catch this on main: it compares the extracted catalog with en.json, and a key missing from both sides is not a mismatch. The 935 keys that were in en.json showed up as statically unreferenced orphans for the same reason.

A concrete example of what packs have to do in the meantime, and why it is fragile: mine supplements en.json by scanning the shipped bundle for those key/fallback pairs. Between 1.4.194 and 1.4.195 the bundle's minification changed — translate became a one-letter alias and the strings moved to template literals — and the scan silently returned nothing. Nothing in Orca broke; the pack just lost the 152 keys with no error to point at. Keys that live in en.json do not have that failure mode.

Verification

  • verify:localization-catalog — exit 0
  • verify:localization-extraction — exit 0 (with en.json reverted it fails on the 155 keys, as expected)
  • verify-localization-catalog.test.mjs — 8 passed, including the new case

On englishOnly keywords

11 of the 155 keys are called with englishOnly: true, so translate() is never reached for them and the en.json entries are inert. They still land in the catalog because both tools key off the first argument, same as any other call. Harmless, but if you would rather keep them out, an englishOnly check in collectLocalizationKeyReferences would do it — happy to add that here or in a follow-up.

Linked Issue

Part of #17913 — the third category discussed there.

Author: @imgusev with Claude

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: f6bf6f46-042e-4c79-8a7e-9d1781eecf14

📥 Commits

Reviewing files that changed from the base of the PR and between 67e2234 and 0631764.

📒 Files selected for processing (4)
  • config/i18next.config.ts
  • config/scripts/verify-localization-catalog.mjs
  • config/scripts/verify-localization-catalog.test.mjs
  • src/renderer/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • config/scripts/verify-localization-catalog.mjs
  • config/i18next.config.ts
  • config/scripts/verify-localization-catalog.test.mjs
  • src/renderer/src/i18n/locales/en.json

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The localization extractor and catalog verifier now recognize translateSearchKeyword. A test verifies that this function bootstraps missing English catalog keys. The English catalog adds search keyword entries across settings, providers, worktrees, terminals, agents, skills, and sharing features.

Merge Risk: ⚪ Minimal · up to 06317

This change makes settings-search keyword references available to localization extraction and adds the corresponding English catalog entries. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
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.
Title check ✅ Passed The title clearly and concisely describes the primary change: extracting translateSearchKeyword calls so settings-search keywords reach en.json.
Description check ✅ Passed The description is mostly complete. It explains the problem, changes, rationale, linked issue, test results, and AI usage. It omits several template sections, including explicit Visual Proof N/A, Revi…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The description is mostly complete. It explains the problem, changes, rationale, linked issue, test results, and AI usage. It omits several template sections, including explicit Visual Proof N/A, Review, Agent skill upstream boundary, Notes, and the checklist, but these omissions do not prevent understanding the focused change.


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.

@imgusev
imgusev force-pushed the i18n-extract-search-keywords branch from 57aa803 to 45cb99e Compare September 2, 2026 00:57

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

This PR cannot merge as-is: it leaves the verify:localization-extraction CI step red, and it does not actually make the missing keys reach en.json.

Reviewed changes

  • config/i18next.config.ts — adds translateSearchKeyword to the i18next-cli extract.functions list so the extractor surfaces keys only referenced through the settings-search wrapper.

⚠️ The catalog sync path still cannot see these keys

Adding translateSearchKeyword to extract.functions only teaches the i18next-cli extractor about the wrapper. The command that actually writes missing keys into en.json — pnpm run sync:localization-catalog, i.e. config/scripts/verify-localization-catalog.mjs --fix — uses its own AST-based collector with a separate hardcoded set, LOCALIZATION_FUNCTION_NAMES = new Set(['t', 'translate', 'translateMain']) at config/scripts/verify-localization-catalog.mjs:14. That set does not include translateSearchKeyword, so the --fix path will not collect any of the 155 missing settings-search keys and will never add them to en.json.

The PR body's claim that "the next catalog sync writes them into en.json" is therefore not met by this change alone. The two function-name lists must be updated together, or the keys stay invisible to the one tool that bootstraps en.json.

Technical details
# Sync path misses translateSearchKeyword keys

## Affected sites
- config/scripts/verify-localization-catalog.mjs:14 — `LOCALIZATION_FUNCTION_NAMES` lacks `translateSearchKeyword`, so `collectLocalizationKeyReferences` (line 90) ignores every `translateSearchKeyword(key, fallback)` call and `--fix` never bootstraps them.
- config/scripts/verify-localization-catalog.test.mjs — fixtures use only `translate`; no test exercises the wrapper, so this gap is not covered.

## Required outcome
- Add `translateSearchKeyword` to `LOCALIZATION_FUNCTION_NAMES` in `verify-localization-catalog.mjs` so `sync:localization-catalog` collects and bootstraps the wrapper's string-literal keys.
- Regenerate `src/renderer/src/i18n/locales/en.json` in this same PR so both `verify:localization-catalog` and `verify:localization-extraction` pass on the branch.

## Open questions for the human
- Do the `englishOnly` keywords (brand/acronym aliases) belong in `en.json` at all, given their fallback is meant to stay exact English? They will still be extracted as first-arg keys.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread config/i18next.config.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new code changes since the prior review — the head moved from 57aa803 to 45cb99e, but the diff is byte-identical.

Reviewed changes

  • Commit message only — the commit body was expanded with the "155 of 1 090 keys" summary and the verify-localization-extraction blind-spot note. The one-line extract.functions change is unchanged.

The two findings from the prior review still stand and are unresolved: the verify:localization-extraction CI step will stay red until en.json is regenerated in this PR, and LOCALIZATION_FUNCTION_NAMES in config/scripts/verify-localization-catalog.mjs:14 still needs translateSearchKeyword added before sync:localization-catalog can bootstrap the 155 missing keys.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@imgusev

imgusev commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Both findings were right — thanks. Addressed in 311aafb4:

  • translateSearchKeyword is now in LOCALIZATION_FUNCTION_NAMES in verify-localization-catalog.mjs as well, so sync:localization-catalog collects the wrapper's keys.
  • en.json regenerated with --fix: 155 keys added, 0 existing values changed, 0 removed.
  • Added a test that bootstraps a key referenced only through the wrapper (8/8 pass).

Checked locally: verify:localization-catalog and verify:localization-extraction both exit 0 on the branch; with en.json reverted the extraction check fails on exactly the 155 keys, which is the red step you predicted.

On the englishOnly question: 11 of the 155 are called with englishOnly: true. Their en.json entries are inert (the wrapper returns before translate()), but they are keyed off the first argument like everything else, so they land in the catalog. Left as is for now — it matches how the 935 existing wrapper keys behave — but a skip for englishOnly in collectLocalizationKeyReferences is a small change if the maintainers prefer it.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Catalog sync now collects translateSearchKeyword — added the wrapper to LOCALIZATION_FUNCTION_NAMES in config/scripts/verify-localization-catalog.mjs, so sync:localization-catalog bootstraps the 155 previously-invisible keys.
  • Regenerated en.json — 155 settings-search keys added (0 changed, 0 removed) via sync:localization-catalog, resolving the verify:localization-extraction CI break.
  • Added test coverage — a new case verifies keys referenced only through translateSearchKeyword are bootstrapped into en.json.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

imgusev and others added 2 commits September 3, 2026 15:24
Settings search keywords are declared through translateSearchKeyword(key,
fallback), but extract.functions only listed t, translate and translateMain.
Keys added through the wrapper never reached en.json: on v1.4.194 that is
155 of the 1 090 keys it is called with, missing from every locale.

verify-localization-extraction cannot see it — a key absent from both the
extraction and en.json is not a mismatch.

Author: @imgusev with Claude
The extractor and the catalog sync keep separate function lists, and
adding the wrapper to only one of them leaves the keys unreachable for
the tool that writes en.json and turns verify:localization-extraction
red on the branch.

- verify-localization-catalog.mjs: add translateSearchKeyword to
  LOCALIZATION_FUNCTION_NAMES so `sync:localization-catalog` collects
  the wrapper's keys
- en.json: regenerated with `--fix` — 154 keys added, none changed
  or removed
- test: bootstrap of a key referenced only through the wrapper

Author: @imgusev with Claude
@imgusev
imgusev force-pushed the i18n-extract-search-keywords branch from 311aafb to 0631764 Compare September 3, 2026 12:28
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@imgusev

imgusev commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (67e2234) to resolve the en.json conflict. en.json was taken from main and regenerated with pnpm run sync:localization-catalog: 154 keys added, 0 changed, 0 removed — one fewer than before because auto.components.settings.experimental.search.agentDashboard.dashboard has landed in main in the meantime. verify:localization-catalog and verify:localization-extraction exit 0, the test file passes 8/8. The two config changes are unchanged.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Rebased onto newer main — agentDashboard.dashboard had already landed on main, so the en.json regeneration now adds 154 keys rather than 155 and no longer touches that key (it appears as context with a trailing-comma change).
  • Split into two commits — the extractor change (i18next.config.ts) and the catalog sync (LOCALIZATION_FUNCTION_NAMES + en.json + test) are now separate commits.

The tooling logic is byte-for-byte equivalent to the previously approved head; only the catalog delta shifted because of the dashboard key moving to main. Ran verify-localization-catalog.test.mjs (8 passed) and confirmed en.json is valid JSON.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin merged commit 8262fb1 into stablyai:main Sep 3, 2026
1 check passed
imgusev pushed a commit to imgusev/orca-plugin-ru that referenced this pull request Sep 8, 2026
Каталог: 13 910 из 14 099 строк (98%). Приложение добавило 121 ключ,
убрало два и переписало текст у семи — переведены все новые.

Крупное новое: передача сессии между чатом и терминалом агента, фоновые
задачи во встроенном чате, дорожная карта проектов GitHub, экран
восстановления после сбоя окна, разделение чата в быстрых действиях,
подсказки тем на онбординге, французский в списке языков.

Добор ключей из app.asar стал нулевым: с 1.4.198 ключи поиска по
настройкам приходят через en.json после слияния stablyai/orca#18040.
Разбор бандла оставлен как страховка, README и докстринг extract.py
переписаны под это.

Author: @imgusev with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants