fix(po-format): remove duplicated references when lineNumbers is false#2509
Conversation
|
@itsyoboieltr is attempting to deploy a commit to the Crowdin Team on Vercel. A member of the Team first needs to authorize it. |
|
@itsyoboieltr hey, all current development happened in the |
| mergedItem.references = | ||
| options.lineNumbers === false | ||
| ? [...new Set(duplicateItems.flatMap((item) => item.references))] | ||
| : duplicateItems.flatMap((item) => item.references) |
There was a problem hiding this comment.
Let's avoid the branching here and just leave the [...new Set(duplicateItems.flatMap((item) => item.references))] the same way as in the po formatter.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #2509 +/- ##
===========================================
+ Coverage 76.66% 89.01% +12.35%
===========================================
Files 81 118 +37
Lines 2083 3315 +1232
Branches 532 977 +445
===========================================
+ Hits 1597 2951 +1354
+ Misses 375 329 -46
+ Partials 111 35 -76 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
270a0c1 to
b4e5bc2
Compare
|
@timofei-iatsenko I reset the branch onto next, reapplied the fix there, and force-pushed. The PR should now be clean against next. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Description
When
lineNumbers: falseis used, extracted PO catalogs currently keep duplicate#:reference lines if the same message appears multiple times in the same file. That creates unnecessary diff noise in source control even though the line numbers have already been intentionally removed.This PR reduces that churn by deduplicating file-only references while preserving their original order.
Changes:
@lingui/format-powhenlineNumbers: false@lingui/format-po-gettextfor themergePlurals: truepath, where merged plural entries could reintroduce duplicate file-only referencesThis keeps the existing behavior unchanged when line numbers are enabled, and only removes repeated file references once multiple locations have collapsed to the same path.
Types of changes
Fixes #2405
Checklist