Skip to content

Wire hardcoded frontend strings into locale system#187

Merged
Finesssee merged 2 commits into
nesszer:mainfrom
SnowfallC:pr/i18n-wire-hardcoded-strings
Jul 13, 2026
Merged

Wire hardcoded frontend strings into locale system#187
Finesssee merged 2 commits into
nesszer:mainfrom
SnowfallC:pr/i18n-wire-hardcoded-strings

Conversation

@SnowfallC

Copy link
Copy Markdown

Summary

Several frontend components rendered English UI text directly instead of going through t(), bypassing the existing i18n system. Most were pre-i18n codepaths (CookiesTab, ApiKeySection) or surfaces that were never migrated (floatbar/SettingsSection, AboutTab update flow, OpenAiExtras).

This wires all of them into the existing t(key) mechanism. No new i18n architecture — it reuses the current key-in-Rust / strings-in-.ftl design.

What changed

  • Added ~70 new LocaleKey variants (synced across rust/src/locale.rs, keys.ts, and en-US.ftl).
  • Replaced hardcoded string literals with t(...) calls in 17 components, including: floatbar/SettingsSection, AboutTab, CookiesTab, ApiKeySection/ApiKeysTab, OpenAiExtras, GeneralTab (refresh-cadence options + provider display names), Settings, App, PopOutTitleBar, ProvidersSidebar, ProvidersTab, TokenAccountsPanel, IdentitySection/MenuCard, PaceDetailsChart/MiniBarChart (added optional t prop), AgentSessions.
  • Many strings reuse already-existing keys (Save, Cancel, Version, KeySet, BrowserCookieSave, etc.) that were simply not wired up.
  • Updated affected test assertions to match key-name resolution.

Notes

  • New keys beyond English fall back via Fluent (this PR only fills en-US.ftl; non-English translations are in a follow-up PR).
  • Brand names / technical terms (OAuth, API, Cookie, GitHub, Codex/Claude) kept as-is per the existing convention.

Verification

```
pnpm --dir apps/desktop-tauri run check-locale # 668 keys match Rust ↔ TS
pnpm --dir apps/desktop-tauri exec tsc --noEmit # 0 errors
pnpm --dir apps/desktop-tauri test # 152/152 passed
cargo test --manifest-path rust/Cargo.toml
cargo fmt --all
```

No CUA Driver capture available in my environment; validated by launching `tauri dev` and confirming previously-English surfaces now resolve through the locale bundle. Happy to add screenshots if helpful.

Several components rendered English UI text directly instead of going through t(), bypassing the existing i18n system. Most were pre-i18n codepaths (CookiesTab, ApiKeySection) or surfaces never migrated (floatbar/SettingsSection, AboutTab update flow, OpenAiExtras).

- Add ~70 new LocaleKey variants (synced across locale.rs, keys.ts, en-US.ftl)

- Replace hardcoded literals with t() in 17 components

- Many strings reuse already-existing keys that were simply not wired up

- Update affected test assertions
@Finesssee

Copy link
Copy Markdown
Collaborator

Thanks for the PR, I will review it ASAP

@Finesssee

Copy link
Copy Markdown
Collaborator

Follow-up validation at the current head (8a17e63): the previously reported issues are not fixed yet.

cargo test --manifest-path rust/Cargo.toml locale --quiet still fails: 13 passed, 1 failed, with missing Fluent key FloatBarSectionTitle in zh-CN.

Before merging, please address:

  • Add all newly introduced Fluent keys to every supported locale (or deliberately revise the completeness contract).
  • Pass the provider argument to OpenProviderDashboard in both API-key views; otherwise the UI renders Open {} Dashboard.
  • Replace the API-key timestamp's reuse of the generic Saved translation.
  • Preserve whitespace around the inline CodexBar link in the About footer.
  • Make chart translation required or obtain it internally so No data, ARIA labels, and credits cannot silently remain English.

Copy link
Copy Markdown
Author

Thanks for the detailed validation. I addressed each item at the current head:

  • Revised the locale completeness contract deliberately: en-US remains the required source of truth for every LocaleKey, while incomplete non-English resources use Fluent's configured English fallback. The test still rejects unknown Fluent keys, requires all 668 keys in en-US, and verifies that every supported language resolves every key to non-empty text.
  • Passed the provider display name into OpenProviderDashboard in both API-key views, so the placeholder no longer renders as {}.
  • Replaced the API-key timestamp's reuse of the shortcut-specific Saved string with LastUpdated.
  • Preserved spacing around the inline CodexBar link in the About footer.
  • Made chart translation required and removed the silent English fallbacks for empty states, ARIA labels, and pace-chart legends.

Validation:

  • cargo test --manifest-path rust/Cargo.toml --quiet — 587 passed
  • cargo test --manifest-path rust/Cargo.toml locale --quiet — 14 passed
  • pnpm --dir apps/desktop-tauri run check-locale — 668 keys match
  • pnpm --dir apps/desktop-tauri exec tsc --noEmit — passed
  • pnpm --dir apps/desktop-tauri test — 152 passed
  • cargo fmt --all -- --check and git diff --check — passed

@Finesssee
Finesssee merged commit 4ca0ba7 into nesszer:main Jul 13, 2026
2 checks passed
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