Skip to content

0.9.0

Compare
Choose a tag to compare
@QuiiBz QuiiBz released this 12 Aug 06:49
· 69 commits to main since this release

App Router

Override the user's locale resolution

If needed, you can override the resolution of a locale from a Request, which by default will try to extract it from the Accept-Language header. This can be useful to force the use of a specific locale regardless of the Accept-Language header. Note that this function will only be called if the user doesn't already have a Next-Locale cookie.

Navigate to the middleware.ts file and implement a new resolveLocaleFromRequest function:

// middleware.ts
const I18nMiddleware = createI18nMiddleware(['en', 'fr'] as const, 'fr', {
  resolveLocaleFromRequest: request => {
    // Do your logic here to resolve the locale
    return 'fr'
  }
})

What's Changed

  • chore(international-types): update examples by @QuiiBz in #105
  • chore: add sponsors to readme by @QuiiBz in #107
  • feat(next-international): override locale resolution by @QuiiBz in #111

Full Changelog: 0.8.2...0.9.0