All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
- Remove TypeScript peer dependency and update examples to TypeScript v6 (#2293) (5e7bcd7) β by @wojtekmaj
- Avoid throwing config errors for non-Next.js consumers of
next.config.ts(#2245) (f57800e) β by @amannn
- Custom formats for
useExtracted, consistency fixes for file references, pruning of messages and sorting of keys (#2155) (c02818e) β by @amannn
- Skip
accept-languageparsing when locale cookie is already present (#2143) (0d1331b), closes #2116 β by @lxup
- Move AST transformer of
useExtractedto SWC plugin & handle source maps (#2114) (e63fbc5) β by @amannn
- Avoid partial matches in overlapping localized pathnames (#2090) (c276c80), closes #2089 #2089 β by @amannn
- Prefix pathnames when switching with
useRouterto another locale (#2021) (c82d0af), closes #2020 β by @amannn
- Avoid
usePathnameinconsistency in Next.js leading to a hydration error with custom prefixes,localePrefix: 'always'and static rendering (#2012) (bc9cb62), closes #2011 vercel/next.js#73085 #1571 β by @hugotiger
- Ensure messages declaration continues working in
next devfor upcomingnext@15.5.1(#2008) (2bf09ec) β by @amannn
- Don't create messages declaration file when running
next {start,info,telemetry}(#1992) (fd0722a) β by @amannn
- Correctly compile messages containing escaped curly braces (e.g.
'{name'}) (#1950) (4d418f4), closes #1948 β by @amannn
- Add friendly error message when failing to load current Next.js version (#1945) (5021773) β by @cupofjoakim
- Support BigInt for
numberinterpolation withuseTranslations(#1929) (a893330), closes #1928 β by @sgleisner
- Encode non-ASCII characters in pathnames returned from navigation APIs (#1923) (3d23c61) β by @amannn
- Handle default exports correctly for
moduleResolution: 'node'(#1785) (b7a4a83), closes /github.com/amannn/next-intl/discussions/1631#discussioncomment-12477848 β by @amannn
See the announcement.
(#1412) (172656f) β by @amannn
- Handle
queryin<Link />correctly when usinglocalePrefix: 'as-needed'withdomains(#1732) (ec8776e), closes #1731 β by @amannn
- Support
t.haswhengetTranslationsis called with an object argument (#1616) (64895a2), closes /github.com/amannn/next-intl/discussions/437#discussioncomment-11593318 β by @amannn
- 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
usePathnamewith 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.tsinreact-serverlike 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
ReactNodeArraywhich is removed in React 19 (#1445) (2396345) β by @amannn
- feat:
createNavigation(#1316) - feat: Add async
requestLocaleparam to getRequestConfig for Next.js 15 support (#1383) - feat: Add
localeCookieoption 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
localeis read ingetRequestConfigand also none is returned (#1305) (2f0f781) β by @amannn
- Lazy init message formatter for improved tree shaking in case
useTranslationsis 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
useMemoforuseRouterreturned fromcreateLocalizedPathnamesNavigationto keep a stable reference when possible (#1201) (a1b9a36), closes #1198 β by @amannn
- Prefer more specific routes in
usePathnamewhen detecting the currently active pathname for localized pathnames (#1152) (936839e), closes #1151 β by @amannn
Note: Version bump only for package root
- Remove
@formatjs/ecma402-abstractdependency in favor of the automatically bundled one fromintl-messageformat(#1141) β by @amannn
- Handle external URLs passed to
redirectandpermanentRedirect(#1084 by @mhogeveen) (16b55e2)
- Print a warning in case the middleware didn't run on a request but APIs from
next-intlare used (#1045) (8149955)
- Correctly parse date skeleton
EEEEto a long weekday like "Tuesday" (upgrades tointl-messageformat@10internally) (#1039) (d6b5fd2)
- Automatically prefer localized pathnames that are more specific (#983 by @fkapsahili) (88a9b7a)
- When using domain-based routing, use
defaultLocaleof 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
replaceAlltoreplace(#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
basePathcorrectly inuseRouterfunctions (#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
permanentRedirectin navigation APIs (#850 by @polvallverdu) (6508ddc)
- Improve RSC render performance by sharing a cache between
getTranslationsanduseTranslations(#798 by @fkapsahili) (73e8337)
- Remove
x-defaultalternate links entry for non-root pathnames when usinglocalePrefix: 'always'(#805) (c5bb0f5)
- Make options for
createSharedPathnamesNavigationalong withlocalesargument optional (relevant whenlocalesaren'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
timeZonewhen 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
useTranslationsin 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
localefromNextIntlClientProviderwhen usinguseLocalein Client Components.useParams().localeis still used as a fallback. (#691) (e00ed97), closes #688
- Allow to call
getRequestConfigin outer module closure in a Client Component module graph (#687) (0f16f10), closes #685
- Allow to import
next-intl/serverinto Client Components (however not call any functions). This allows for easier testing of page components with multiple exports. (#683) (5ca4075), closes #681
- Add
localePrefixfor navigation APIs for an improved initial render ofLinkwhen 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,nowandtimeZoneif 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
timeZoneis specified and downgrade error handling for missingnowvalue from throwing to reporting an error (#519) (dc55ab2)
- Improve runtime performance of
useTranslationsby 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/linkinto 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
localeparam 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
Linktonext-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
BigIntsupport 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-intlin theappfolder 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
createTranslatorandcreateIntlby 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
styleofNumberFormatOptions, only allow passing React children to messages rendered witht.richand 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
tfunction for formatting both regular messages and rich text, this function will only work for regular messages now. For rich text you can uset.richinstead 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
nowparameter offormatRelativeTime. - Feat: Add
useNowhook, which can be used in conjunction withformatRelativeTimeto continuously update the result. - Fix: Allow
messagesto 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
IntlErrorCodefor 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
NextIntlMessagestoIntlMessages(TypeScript only)
- Fix: Don't throw for empty messages (
"").