0.8.0
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
withbasePath
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
- @EdmundKorley made their first contribution in #83
- @ArmanAryanpour made their first contribution in #79
Full Changelog: 0.7.0...0.8.0