-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Create dprint
plugin to format the PO files.
#2529
Comments
The general direction for this task is
So far, I have
Now, I'm developing some unit tests for the plug-in as the test harness checks the stability of the result by translating the result one more time. I also found that polib does not try to format long comment/source lines. |
I think I know why the result is not stable with textwrap. It removes the space when a line is broken at the space. For example,
would be turned into
There's no space after "GitHub" in the third line. So if this result is fed into the formatter again, then it would produce a different result because it see "GitHubcontributors". @mgeisler I think you were right when you suspected that this might be related to mgeisler/textwrap#503 |
Ah, I see what you mean! Thanks for the clear example to reproduce this. I would suggest not using Textwrap at first since preserving the trailing whitespace will require some changes to it :( Specifically, I recently realized that it's not possible to customize the library keep trailing whitespace right now: mgeisler/textwrap#572 (comment). You're very welcome to dive in and fix this, of course 😄. In case it's useful, the crate includes a very simple wrapping example. It also doesn't preserve trailing whitespace, but it should be easy to fix by replacing the |
Create a stable format plugin for PO files using
dprint
.The text was updated successfully, but these errors were encountered: