Skip to content

feat: add next-intl internationalization with 4 locales#79

Open
gzhang33 wants to merge 2 commits into
Anyesh:mainfrom
gzhang33:feature/i18n-standalone
Open

feat: add next-intl internationalization with 4 locales#79
gzhang33 wants to merge 2 commits into
Anyesh:mainfrom
gzhang33:feature/i18n-standalone

Conversation

@gzhang33
Copy link
Copy Markdown

Summary

  • Integrate next-intl for full i18n support across the frontend
  • Support 4 locales: English, Chinese (zh), French (fr), Italian (it)
  • Extract all hardcoded strings to translation files (~970 keys per locale)
  • Add locale switcher component with dropdown menu
  • Migrate all pages, components, dialogs, and cards to use useTranslations()
  • Replace hardcoded toast messages, title attributes, placeholders, and inline text
  • Add use-translated-constants hook for dynamic locale-aware constants
  • Add formatWornAgo i18n helper
  • Update tests with next-intl mock setup

No dependency on other PRs. This PR is fully standalone and targets main directly.

Test Plan

  • npx tsc --noEmit — zero TypeScript errors
  • npx vitest run — all tests pass
  • npm run build — production build succeeds
  • Translation key parity: all keys match across en/zh/fr/it

🤖 Generated with Claude Code

apple and others added 2 commits May 13, 2026 03:51
Integrate next-intl for full i18n support across the frontend:
- Add next-intl package and configure middleware + request config
- Create locale switcher component with dropdown menu
- Extract all hardcoded strings to translation files (967 keys)
- Support English, Chinese, French, and Italian locales
- Migrate all pages, components, dialogs, and cards to use useTranslations()
- Replace hardcoded toast messages, titles, placeholders, and inline text
- Add use-translated-constants hook for dynamic locale-aware constants
- Add formatWornAgo i18n helper
- Update tests with next-intl mock setup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace tShared.raw with tShared in formatWornAgo call so ICU params
  like {days} are properly interpolated
- Use t('success', { count }) instead of regex-based string manipulation
  in generate-pairings-dialog
- Replace t('leaveFamily').split(' ')[0] with t('confirmLeave') in
  family leave action button to avoid locale-dependent word splitting
- Add dedicated schedule.dialogDescription translation key instead of
  truncating with split('.')[0] in notifications page
- Add outfits.new.saveError key and use it instead of success message
  outfitUpdated as error fallback
- Enhance next-intl test mocks to include raw/rich/markup methods
- Remove unused getDaysSinceDateInTimezone import from utils.test.ts
- Type computeWarnings t parameter as (key: string) => string instead
  of any
- Fix formatWornAgo t parameter type to match next-intl TranslationValues

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 13, 2026 02:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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