Partial extractions have some unexpected results
See original GitHub issueDescribe the bug
Running lingui extract
on certain files (using either husky or running manually) is giving some unexpected results.
- it looks like obsolete translations aren’t being marked as obsolete (
#~msgid ""
) - unrelated file path comments are being removed in other unrelated translations
Regarding the second point, I haven’t seen this happening in our example repo used below, but it might just be the fact that there are very few strings involved. In our real project, we have lots of entries which are grouped together by msgid
and have file location comments above.
~I’ll try to make a reproducible example of this when I can.~ EDIT: There is now a reproducible example in comments.
To Reproduce
From our example project:
We changed a text from {t`Version ${version}`}
to {t`App version ${version}`}
.
Running lingui extract src/login/view/Login.tsx
resulted in this:
https://github.com/kerlends/lingui-extract-bug/commit/4cec61a2b3698fb13819ca935dbc1f2646c36c05
Running lingui extract
resulted in this:
https://github.com/kerlends/lingui-extract-bug/commit/ffb6413d5eb2fd15836e1856ac95b4ddccb6c071
Try yourself:
git clone https://github.com/kerlends/lingui-extract-bug.git
git checkout text-changed-without-extracting
lingui extract src/login/view/Login.tsx
git diff
git checkout -- .
lingui extract
git diff
Expected behavior Partial extraction should mark the previous message obsolete if not used elsewhere. Partial extraction should not remove comments from unrelated translations
- jsLingui version
3.12.1
- Babel version
@babel/core@7.15.5
Create React App 4.0.3
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
We have a bot that marks issues as wontfix after no activity, but indeed this is a bug and shoudn’t be closed. I’ll try to get some time for Lingui asap.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.