All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
- Follow-up for #1573 to also handle the case when a non-default locale is in use (#1578) (fd71741), closes #1568 β by @amannn
- Handle inconsistency in Next.js when using
usePathname
with custom prefixes,localePrefix: 'as-needed'
and static rendering (#1573) (20fd0f0) β by @amannn
- Correctly handle search params in redirects when using
trailingSlash: true
(#1537) (03a4620) β by @deini
- Resolve locale for navigation APIs consistently from
i18n/request.ts
inreact-server
like all other APIs do (#1459) (8c6d5ff) β by @amannn
- Handle inlined search params and hashes correctly in
<Link />
fromcreateNavigation
(#1448) (ba0a537) β by @amannn
- Remove usage of deprecated
ReactNodeArray
which is removed in React 19 (#1445) (2396345) β by @amannn
- feat:
createNavigation
(#1316) - feat: Add async
requestLocale
param to getRequestConfig for Next.js 15 support (#1383) - feat: Add
localeCookie
option for middleware (#1414) - feat: Add
setRequestLocale
(#1437)
- fix: When using
domains
, handle unknown domains more gracefully (#1389)
- Repair package publishing workflow (this release doesn't include any library changes) (ceba9ae) β by @amannn
- Add error handling in case an invalid i18n request config file has been specified (#1327) (18b9fd6) β by @amannn
- Print warning for inconsistent i18n setup where no
locale
is read ingetRequestConfig
and also none is returned (#1305) (2f0f781) β by @amannn
- Lazy init message formatter for improved tree shaking in case
useTranslations
is only used in Server Components (#1279) (9f1725c) β by @amannn
- Handle optional catch-all segments in navigation APIs if no value is provided and handle the case if a dynamic value appears multiple times in a pathname (#1259) (58ef482), closes #1236 β by @amannn
- Fix open redirect vulnerability for
localePrefix: 'as-necessary'
by sanitizing pathname in the middleware (#1208) (f42ac01), closes #1207 β by @hblee12294
- Apply
useMemo
foruseRouter
returned fromcreateLocalizedPathnamesNavigation
to keep a stable reference when possible (#1201) (a1b9a36), closes #1198 β by @amannn
- Prefer more specific routes in
usePathname
when detecting the currently active pathname for localized pathnames (#1152) (936839e), closes #1151 β by @amannn
Note: Version bump only for package root
- Remove
@formatjs/ecma402-abstract
dependency in favor of the automatically bundled one fromintl-messageformat
(#1141) β by @amannn
- Handle external URLs passed to
redirect
andpermanentRedirect
(#1084 by @mhogeveen) (16b55e2)
- Print a warning in case the middleware didn't run on a request but APIs from
next-intl
are used (#1045) (8149955)
- Correctly parse date skeleton
EEEE
to a long weekday like "Tuesday" (upgrades tointl-messageformat@10
internally) (#1039) (d6b5fd2)
- Automatically prefer localized pathnames that are more specific (#983 by @fkapsahili) (88a9b7a)
- When using domain-based routing, use
defaultLocale
of a domain instead of the top-level one in case no other locale matches better on the domain (#1000) (42988b7), closes #998
- Correctly detect base path at the app root
/
when using a locale prefix strategy other thanalways
. This ensures the locale cookie is set correctly. (#999) (1ce5988), closes #997
- Apply correct port when redirecting to another domain and the app doesn't run behind a proxy (#979 by @awkaiser-tr) (485f59e), closes #658
- Support symbols in localized pathnames that require URL encoding (#959) (b6e66f4), closes #607 /github.com/amannn/next-intl/issues/607#issuecomment-1979747515
- When using localized pathnames, allow access to internal pathnames only if they match an entry from a particular localeβotherwise redirect (#914 by @RomainGueffier) (0658600)
- Improve support for older browsers by switching from
replaceAll
toreplace
(#885 by @MichalMoravik) (080333a), closes #884
- Handle changing href for
<Link />
correctly when usinglocalePrefix: 'never'
(#926) (b609dc0), closes #918
- Handle optional params in catch-all segments correctly when using localized pathnames (#925) (8ba8b69), closes #917
- Incorporate
basePath
correctly inuseRouter
functions (#906 by @Oberwaditzer) (4abcbeb), closes #905 #910
- Add redirects for case mismatches in locale prefixes (e.g.
/EN
β/en
) (#861 by @fkapsahili) (3b2b446)
- Add
format.dateTimeRange
(#769 by @martinmunillas) (9f12521)
- Add support for
permanentRedirect
in navigation APIs (#850 by @polvallverdu) (6508ddc)
- Improve RSC render performance by sharing a cache between
getTranslations
anduseTranslations
(#798 by @fkapsahili) (73e8337)
- Remove
x-default
alternate links entry for non-root pathnames when usinglocalePrefix: 'always'
(#805) (c5bb0f5)
- Make options for
createSharedPathnamesNavigation
along withlocales
argument optional (relevant whenlocales
aren't known statically) (#784) (614053d)
- Make sure cookie value stays up to date when the Next.js Router Cache is used (#790) (977b973), closes #786 #786
- Apply global
timeZone
when using date skeletons in messages (e.g.Ordered on {orderDate, date, ::yyyyMd}
) (#695) (8940192), closes #693
- Invoke
notFound()
when no locale was attached to the request and update docs to suggest validating the locale ini18n.ts
(#742) (e6d9878), closes #736 #716 /next-intl-docs.vercel.app/docs/usage/configuration#i18
- Improve performance when calling hooks like
useTranslations
in Server Components by making sure we only suspend when i18n config is initially loaded and never for subsequent calls (#741) (4185a72)
- Correctly normalize pathname for redirects and alternate links when
localePrefix: 'as-needed'
is used with the default locale (#698 by @anna-colenso) (48e9523)
- Prefer
locale
fromNextIntlClientProvider
when usinguseLocale
in Client Components.useParams().locale
is still used as a fallback. (#691) (e00ed97), closes #688
- Allow to call
getRequestConfig
in outer module closure in a Client Component module graph (#687) (0f16f10), closes #685
- Allow to import
next-intl/server
into Client Components (however not call any functions). This allows for easier testing of page components with multiple exports. (#683) (5ca4075), closes #681
- Add
localePrefix
for navigation APIs for an improved initial render ofLink
when usinglocalePrefix: never
. Also fix edge case in middleware when using localized pathnames for redirects that remove a locale prefix (fixes an infinite loop). (#678) (1c68e3b), closes #444
- Apply correct port and protocol during domain-based redirects when called from an internal address (e.g. from a proxy) (#662) (2bb867d), closes #658
- Update link to migration example in error messages (#648 by @outloudvi) (1f3b226)
Note: Version bump only for package root
- Don't retrieve defaults for
locale
,now
andtimeZone
if these options have been provided toNextIntlClientProvider
(#633) (824363a), closes #631
- Allow usage of
getTranslations({namespace})
without TypeScript integration for messages (#630) (62cf29c), closes #625
Add provenance statement to published packages.
Please refer to the release notes.
- Correct version range (ffbff8e)
- Add error reporting when no
timeZone
is specified and downgrade error handling for missingnow
value from throwing to reporting an error (#519) (dc55ab2)
- Improve runtime performance of
useTranslations
by avoiding the creation of message format instances if possible and introducing a cross-component message format cache (#475) (4d177f8), closes #294
- Allow to import
next-intl/link
into Server Components without having to add a wrapping Client Component (#465) (21a0691)
- Apply time zone for built-in default formats (
full
,long
,medium
,short
) (#473) (244b9b2), closes #467
- Use correct host and protocol for alternate links when running behind a proxy (
x-forwarded-host
,x-forwarded-proto
) (#462 by @HHongSeungWoo) (747cf8e)
- Handle case where the
locale
param is an array and set cookie expiration to one year (#435) (82e842c)
- Add
localePrefix: 'never'
option for middleware (#388 by @boris-arkenaar) (92ec33a), closes #366
- Forward optional remaining args from Next.js router to wrapped
useRouter
(3ff878c)
- Add
format.list(β¦)
for formatting conjunctions and disjunctions (#327 by @stefanprobst) (32cda32)
Note: Version bump only for package root
2.14.4 (2023-05-22)
- Move JSDoc for
next/link
(b85b6f5)
- Fix support for older Next.js versions by moving
Link
tonext-intl/link
(#288) (f26ef99), closes #287
Note: Version bump only for package root
Note: Version bump only for package root
- Improve warning for invalid namespace characters (7435335)
- Add
BigInt
support foruseFormatter.format()
by @tacomanator (#222) (a5ded6c)
Note: Version bump only for package root
Note: Version bump only for package root
- Add support for using
next-intl
in theapp
folder with Next.js 13 (see https://next-intl-docs.vercel.app/docs/next-13, #144) (18c94d6)
Note: Version bump only for package root
Note: Version bump only for package root
- Provide
createTranslator
andcreateIntl
by extracting a React-agnostic core library. Thanks to David Brands from Marvia for sponsoring the work on this feature, participating in discussion and providing feedback! (#137) (91f7489)
Note: Version bump only for package root
Note: Version bump only for package root
- Adapt TypeScript validation to work with messages files that only have a single top-level namespace (#115) (cf0b83e)
- Overwrite prerelease (6caf5c4)
2.4.0 (2022-02-08)
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
- TypeScript improvements: Use enum type for
style
ofNumberFormatOptions
, only allow passing React children to messages rendered witht.rich
and updatetslib
(#63) (d73e935)
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
- feat!: Use a separate API for rich text formatting to avoid type casting in TypeScript #54 (4c13a64), closes #54
- Instead of using the
t
function for formatting both regular messages and rich text, this function will only work for regular messages now. For rich text you can uset.rich
instead now.
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
1.4.2 (2021-06-16)
1.4.1 (2021-06-16)
- Use correct version range for use-intl (02c33d3)
1.4.0 (2021-06-16)
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
Note: Version bump only for package root
1.3.3 (2021-02-09)
- Fix: Limit the function signature to return strings or React elements
- Fix: Apply interval correctly in
useNow({updateInterval: β¦})
- Feat: Add a global fallback for the
now
parameter offormatRelativeTime
. - Feat: Add
useNow
hook, which can be used in conjunction withformatRelativeTime
to continuously update the result. - Fix: Allow
messages
to be optional on the provider.
- Feat: Added specific types for
DateTimeFormatOptions
.
- Feat: Added support for handling time zones.
- Fix: Use 1.0 version of
use-intl
.
This library is now considered production ready. There are no changes from the previous version.
- Feature: Add global formats (see docs)
- Fix: Export
IntlErrorCode
for JavaScript users.
- Fix: Return a stable function reference for
t
.
- Feature: Add error handling capabilities (see docs)
- Chore: Depend on
use-intl
- BREAKING CHANGE: Rename
NextIntlMessages
toIntlMessages
(TypeScript only)
- Fix: Don't throw for empty messages (
""
).