You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(i18n): fix WelcomeScreen displaying raw translation keys due to module-level t() calls
WelcomeScreen.SHORTCUT_TIPS was defined at module scope, so t() ran
before initI18n() (ESM import order), returning key strings like
"ui.welcome.pasteImage" instead of translated text.
Convert SHORTCUT_TIPS from a module-level const array to a lazy
getShortcutTips() function called at render time.
Also update the i18n-development SKILL.md to:
- Add the WelcomeScreen real-world case to Pitfall #1
- Document the "tests pass but UI shows raw keys" subtle trap in Pitfall #5
- Expand audit commands for detecting module-level t() calls
Tests calling functions using `t()` must call `initI18n("en")` first, otherwise `t()` returns key strings.
242
278
279
+
**⚠️ Subtle trap**: Tests may pass even when `t()` returns key strings, if the test only checks non-translated fields (e.g., `tip.label` but not `tip.description`). The bug only manifests in the UI.
280
+
281
+
```typescript
282
+
// ❌ Test passes despite t() returning key strings — description is never checked
// tips[0].description === "ui.welcome.sendPrompt" — but nobody checks it!
286
+
```
287
+
288
+
**Fix**: Always call `initI18n("en")` in `describe` or test setup when testing any function that uses `t()`. If the test doesn't care about translated output, at minimum assert that `t()` returns something other than the key itself.
289
+
243
290
### 6. 🚫 Translation Key Naming Mismatch
244
291
245
292
Run `npm run check:i18n` before PR. Also audit key usage:
0 commit comments