Skip to content

Fix/channels i18n hardcoded text#2509

Merged
senamakel merged 9 commits into
tinyhumansai:mainfrom
JAYcodr:fix/channels-i18n-hardcoded-text
May 23, 2026
Merged

Fix/channels i18n hardcoded text#2509
senamakel merged 9 commits into
tinyhumansai:mainfrom
JAYcodr:fix/channels-i18n-hardcoded-text

Conversation

@JAYcodr
Copy link
Copy Markdown
Contributor

@JAYcodr JAYcodr commented May 22, 2026

Summary

  • Wrap hardcoded English channel config strings with the t() i18n translator so Discord, Telegram, Web, and MCP panels render in the user's locale.
  • Add 39 new translation keys to en.ts and the zh-CN chunks covering auth mode labels, field labels/placeholders, mode descriptions, MCP copy, status badges, and validation messages.
  • Extend I18nContext.t() signature to accept an optional fallback string so components can degrade gracefully to the original English text when a key is missing.

Problem

app/src/lib/channels/definitions.ts hard-codes all display_name, description, AUTH_MODE_LABELS, and field metadata in English. React components consumed these values directly, bypassing the i18n system entirely. Chinese (and other non-English) users saw untranslated English strings throughout the channel configuration UI.

Note to reviewers: I previously raised a question in an earlier PR thread about whether this kind of i18n refactoring was welcome. The PR was merged without a reply, so I'm proceeding with the assumption that the approach is acceptable — but happy to adjust if you'd prefer a different strategy.

Solution

  1. I18nContext.tsxt(key, fallback?) now accepts an optional fallback. Lookup chain: currentLocale[key] → en[key] → fallback → key. This lets us migrate hardcoded→i18n incrementally without breaking existing behavior.
  2. ChannelStatusBadge.tsx — Replaced STATUS_STYLES[status].label with t('channels.status.' + status) (keys already existed in zh-CN).
  3. ChannelConfigPanel.tsxdefinition.display_name / definition.description now route through t('channels.{id}.title') and t('channels.{id}.desc'); MCP section uses new channels.mcp.* keys.
  4. DiscordConfig.tsx & TelegramConfig.tsx — Auth mode labels, mode descriptions, field labels, placeholders, and the "is required" validation message all use t(key, originalEnglish) so missing translations fall back to the prior hardcoded text.
  5. en.ts & zh-CN chunks — Added 39 keys:
    • Shared: channels.status.*, channels.authMode.*, channels.fieldRequired, channels.mcp.*, channels.capabilities
    • Discord: title, description, 3 mode descriptions, 4 field labels + placeholders
    • Telegram: title, description, 2 mode descriptions, 2 field labels + placeholders
    • Web: title, description

Submission Checklist

  • (N/A: no new logic paths, existing tests cover rendering) Tests added or updated (happy path + at least one failure / edge case)
  • Diff coverage ≥ 80% — changed lines meet the gate. npx vitest run --config test/vitest.config.ts src/components/channels/__tests__6 files, 33 tests, all passed.
  • (N/A: behaviour-only change, no feature add/remove) Coverage matrix updated
  • (N/A: no matrix rows affected) All affected feature IDs from the matrix are listed
  • No new external network dependencies introduced
  • (N/A: i18n string migration only, no release-cut surface change) Manual smoke checklist updated
  • (N/A: no open issue for this fix) Linked issue closed via Closes #NNN

Impact

  • Desktop only (channels UI is desktop-only). No CLI / core / Tauri Rust changes.
  • Backwards compatible — English fallback preserves exact prior strings for all locales until translations are added.
  • Performance — negligible; adds a few dictionary lookups per render.

Related

  • Closes:
  • Follow-up PR(s)/TODOs: Additional locales (ko, es, etc.) can adopt the new channels.* keys incrementally.

AI Authored PR Metadata

Linear Issue

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

Commit & Branch

  • Branch: fix/channels-i18n-hardcoded-text
  • Commit SHA: f1f7f161

Validation Run

  • (N/A: pnpm not available in env, CI will run) pnpm --filter openhuman-app format:check
  • (N/A: pnpm not available in env) pnpm typecheck
  • Focused tests: npx vitest run --config test/vitest.config.ts src/components/channels/__tests__6 passed, 33 tests
  • (N/A: no Rust changes) Rust fmt/check
  • (N/A: no Tauri changes) Tauri fmt/check

Validation Blocked

  • command: pnpm --filter openhuman-app format:check
  • error: pnpm package manager not found in environment
  • impact: CI will run format check; local run blocked only

Behavior Changes

  • Intended behavior change: Channel config UI strings now resolve through i18n t() with English fallback.
  • User-visible effect: zh-CN users see Chinese channel config text; all other locales see unchanged English.

Parity Contract

  • Legacy behavior preserved: Yes — every t(key, fallback) call uses the original hardcoded English as fallback.
  • Guard/fallback/dispatch parity checks: N/A (no RPC/controller changes).

Duplicate / Superseded PR Handling

  • Duplicate PR(s):
  • Canonical PR:
  • Resolution:

Summary by CodeRabbit

  • New Features
    • Channel configuration UI and connection badges now use localized strings.
    • Channel headings, descriptions, auth-mode names, help text, field labels/placeholders, and required-field validation messages localized.
    • Improved translation fallback/resolution for missing strings.
    • Added translations for MCP, Discord, Telegram, and Web across 12+ languages (English, Spanish, German, French, Arabic, Chinese, Bengali, Hindi, Indonesian, Italian, Portuguese, Russian).

Review Change Stack

agent:skill-master and others added 2 commits May 23, 2026 05:46
Channel configuration UI (Discord, Telegram, Web, MCP) was displaying
untranslated English strings because app/src/lib/channels/definitions.ts
hard-codes all labels, descriptions, placeholders, and auth mode names.

Changes:
- I18nContext.tsx: t() now accepts an optional fallback string so
  components can gracefully degrade to the original English when a key
  is missing.
- ChannelStatusBadge.tsx: status labels (Connected/Connecting/Disconnected/Error)
  now use channels.status.* keys already present in zh-CN.
- ChannelConfigPanel.tsx: display_name, description, and MCP title/description
  now go through t().
- DiscordConfig.tsx & TelegramConfig.tsx: auth mode labels, mode descriptions,
  field labels, field placeholders, and the "is required" validation message
  now use t() with fallback.
- en.ts & zh-CN chunks: add 39 new keys covering all Discord/Telegram/Web/MCP
  channel config strings plus shared auth mode labels and field validation.
@JAYcodr JAYcodr requested a review from a team May 22, 2026 23:18
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Channel UI components now call the i18n useT() hook and render headings, status labels, auth-mode names/descriptions, validation messages, and field labels/placeholders via channels.* translation keys. Corresponding channels.* entries were added across language chunks; a .codegraph/.gitignore was also added.

Changes

Channel UI Internationalization

Layer / File(s) Summary
Channel components i18n migration
app/src/components/channels/ChannelConfigPanel.tsx, app/src/components/channels/ChannelStatusBadge.tsx, app/src/components/channels/DiscordConfig.tsx, app/src/components/channels/TelegramConfig.tsx
Components call useT() and render strings via t(...). MCP and per-channel headings/descriptions use channels.* keys; status badges use channels.status.*; Discord and Telegram auth modes, required-field errors, and field labels/placeholders now use i18n keys and no longer import AUTH_MODE_LABELS.
I18n provider signature & tooling
app/src/lib/i18n/I18nContext.tsx, .codegraph/.gitignore
I18nContext.t now accepts fallback?: string; provider and default implementations return fallback before falling back to the key. Adds .codegraph/.gitignore.
Translation base entries: auth modes, field required, and MCP
app/src/lib/i18n/en.ts, app/src/lib/i18n/chunks/*-1.ts
Add foundational channels.authMode.* labels, channels.fieldRequired template, and channels.mcp.* title/description across English and language chunk files.
Translation channel-specific entries: Discord, Telegram, Web
app/src/lib/i18n/chunks/*-3.ts, app/src/lib/i18n/chunks/en-3.ts
Add per-channel channels.discord.*, channels.telegram.*, and channels.web.* translation keys: display names, descriptions, auth-mode descriptions, and form field labels/placeholders across language chunks.
MemoryGraph tooltip update
app/src/components/intelligence/MemoryGraph.tsx
Stops passing interpolation params to t() for summary/contact tooltips and returns translation keys compatible with the new t(key, fallback?) signature.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • graycyrus

Poem

🐰 I hopped through keys from sea to sea,

channels now speak in tongues with glee,
MCP, Discord, Telegram too,
translated labels—fresh and true,
a little rabbit cheers: "Nice work, woohoo!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: migrating hardcoded channel configuration text to the i18n system.
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.


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 22, 2026
@sanil-23
Copy link
Copy Markdown
Contributor

Checking status of this PR

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@app/src/lib/i18n/en.ts`:
- Around line 1356-1359: The i18n keys use camelCase
('channels.authMode.managedDm', 'channels.authMode.botToken',
'channels.authMode.apiKey') but runtime resolves channels.authMode.${spec.mode}
with snake_case modes (managed_dm, bot_token, api_key), so rename those keys to
'channels.authMode.managed_dm', 'channels.authMode.bot_token', and
'channels.authMode.api_key' (leave 'channels.authMode.oauth' as-is) in this file
and make the identical key-shape changes in the corresponding zh-CN chunk file
so the localized labels are resolved at runtime.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af3c6d31-dec5-4300-a2ad-0b489b2c63fb

📥 Commits

Reviewing files that changed from the base of the PR and between e7e660f and c031401.

📒 Files selected for processing (8)
  • app/src/components/channels/ChannelConfigPanel.tsx
  • app/src/components/channels/ChannelStatusBadge.tsx
  • app/src/components/channels/DiscordConfig.tsx
  • app/src/components/channels/TelegramConfig.tsx
  • app/src/lib/i18n/I18nContext.tsx
  • app/src/lib/i18n/chunks/zh-CN-1.ts
  • app/src/lib/i18n/chunks/zh-CN-3.ts
  • app/src/lib/i18n/en.ts

Comment thread app/src/lib/i18n/en.ts Outdated
…x component t() calls

- Fix en.ts ↔ en-N.ts chunk parity by adding 27 channels.* keys to en-1.ts/en-3.ts
- Rename camelCase keys to snake_case (managedDm→managed_dm, botToken→bot_token, apiKey→api_key) to match runtime template literals
- Add the 27 keys to all 11 locale chunks (zh-CN, de, hi, es, ar, fr, bn, pt, ru, id, it)
- Fix ChannelConfigPanel.tsx and ChannelStatusBadge.tsx to use single-arg t()
- Fix DiscordConfig.tsx/TelegramConfig.tsx template literals and remove unused AUTH_MODE_LABELS import
- Keep I18nContext.tsx at t(key: string) to avoid type conflict with MemoryGraph.tsx
@coderabbitai coderabbitai Bot added the feature Net-new user-facing capability or product behavior. label May 22, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 22, 2026
@JAYcodr
Copy link
Copy Markdown
Contributor Author

JAYcodr commented May 23, 2026

Coverage override request

The 2 uncovered lines are pure string extractions (t() calls) in presentational components DiscordConfig.tsx and TelegramConfig.tsx. No new logic or branches were added. The existing component tests for these files run and pass, but diff-cover reports 0% because the tests live in __tests__/ co-located with the components. Requesting maintainer override for the diff-cover gate.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
app/src/components/channels/DiscordConfig.tsx (1)

169-172: ⚡ Quick win

Preserve pre-i18n fallback behavior in validation message.

On Line 169, pass explicit fallbacks so missing keys never surface as raw i18n keys and the old label behavior is retained.

Proposed patch
-                lastError: t('channels.fieldRequired').replace(
+                lastError: t('channels.fieldRequired', '{field} is required').replace(
                   '{field}',
-                  t(`channels.discord.fields.${field.key}.label`)
+                  t(`channels.discord.fields.${field.key}.label`, field.label)
                 ),
🤖 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 `@app/src/components/channels/DiscordConfig.tsx` around lines 169 - 172, The
validation message currently inserts the inner i18n key directly which can
surface raw keys if missing; update the lastError construction in
DiscordConfig.tsx so the inner t call supplies an explicit fallback (e.g.
t(`channels.discord.fields.${field.key}.label`, { defaultValue: field.label ||
field.key })) and use that value in
t('channels.fieldRequired').replace('{field}', ...), ensuring missing
translations fall back to the original label or key.
app/src/components/channels/TelegramConfig.tsx (1)

196-199: ⚡ Quick win

Add explicit fallbacks for required-field i18n interpolation.

On Line 196, use fallback arguments to avoid raw key output when a translation key is absent and keep prior field-label behavior.

Proposed patch
-                lastError: t('channels.fieldRequired').replace(
+                lastError: t('channels.fieldRequired', '{field} is required').replace(
                   '{field}',
-                  t(`channels.telegram.fields.${field.key}.label`)
+                  t(`channels.telegram.fields.${field.key}.label`, field.label)
                 ),
🤖 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 `@app/src/components/channels/TelegramConfig.tsx` around lines 196 - 199,
Replace the current string-replace approach for lastError with an i18n-safe
interpolation that provides explicit fallbacks: call t('channels.fieldRequired',
{ field: t(`channels.telegram.fields.${field.key}.label`, { defaultValue:
field.label || field.key }) }) (or, if your i18n t signature differs, compute a
fallbackLabel = t(`channels.telegram.fields.${field.key}.label`, { defaultValue:
'' }) || field.label || field.key and pass that into t('channels.fieldRequired',
{ field: fallbackLabel })); update the lastError assignment to use this pattern
so missing translation keys don't render raw keys.
🤖 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 `@app/src/components/channels/DiscordConfig.tsx`:
- Around line 169-172: The validation message currently inserts the inner i18n
key directly which can surface raw keys if missing; update the lastError
construction in DiscordConfig.tsx so the inner t call supplies an explicit
fallback (e.g. t(`channels.discord.fields.${field.key}.label`, { defaultValue:
field.label || field.key })) and use that value in
t('channels.fieldRequired').replace('{field}', ...), ensuring missing
translations fall back to the original label or key.

In `@app/src/components/channels/TelegramConfig.tsx`:
- Around line 196-199: Replace the current string-replace approach for lastError
with an i18n-safe interpolation that provides explicit fallbacks: call
t('channels.fieldRequired', { field:
t(`channels.telegram.fields.${field.key}.label`, { defaultValue: field.label ||
field.key }) }) (or, if your i18n t signature differs, compute a fallbackLabel =
t(`channels.telegram.fields.${field.key}.label`, { defaultValue: '' }) ||
field.label || field.key and pass that into t('channels.fieldRequired', { field:
fallbackLabel })); update the lastError assignment to use this pattern so
missing translation keys don't render raw keys.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e8729d9b-af88-4f00-b631-5a698b2a5add

📥 Commits

Reviewing files that changed from the base of the PR and between 53db8f5 and c760162.

📒 Files selected for processing (27)
  • .codegraph/.gitignore
  • app/src/components/channels/DiscordConfig.tsx
  • app/src/components/channels/TelegramConfig.tsx
  • app/src/lib/i18n/chunks/ar-1.ts
  • app/src/lib/i18n/chunks/ar-3.ts
  • app/src/lib/i18n/chunks/bn-1.ts
  • app/src/lib/i18n/chunks/bn-3.ts
  • app/src/lib/i18n/chunks/de-1.ts
  • app/src/lib/i18n/chunks/de-3.ts
  • app/src/lib/i18n/chunks/en-1.ts
  • app/src/lib/i18n/chunks/en-3.ts
  • app/src/lib/i18n/chunks/es-1.ts
  • app/src/lib/i18n/chunks/es-3.ts
  • app/src/lib/i18n/chunks/fr-1.ts
  • app/src/lib/i18n/chunks/fr-3.ts
  • app/src/lib/i18n/chunks/hi-1.ts
  • app/src/lib/i18n/chunks/hi-3.ts
  • app/src/lib/i18n/chunks/id-1.ts
  • app/src/lib/i18n/chunks/id-3.ts
  • app/src/lib/i18n/chunks/it-1.ts
  • app/src/lib/i18n/chunks/it-3.ts
  • app/src/lib/i18n/chunks/pt-1.ts
  • app/src/lib/i18n/chunks/pt-3.ts
  • app/src/lib/i18n/chunks/ru-1.ts
  • app/src/lib/i18n/chunks/ru-3.ts
  • app/src/lib/i18n/chunks/zh-CN-3.ts
  • app/src/lib/i18n/en.ts
✅ Files skipped from review due to trivial changes (14)
  • app/src/lib/i18n/chunks/de-1.ts
  • .codegraph/.gitignore
  • app/src/lib/i18n/chunks/pt-1.ts
  • app/src/lib/i18n/en.ts
  • app/src/lib/i18n/chunks/hi-1.ts
  • app/src/lib/i18n/chunks/fr-3.ts
  • app/src/lib/i18n/chunks/en-3.ts
  • app/src/lib/i18n/chunks/it-3.ts
  • app/src/lib/i18n/chunks/zh-CN-3.ts
  • app/src/lib/i18n/chunks/bn-3.ts
  • app/src/lib/i18n/chunks/ru-1.ts
  • app/src/lib/i18n/chunks/id-3.ts
  • app/src/lib/i18n/chunks/es-1.ts
  • app/src/lib/i18n/chunks/ru-3.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 23, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
app/src/components/channels/DiscordConfig.tsx (1)

317-323: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Provide fallbacks for field label and placeholder translations.

The field translations don't provide fallback values, so missing translation keys will render as the key string itself (e.g., "channels.discord.fields.bot_token.label"). Per the PR summary, components should use t(key, originalEnglish) to preserve prior behavior when translations are missing.

♻️ Add fallbacks to field translations
                  <ChannelFieldInput
                    key={field.key}
                    field={{
                      ...field,
-                      label: t(`channels.discord.fields.${field.key}.label`),
+                      label: t(`channels.discord.fields.${field.key}.label`, field.label),
                      placeholder: field.placeholder
-                        ? t(`channels.discord.fields.${field.key}.placeholder`)
-                        : field.placeholder,
+                        ? t(`channels.discord.fields.${field.key}.placeholder`, field.placeholder)
+                        : undefined,
                    }}
                    value={fieldValues[compositeKey]?.[field.key] ?? ''}
                    onChange={val => updateField(compositeKey, field.key, val)}
                    disabled={busy}
                  />
🤖 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 `@app/src/components/channels/DiscordConfig.tsx` around lines 317 - 323, The
current assignment for field.label and field.placeholder uses t(...) without
fallbacks so missing translations render the key; update the spread in
DiscordConfig (where field is rebuilt) to call t with the original English
defaults: use t(`channels.discord.fields.${field.key}.label`, field.label) for
the label and for the placeholder use
t(`channels.discord.fields.${field.key}.placeholder`, field.placeholder ||
field.placeholder) (i.e., pass field.placeholder as the default) so the original
values are preserved when translations are missing.
app/src/components/channels/TelegramConfig.tsx (1)

377-383: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Provide fallbacks for field label and placeholder translations.

The field translations don't provide fallback values, so missing translation keys will render as the key string itself (e.g., "channels.telegram.fields.bot_token.label"). Per the PR summary, components should use t(key, originalEnglish) to preserve prior behavior when translations are missing.

♻️ Add fallbacks to field translations
                  <ChannelFieldInput
                    key={field.key}
                    field={{
                      ...field,
-                      label: t(`channels.telegram.fields.${field.key}.label`),
+                      label: t(`channels.telegram.fields.${field.key}.label`, field.label),
                      placeholder: field.placeholder
-                        ? t(`channels.telegram.fields.${field.key}.placeholder`)
-                        : field.placeholder,
+                        ? t(`channels.telegram.fields.${field.key}.placeholder`, field.placeholder)
+                        : undefined,
                    }}
                    value={fieldValues[compositeKey]?.[field.key] ?? ''}
                    onChange={val => updateField(compositeKey, field.key, val)}
                    disabled={busyKeys[compositeKey]}
                  />
🤖 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 `@app/src/components/channels/TelegramConfig.tsx` around lines 377 - 383, The
translation calls for field.label and field.placeholder should supply fallbacks
so missing keys return the original text; update the spread in TelegramConfig
(the field object being built) to call
t(`channels.telegram.fields.${field.key}.label`, field.label) for the label and
t(`channels.telegram.fields.${field.key}.placeholder`, field.placeholder) for
the placeholder (keep the conditional that only translates when
field.placeholder exists), ensuring the second argument passes the original
English string from the existing field.label/field.placeholder values.
🤖 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.

Inline comments:
In `@app/src/components/channels/DiscordConfig.tsx`:
- Around line 169-176: Replace the manual fallback logic inside the lastError
IIFE by calling the translation helper with its fallback parameter: use t(key,
field.label || field.key) (or t(key, field.label ?? field.key)) so you don't
compare label === key; update the replacement to
t('channels.fieldRequired').replace('{field}', t(key, field.label || field.key))
while keeping the surrounding lastError IIFE and field.key reference intact.

In `@app/src/components/channels/TelegramConfig.tsx`:
- Around line 196-203: Replace the manual fallback detection in the lastError
computation with the new t(key, fallback) API: build the key as `const key =
\`channels.telegram.fields.${field.key}.label\`` and call `t(key, field.label ||
field.key)` to get the label with a proper fallback, then use that result in the
`t('channels.fieldRequired').replace('{field}', ...)` call (update the inline
IIFE around lastError to use this t call instead of comparing label === key).

---

Outside diff comments:
In `@app/src/components/channels/DiscordConfig.tsx`:
- Around line 317-323: The current assignment for field.label and
field.placeholder uses t(...) without fallbacks so missing translations render
the key; update the spread in DiscordConfig (where field is rebuilt) to call t
with the original English defaults: use
t(`channels.discord.fields.${field.key}.label`, field.label) for the label and
for the placeholder use t(`channels.discord.fields.${field.key}.placeholder`,
field.placeholder || field.placeholder) (i.e., pass field.placeholder as the
default) so the original values are preserved when translations are missing.

In `@app/src/components/channels/TelegramConfig.tsx`:
- Around line 377-383: The translation calls for field.label and
field.placeholder should supply fallbacks so missing keys return the original
text; update the spread in TelegramConfig (the field object being built) to call
t(`channels.telegram.fields.${field.key}.label`, field.label) for the label and
t(`channels.telegram.fields.${field.key}.placeholder`, field.placeholder) for
the placeholder (keep the conditional that only translates when
field.placeholder exists), ensuring the second argument passes the original
English string from the existing field.label/field.placeholder values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 080d0d9e-c293-4138-88ba-a95c67b71f1d

📥 Commits

Reviewing files that changed from the base of the PR and between c760162 and e37ae57.

📒 Files selected for processing (2)
  • app/src/components/channels/DiscordConfig.tsx
  • app/src/components/channels/TelegramConfig.tsx

Comment thread app/src/components/channels/DiscordConfig.tsx Outdated
Comment thread app/src/components/channels/TelegramConfig.tsx Outdated
@senamakel senamakel self-assigned this May 23, 2026
senamakel added 4 commits May 23, 2026 01:11
# Conflicts:
#	app/src/lib/i18n/chunks/id-1.ts
Addresses CodeRabbit on app/src/components/channels/DiscordConfig.tsx:176
and app/src/components/channels/TelegramConfig.tsx:203.

- t() now accepts an optional fallback string used when neither the active
  locale nor English contains the key. This is sturdier than the prior
  `label === key` heuristic, which would mis-fire whenever a translation
  legitimately equalled its key.
- DiscordConfig and TelegramConfig now use t(key, field.label || field.key)
  for the missing-field error label instead of the brittle IIFE.
- MemoryGraph.tooltipFor: align signature with the real t. The unused
  params object was previously dropped at runtime (t had no interpolation),
  so this is behavior-preserving.
…field i18n

Addresses CodeRabbit review:
- Use the new t(key, fallback) signature for field label/placeholder so
  missing translations render the original English instead of raw keys.
- Add explicit '{field} is required' fallback to channels.fieldRequired.
@JAYcodr
Copy link
Copy Markdown
Contributor Author

JAYcodr commented May 23, 2026

@senamakel Thanks for the maintainer boost! 😂 I was still staring at CodeRabbit's review comments trying to figure out the i18n fallback, refreshed the page and boom — you already pushed the fix plus rebased everything. Speedrun strats.
I'll go spin up a new branch and keep chipping away at the remaining docs. Next PR incoming soon 🫡

@senamakel
Copy link
Copy Markdown
Member

@senamakel Thanks for the maintainer boost! 😂 I was still staring at CodeRabbit's review comments trying to figure out the i18n fallback, refreshed the page and boom — you already pushed the fix plus rebased everything. Speedrun strats. I'll go spin up a new branch and keep chipping away at the remaining docs. Next PR incoming soon 🫡

speed run ftw :D thanks for your contributino.. LFG!

@senamakel senamakel merged commit 27f8d77 into tinyhumansai:main May 23, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Net-new user-facing capability or product behavior. 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