## Summary
- Fixed translation key format compatibility with next-intl
- Fixed pluralization format from i18next to next-intl format
- Fixed dynamic translation key error handling
- Updated server components to match API response structure
- Fixed useSearchParams import location
## Changes
- Changed pluralization from `{{count}} items` to `{count} items` format
- Added proper error handling for missing translation keys
- Fixed import paths for next-intl hooks
- Fixed PartyPageClient trying to set non-existent appState.parties
## Test plan
- [x] Verified translations render correctly
- [x] Tested pluralization works with different counts
- [x] Confirmed no console errors about missing translations
- [x] Tested party page functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
20 lines
661 B
TypeScript
20 lines
661 B
TypeScript
'use client'
|
|
|
|
import { setCookie } from 'cookies-next'
|
|
import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime'
|
|
|
|
export default function changeLanguage(
|
|
router: AppRouterInstance,
|
|
newLanguage: string
|
|
) {
|
|
// In App Router, locale handling is different
|
|
// We set the cookie and refresh the page to apply the new locale
|
|
const expiresAt = new Date()
|
|
expiresAt.setDate(expiresAt.getDate() + 60)
|
|
|
|
setCookie('NEXT_LOCALE', newLanguage, { path: '/', expires: expiresAt })
|
|
|
|
// App Router doesn't have router.locale or locale option in push
|
|
// The locale is handled via the cookie and middleware
|
|
router.refresh()
|
|
}
|