Conversation
…lead to wiped out messages
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
useExtracted
useExtracteduseExtracted
amannn
added a commit
that referenced
this pull request
Nov 27, 2025
- #2131 - #2134 - #2128 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Improves the extractor’s catalog loading/saving and message merging to preserve .po metadata/flags and avoid race conditions, with deterministic sorting and a po-parser bump. > > - **Extractor**: > - **CatalogManager**: > - Load catalogs before scanning (`loadCatalogsPromise`); add `reloadLocaleCatalog` and poll-at-save merging to avoid race conditions. > - Store target translations as `ExtractedMessage` maps; merge unknown props (e.g., flags) from disk; do not compare references for change detection. > - Parallelize saves and ensure writes wait for catalogs to load; refactor `save/saveImpl` to return `void`. > - **Deterministic sorting**: use `localeCompare` helper for paths/ids and reference ordering. > - **Formatters**: > - JSON/PO use shared `setNestedProperty`; PO retains and writes back metadata, with stable ordering. > - **Types/Utils**: > - `ExtractedMessage` allows extra properties; add `localeCompare` helper. > - **Tests**: > - Add coverage for race conditions, reference updates across catalogs, flags/metadata preservation and removal, and `srcPath` filtering; refine async test utilities. > - **Dependencies**: > - Bump `po-parser` to `^1.0.2`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 94d7fae. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: DongYun Kang <kdy.1997.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem doc
wiped out messages
user comments
colin 1
I might have run into another issue, but I’m not fully confident because it’s hard to reproduce.
A few times, all translations in a locale were replaced with empty strings. I first saw it while testing the canary build when pt.po translations suddenly got wiped, but I couldn’t reproduce it and assumed I had deleted that file by mistake and it had to be rebuilt.
However, now it happened twice on my branch using 4.5.2. I’ve probably run the build 20+ times and only saw this happen 3 times, so I don’t have a reliable repro. Just mentioning it in case it helps you spot something. This happened twice with my pt.po file and once with es.po, never with the source en.po file.
colin 2
This just happened again when I was setting up this repo on a new MacBook. It happened when I ran pnpm build from the root directory (which uses Turborepo).
I have three translation files there: en.po, es.po, pt.po. Only es.po got wiped out.
This happened only the first time I ran pnpm build. I couldn't reproduce it again. One thing I realized is that this always happened when I was building multiple apps at the same time (using pnpm build with Turborepo). I don't know if it's just a coincidence since that's how I often run builds, though.
julius 1
I was migrating a project from useTranslations to useExtracted. json files set up for useTranslations, and po files for useExtractions.
My process was following: Migrate one component or page to useExtracted, and wait for the other locale to refresh - once that was done I stopped the dev server (when editing target files with Poedit, something crashes in the dev server, which results in the target files only partially updating, or not at all until the dev server is restarted), and added the translations to the target file.
Every time when clicking "Needs work" for some translation in Poedit and starting the dev server, for a split second the nextjs browser tab returned with "fuzzy comments not suppported" before emptying all values in my "de.po" file.
Next.js: 16.0.3
next-intl: 4.5.5
MacOS Tahoe
Macbook Air M3 | Beefy hackintosh
Locales: "en.po" (source) and "de.po"
next.config.ts
request.ts
issue description
Translation files (.po) are intermittently getting wiped out—all translations replaced with empty strings. This affects non-source locale files (pt.po, es.po, de.po) but never the source locale (en.po). It can affect a single locale, while other target locales are not affected.
Observed triggers:
my notes
fuzzy flag is handled in separate pr and shouldnt make difference. colin reports that it happened during builds.
ideas
saveLocale:translations.get(message.id) || ''(line 358) writes empty strings iftranslationsByTargetLocalehasn't loaded yet or is emptyperformInitialScan: CallsloadMessages()thensave(), but ifloadTargetMessages()hasn't completed,saveLocalecould write empty translationsloadTargetMessages(line 170), an empty Map is set before loading messages. Ifsave()runs between these steps, it writes empty stringslastWriteByLocalecheck (line 341-353) can fail with concurrent writes - process A reads file, process B writes, process A writes over itonLocalesChangecallback race: File watcher could trigger while save is in progress, causingloadLocaleMessagesto run concurrently withsaveLocaletodo