QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.19k stars 52 forks source link

fallbackLocale type mismatch for nested locale style #344

Closed bastibuck closed 5 months ago

bastibuck commented 5 months ago

Describe the bug When using a fallbackLocale with the pages-router like described in the docs TypeScript doesn't like if you are using the nested style of locales. Flat keys works fine.

To Reproduce Steps to reproduce the behavior:

  1. Follow setup instructions and use a nested locale file e.g.
    
    const en = {
    hello: {
    world: 'Hello, World!',
    user: 'Hello, {name}!',
    },
    } as const;

export default en;


2. Use the locale as `fallbackLocale` in `_app.tsx`
3. See error

**Expected behavior**
It should not throw an error regardless of using nested or flat style.

**Additional context**
It does work with the flat style of locale e.g.
```ts
const en = {
  'hello.world': 'Hello, World!',
  'hello.user': 'Hello, {name}!',
} as const;

export default en;
QuiiBz commented 4 months ago

Fix released in https://github.com/QuiiBz/next-international/releases/tag/1.2.4!