Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/advanced-features/i18n-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,8 @@ export const getStaticPaths = ({ locales }) => {
}
}
```

## Limits for the i18n config

- `locales`: 100 total locales
- `domains`: 100 total locale domain items
4 changes: 2 additions & 2 deletions errors/invalid-i18n-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#### Why This Error

In your `next.config.js` file you provided an invalid config for the `i18n` field.
In your `next.config.js` file you provided an invalid config for the `i18n` field. This could mean the limit for 100 locale items was exceeded.

#### Possible Ways to Fix It

Make sure your `i18n` field follows the allowed config shape and values:
Make sure your `i18n` field follows the allowed config shape, limits, and values:

```js
module.exports = {
Expand Down
6 changes: 6 additions & 0 deletions packages/next/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ function assignDefaults(userConfig: { [key: string]: any }) {
)
}

if (i18n.locales.length > 100) {
throw new Error(
`Received ${i18n.locales.length} i18n.locales items which exceeds the max of 100, please reduce the number of items to continue.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`
)
}

const defaultLocaleType = typeof i18n.defaultLocale

if (!i18n.defaultLocale || defaultLocaleType !== 'string') {
Expand Down