Improve the Fallback Locale API for both the Pages and App Router:
Pages Router
See changes for fallbackLocale prop
Before:
```tsx
// pages/_app.tsx
import en from '../locales/en'
export default function App({ Component, pageProps }: AppProps) {
return (
)
}
```
After:
```tsx
// pages/_app.tsx
export default function App({ Component, pageProps }: AppProps) {
return (
)
}
```
App Router
See changes for fallbackLocale and locale props (in Client Components)
Before:
```tsx
// app/[locale]/client/layout.tsx
import en from '../../../locales/en'
export default function SubLayout({ children, params: { locale } }: { children: ReactNode; params: { locale: string } }) {
return (
{children}
)
}
```
After:
```tsx
// app/[locale]/client/layout.tsx
import en from '../../../locales/en'
export default function SubLayout({ children }: { children: ReactNode }) {
return (
{children}
)
}
```
This release also adds missing support for fallback locales on the server with the App Router. Navigate to locales/server.ts and add a new fallbackLocale option:
Relates to #141
Improved Fallback Locale API
⚠️ BREAKING
Improve the Fallback Locale API for both the Pages and App Router:
Pages Router
See changes for
Before: ```tsx // pages/_app.tsx import en from '../locales/en' export default function App({ Component, pageProps }: AppProps) { return (fallbackLocale
propApp Router
See changes for
Before: ```tsx // app/[locale]/client/layout.tsx import en from '../../../locales/en' export default function SubLayout({ children, params: { locale } }: { children: ReactNode; params: { locale: string } }) { return (fallbackLocale
andlocale
props (in Client Components)This release also adds missing support for fallback locales on the server with the App Router. Navigate to
locales/server.ts
and add a newfallbackLocale
option: