-
Notifications
You must be signed in to change notification settings - Fork 379
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: adds custom prefix support for gettext po #2004
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
Could you elaborate a bit on the motivation and rationale of this feature? |
The main reason is for my TMS - there are times the i.e.
will turn into
And parsing breaks because it can't find the comment with prefix. Alternatively I could try to change this to support multi line comments |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2004 +/- ##
==========================================
- Coverage 76.65% 75.59% -1.06%
==========================================
Files 81 88 +7
Lines 2090 2172 +82
Branches 533 551 +18
==========================================
+ Hits 1602 1642 +40
- Misses 375 419 +44
+ Partials 113 111 -2 ☔ View full report in Codecov by Sentry. |
It seems that |
I wonder (based on the given description) if this is something that rather should be fixed on the TMS side, rather than working around their problem in this lib? And if this is to be merged, docs need to be added. |
No, because it breaks in my TMS only because of the line length. PO files are recommended to split on 80 characters, so if your comment is less than that theres no problem. URL encoded ICU strings are likely to be split because they are so long. Changing the comment to NOT include a dash ( I don't know the history/support for the 80 character standard, I think it originates from GNU gettext that does the line splitting as well. -- as I'm writing this, I just tested and confirmed that gettext does split on 80 characters.
The above answer is really the only reason why I think it should be supported on lingui - if the standard is 80 character lines, then this isn't a TMS specific issue, it's a PO standard that should be supported (maybe not by doing custom prefix, because that's hacky, but by supporting multi-line icu comments) I might spend some time today looking at supporting multi line icu comments
Yeah, will add docs soon, just wanted to check with the lingui team if this is something you want to merge. |
Supporting line split comments is nontrivial as well, for cases like this:
|
@garikkh is attempting to deploy a commit to the lingui Team on Vercel. A member of the Team first needs to authorize it. |
@garikkh thanks for your investigation. Something new for me. Now, it's more or less clear why your TMS is behaving like that and that is worth to fix. I think to avoid this it's better in general to change "-" to "_" underscores, but this will cause a big breaking changes for existing users. |
@timofei-iatsenko can I get your review on this? Is there anything else I should add to get this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garikkh thanks for the contribution!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garikkh thank you!
Description
Adds support for custom prefixes in
po-gettext
formatter generated comments.Types of changes
Checklist