Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: extract multiple comments per translation ID #854

Merged
merged 6 commits into from
Nov 12, 2020

Conversation

Bertg
Copy link
Contributor

@Bertg Bertg commented Nov 11, 2020

This PR resolves #845

On par file level is collects multiple extractedComments (using the same name as pofile package)
This - just like origins - gets merged together to build the catalogue.

Some refactoring was done to use the extractedComments name throughout.

Possible issues

This change should just work for PO file users.
However if users are using lingui file type thing might break. Namely the description (string) is replaced with extractedComments (string[]). Either some backwards compatibility should be built on top of these changes, or sufficient change information should be provided.

What can be improved*

Currently the PO file gets built like with extractedComments and references grouped:

#. Comment in code
#. Other comment
#: App.js:12
#: Screen.js:56
# msgid "Nice"

It would be cool to output them with comment associated with the reference file.

#: App.js:12
#. Comment in code
#: Screen.js:56
#. Other comment
# msgid "Nice"

However, it seems that PO file here is major blocker and this change would be way to much work to achieve.

@vercel
Copy link

vercel bot commented Nov 11, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/lingui-js/js-lingui/7iyybj98h
✅ Preview: https://js-lingui-git-mutiplecomments.lingui-js.vercel.app

@Bertg Bertg changed the title Extract multiple comments per translation ID fix: Extract multiple comments per translation ID Nov 11, 2020
@Bertg Bertg marked this pull request as draft November 11, 2020 22:41
Remove odd choice where extracted comments
where added to translator comments
@codecov
Copy link

codecov bot commented Nov 11, 2020

Codecov Report

Merging #854 (835d5a1) into main (fa9546e) will increase coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #854      +/-   ##
==========================================
+ Coverage   83.01%   83.11%   +0.09%     
==========================================
  Files          51       51              
  Lines        1419     1421       +2     
  Branches      386      388       +2     
==========================================
+ Hits         1178     1181       +3     
+ Misses        142      140       -2     
- Partials       99      100       +1     
Impacted Files Coverage Δ
...ackages/babel-plugin-extract-messages/src/index.ts 84.34% <100.00%> (+0.41%) ⬆️
packages/cli/src/api/catalog.ts 82.98% <100.00%> (+0.51%) ⬆️
packages/cli/src/api/formats/po.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa9546e...835d5a1. Read the comment docs.

Also fix the implementation
Thanks code coverage tool!
@Bertg Bertg marked this pull request as ready for review November 11, 2020 23:15
@tricoder42
Copy link
Contributor

However if users are using lingui file type thing might break.

Well, lingui format was originally just a json dump of the whole catalog, so we could leave there comments as an array.

Copy link
Contributor

@tricoder42 tricoder42 left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you for working on this! 👍

@tricoder42 tricoder42 changed the title fix: Extract multiple comments per translation ID feat: extract multiple comments per translation ID Nov 12, 2020
@tricoder42 tricoder42 merged commit c849c9c into lingui:main Nov 12, 2020
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.

Multiple comments get ignored for same ID
2 participants