Skip to content

0.8.0

Compare
Choose a tag to compare
@QuiiBz QuiiBz released this 03 Aug 06:47
· 75 commits to main since this release

App Router

Rewrite the URL to hide the locale

You might have noticed that by default, next-international redirects and shows the locale in the URL (e.g /en/products). This is helpful for users, but you can transparently rewrite the URL to hide the locale (e.g /products).

Navigate to the middleware.ts file and set the urlMappingStrategy to rewrite (the default is redirect):

// middleware.ts
const I18nMiddleware = createI18nMiddleware(['en', 'fr'] as const, 'fr', {
    urlMappingStrategy: 'rewrite'
})

useChangeLocale with basePath

When using useChangeLocale and if you have set a basePath option inside next.config.js, you'll also need to set it here:

const changeLocale = useChangeLocale({
  basePath: '/your-base-path'
})

What's Changed

  • fix(international-types): plural tags by @QuiiBz in #80
  • chore: improve README by @QuiiBz in #82
  • feat(next-international): useParams & rewrite strategy to hide locale from URL by @EdmundKorley in #83
  • fix(international-types): plurals params with scope by @QuiiBz in #88
  • fix(next-international): useChangeLocale with basePath by @QuiiBz in #90
  • fix(next-international): derive plurals from fallback locale by @ArmanAryanpour in #79
  • fix(next-international): plural with scopes by @QuiiBz in #91

New Contributors

Full Changelog: 0.7.0...0.8.0