Skip to content

fix(i18n): localize ChatGPT OAuth strings in onboarding ApiKeysStep#2975

Open
obchain wants to merge 1 commit into
tinyhumansai:mainfrom
obchain:fix/apikeys-step-i18n
Open

fix(i18n): localize ChatGPT OAuth strings in onboarding ApiKeysStep#2975
obchain wants to merge 1 commit into
tinyhumansai:mainfrom
obchain:fix/apikeys-step-i18n

Conversation

@obchain
Copy link
Copy Markdown
Contributor

@obchain obchain commented May 29, 2026

Summary

  • Localizes seven hard-coded English strings in the onboarding ChatGPT-OAuth flow (ApiKeysStep.tsx): the connect / connected / callback-hint labels (previously module-level consts) and the four setError messages, all of which bypassed i18n.
  • Routes them through useT() with new onboarding.apiKeys.* keys, matching the t() pattern the rest of the step already uses (14 existing calls).

Problem

app/src/pages/onboarding/steps/ApiKeysStep.tsx rendered the ChatGPT-sign-in button label, the connected badge, the callback hint, and four OAuth error messages from hard-coded English literals:

const OPENAI_OAUTH_CONNECTED_LABEL = 'Connected with ChatGPT';
const OPENAI_OAUTH_CONNECT_LABEL = 'Sign in with ChatGPT';
const OPENAI_OAUTH_CALLBACK_HINT = 'After signing in, paste the full redirect URL …';
// …
setError('ChatGPT sign-in is only available in the desktop app.');
setError('Could not start ChatGPT sign-in. Try again or use an API key.');
setError('Paste the redirect URL from your browser after signing in.');
setError('ChatGPT sign-in did not complete. Check the redirect URL and try again.');

This violates the repo i18n rule (every user-visible string in app/src/** must go through useT()), so a non-English user hits English text throughout the onboarding ChatGPT-connect path.

Solution

  • Removed the three label consts; render their text via t('onboarding.apiKeys.openaiOauthConnect' | 'openaiOauthConnected' | 'openaiOauthCallbackHint').
  • Replaced the four setError(...) literals with t('onboarding.apiKeys.oauthDesktopOnly' | 'oauthStartFailed' | 'oauthPasteRedirect' | 'oauthCompleteFailed').
  • Kept the technical URL placeholder const (OPENAI_OAUTH_CALLBACK_PLACEHOLDER) as-is — it is a non-display technical sentinel, exempt from i18n.
  • Added the seven keys to en.ts and every locale chunk. English values are unchanged, so the existing test assertions still match.

Verification

  • pnpm typecheck — clean.
  • pnpm exec eslint — 0 errors on the changed file (one pre-existing set-state-in-effect warning, unrelated to these lines).
  • pnpm i18n:check — parity clean across all locales.
  • Vitest ApiKeysStep.test.tsx — 7 passed; the existing OAuth tests already assert each of the seven strings (connected badge, connect click, desktop-only / start-failed / paste-redirect / complete-failed errors), so they exercise every changed line.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — existing OAuth tests cover all changed lines incl. the four error paths.
  • Diff coverage >= 80% — every changed line is exercised by the existing ApiKeysStep.test.tsx OAuth suite.
  • Coverage matrix updated — N/A: behaviour-preserving i18n change, no feature leaf added/removed/renamed.
  • All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A.
  • No new external network dependencies introduced (mock backend used per Testing Strategy) — string-only change.
  • Manual smoke checklist updated if this touches release-cut surfaces (docs/RELEASE-MANUAL-SMOKE.md) — N/A: no release-cut surface.
  • Linked issue closed via Closes #NNN in the ## Related section — N/A: i18n rule-violation fix, no tracking issue.

Impact

  • Runtime/platform: desktop onboarding (all OSes). No mobile/web/CLI change.
  • Performance / security / migration: none — string-only.
  • Compatibility: non-English locales fall back to English for the new keys until translated; English behaviour unchanged.

Related

  • Closes: N/A — i18n compliance fix (CLAUDE.md i18n rule), no tracking issue.
  • Follow-up PR(s)/TODOs: locale translations for the seven new onboarding.apiKeys.* keys (ship as English placeholders).

AI Authored PR Metadata (required for Codex/Linear PRs)

Keep this section for AI-authored PRs. For human-only PRs, mark each field N/A.

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/apikeys-step-i18n
  • Commit SHA: 6a5ed7d9c8993ff43f2a6a950857ddaf9521d713

Validation Run

  • pnpm --filter openhuman-app format:check — Prettier clean on touched files.
  • pnpm typecheck — clean.
  • Focused tests: vitest run ApiKeysStep.test.tsx → 7 passed.
  • Rust fmt/check (if changed): N/A — no Rust changed.
  • Tauri fmt/check (if changed): N/A — no app/src-tauri/ changed.

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: ChatGPT-OAuth onboarding strings are now localizable.
  • User-visible effect: non-English users get translated (initially English-fallback) text instead of always-English literals.

Parity Contract

  • Legacy behavior preserved: English wording unchanged; same render/error flow.
  • Guard/fallback/dispatch parity checks: label/error mapping is identical, now via t(); the URL placeholder remains a literal sentinel.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none.
  • Canonical PR: this one.
  • Resolution: N/A.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added ChatGPT OAuth sign-in option during onboarding for API keys setup, including connection status indicators and redirect URL guidance.
  • Documentation

    • Extended multi-language support with translations for the new sign-in flow across 14 languages.

Review Change Stack

The ChatGPT sign-in button/connected/hint labels and four OAuth error
messages were hard-coded English (module consts + inline setError),
so non-English users saw untranslated onboarding text. Route them
through useT() with onboarding.apiKeys.* keys, matching the t()
pattern the rest of the step already uses.
@obchain obchain requested a review from a team May 29, 2026 18:37
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 507562c3-18bf-4d67-9fdf-4d4ee3d4fd53

📥 Commits

Reviewing files that changed from the base of the PR and between f895013 and 6a5ed7d.

📒 Files selected for processing (16)
  • app/src/lib/i18n/chunks/ar-5.ts
  • app/src/lib/i18n/chunks/bn-5.ts
  • app/src/lib/i18n/chunks/de-5.ts
  • app/src/lib/i18n/chunks/en-5.ts
  • app/src/lib/i18n/chunks/es-5.ts
  • app/src/lib/i18n/chunks/fr-5.ts
  • app/src/lib/i18n/chunks/hi-5.ts
  • app/src/lib/i18n/chunks/id-5.ts
  • app/src/lib/i18n/chunks/it-5.ts
  • app/src/lib/i18n/chunks/ko-5.ts
  • app/src/lib/i18n/chunks/pl-5.ts
  • app/src/lib/i18n/chunks/pt-5.ts
  • app/src/lib/i18n/chunks/ru-5.ts
  • app/src/lib/i18n/chunks/zh-CN-5.ts
  • app/src/lib/i18n/en.ts
  • app/src/pages/onboarding/steps/ApiKeysStep.tsx

📝 Walkthrough

Walkthrough

This PR adds internationalization support for the ChatGPT OAuth sign-in flow. Translation keys for OAuth-related messages (connect/connected labels, desktop-only restrictions, redirect URL instructions, and error messages) are defined in the base English translation file and across twelve additional language chunks, then the ApiKeysStep component is updated to reference these i18n keys instead of hardcoded strings.

Changes

ChatGPT OAuth i18n Integration

Layer / File(s) Summary
English translation definitions
app/src/lib/i18n/en.ts, app/src/lib/i18n/chunks/en-5.ts
Base English translations for ChatGPT OAuth flow are added, covering connect/connected states, redirect URL callback hints, desktop-only availability notes, and OAuth start/paste/complete failure messages.
Localized OAuth translation keys
app/src/lib/i18n/chunks/ar-5.ts, app/src/lib/i18n/chunks/bn-5.ts, app/src/lib/i18n/chunks/de-5.ts, app/src/lib/i18n/chunks/es-5.ts, app/src/lib/i18n/chunks/fr-5.ts, app/src/lib/i18n/chunks/hi-5.ts, app/src/lib/i18n/chunks/id-5.ts, app/src/lib/i18n/chunks/it-5.ts, app/src/lib/i18n/chunks/ko-5.ts, app/src/lib/i18n/chunks/pl-5.ts, app/src/lib/i18n/chunks/pt-5.ts, app/src/lib/i18n/chunks/ru-5.ts, app/src/lib/i18n/chunks/zh-CN-5.ts
ChatGPT OAuth translation keys are added to language-specific chunks. Most language files currently contain English values pending native translation.
Component i18n integration
app/src/pages/onboarding/steps/ApiKeysStep.tsx
OAuth error handling and UI labels are updated to use i18n key references (t('onboarding.apiKeys.*')) instead of hardcoded strings. Changes affect desktop-only validation, OAuth flow start/completion error messages, connected state labels, and redirect callback hint text.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • tinyhumansai/openhuman#2378: Adds/registers the German (de) locale including app/src/lib/i18n/chunks/de-5.ts, which this PR extends with new ChatGPT OAuth translation keys.
  • tinyhumansai/openhuman#2731: Creates the Polish (pl) locale and Polish chunk file pl-5.ts, which this PR enhances with new onboarding.apiKeys.* OAuth keys.
  • tinyhumansai/openhuman#1981: Completes Simplified Chinese onboarding translations and adds testing to ensure all locales include the same keys as English, relevant to this PR's multi-language key additions.

Suggested labels

working

Suggested reviewers

  • graycyrus
  • M3gA-Mind
  • oxoxDev

Poem

🐰 A rabbit hops through languages wide,
Teaching OAuth with multilingual pride,
Keys translated, from Arabic to Zen,
Each locale sings the ChatGPT refrain again! 🗝️

🚥 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 specifically summarizes the main change: localizing ChatGPT OAuth strings in the onboarding ApiKeysStep by moving them to the i18n system.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 and usage tips.

@coderabbitai coderabbitai Bot added the working A PR that is being worked on by the team. label May 29, 2026
@sanil-23 sanil-23 self-assigned this May 29, 2026
Copy link
Copy Markdown
Contributor

@oxoxDev oxoxDev left a comment

Choose a reason for hiding this comment

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

LGTM — i18n cleanup for the ChatGPT OAuth onboarding step. Hardcoded label/hint/error constants in ApiKeysStep replaced with t() lookups, keys added to en.ts + chunks. No behavior change. Approving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

working A PR that is being worked on by the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants