feat: add next-intl internationalization with 4 locales#79
Open
gzhang33 wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useTranslations()use-translated-constantshook for dynamic locale-aware constantsformatWornAgoi18n helperNo dependency on other PRs. This PR is fully standalone and targets main directly.
Test Plan
npx tsc --noEmit— zero TypeScript errorsnpx vitest run— all tests passnpm run build— production build succeeds🤖 Generated with Claude Code