Skip to content

Conversation

@amannn
Copy link
Owner

@amannn amannn commented Nov 5, 2025

# Conflicts:
#	packages/next-intl/.size-limit.ts
#	packages/next-intl/__mocks__/react.tsx
#	packages/next-intl/src/navigation/shared/createSharedNavigationFns.tsx
#	packages/next-intl/src/react-server/index.test.tsx
#	packages/next-intl/src/server/react-server/RequestLocale.tsx
#	packages/next-intl/src/server/react-server/getConfig.tsx
In Next.js 15.3, [Turbopack config has become
stable](https://nextjs.org/blog/next-15-3#turbopack-configuration-in-nextconfigts-stable).
With this fix, the new option is used in order to avoid a deprecation
warning.
# Conflicts:
#	packages/next-intl/src/plugin/getNextConfig.tsx
…on APIs (#1922)

With #959, the middleware
already handled decoding of non-ASCII characters.

This allows you to define localized
[`pathnames`](https://next-intl.dev/docs/routing#pathnames) like so:

```tsx
import {defineRouting} from 'next-intl/routing';
 
export const routing = defineRouting({
  locales: ['en', 'ja'],
  defaultLocale: 'en',
  pathnames: {
    '/about': {
      'de': '/über-uns'
  }
}
```

Since Next.js automatically encodes incoming pathnames, this supports
incoming requests both for decoded pathnames (e.g. `/de/über-uns`), as
well as encoded ones (e.g. `/de/%C3%BCber-uns`).

One piece has been missing though: Pathnames returned from [navigation
APIs](https://next-intl.dev/docs/routing/navigation) should be turned
into an encoded form.

Now, `next-intl` handles this as well:

```tsx
import {Link, getPathname} from '@/i18n/navigation';

// href="/de/%C3%BCber-uns"
<Link href="/about" locale="de" />

// pathname = "/de/%C3%BCber-uns"
const pathname = getPathname({href: '/about', locale: 'de'});
```

This change brings the navigation APIs in line with [Google's
recommendation to encode non-ASCII
pathnames](https://developers.google.com/search/docs/crawling-indexing/url-structure).
# Conflicts:
#	examples/example-app-router-playground/tests/main.spec.ts
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Introduces an experimental message extraction pipeline (JSON/PO) with
new `useExtracted`/`getExtracted` APIs, Turbopack/Webpack loaders, and
an example app showcasing it.
> 
> - **Experimental extraction**:
> - Add extractor core (`src/extractor/*`): compiler, catalog
manager/locales/persister, save scheduler, SWC-based message extractor,
formatters (JSON/PO), utilities, and public export
`next-intl/extractor`.
> - New loaders: `extractor/extractionLoader` and
`extractor/catalogLoader` (+ `.d.ts` shims).
> - **Plugin/Config**:
> - Extend plugin to wire loaders and rules for Turbopack/Webpack; add
`experimental.srcPath`, `messages` and `extract` options; refactor next
flags (`hasStableTurboConfig`, `isNextJs16OrHigher`).
>   - Adjust rollup build and type exposure; size-limit tweaks.
> - **APIs**:
> - React: export `useExtracted` (client/server) and server
`getExtracted`; client re-exports from `use-intl/react`.
> - **Examples/Tests**:
> - New example `examples/example-app-router-extracted` demonstrating
extraction; extensive extractor tests.
>   - Bump `examples/example-use-intl` to `use-intl@^4`.
> - **Misc**:
> - Package metadata/exports/files updates; add `@swc/core` and
`@types/webpack` dev dep; remove obsolete example config.
>   - Tools: simplify side-effect import stripping in build script.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
db387c4. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@vercel
Copy link

vercel bot commented Nov 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
next-intl-docs Ready Ready Preview Comment Nov 7, 2025 2:51pm
next-intl-example-app-router Ready Ready Preview Comment Nov 7, 2025 2:51pm
next-intl-example-app-router-without-i18n-routing Ready Ready Preview Comment Nov 7, 2025 2:51pm

@amannn amannn marked this pull request as ready for review November 5, 2025 14:30
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 27

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

typeof current[key] !== 'object' ||
current[key] === null
) {
current[key] = {};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Breaking Nested Keys Overwrite Non-Objects

The function doesn't handle the case where an intermediate key already exists with a non-object value (like a string). If current[key] is a string and the code tries to set a nested property under it, the existing string value will be overwritten with an empty object {}, causing data loss. For example, if "a" is set to "value1" and then "a.b" is set to "value2", the original "a" value will be lost. The condition should check if current[key] is already a string and either throw an error or handle the conflict appropriately.

Fix in Cursor Fix in Web

continue;
}

// Multi-line strings are not supported in entry mode
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Metadata detection fails with out-of-order msgid/ msgstr

The metadata detection logic checks entry.msgid === '' when processing msgstr, but if msgstr appears before msgid in the file, entry.msgid will be undefined rather than an empty string. This causes the parser to fail to recognize metadata entries when msgstr "" appears before msgid "", despite the parser supporting flexible msgid/msgstr ordering as shown in the test suite.

Fix in Cursor Fix in Web

@amannn amannn merged commit 7a85644 into main Nov 7, 2025
10 checks passed
@amannn amannn mentioned this pull request Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants