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

Need an available way to finish formatting works on Windows #1394

Closed
InfyniteHeap opened this issue Oct 20, 2023 · 6 comments · Fixed by #1447
Closed

Need an available way to finish formatting works on Windows #1394

InfyniteHeap opened this issue Oct 20, 2023 · 6 comments · Fixed by #1447

Comments

@InfyniteHeap
Copy link
Contributor

InfyniteHeap commented Oct 20, 2023

Recently I attempted updating translation files (also the .po file in /po folder) and ran dprint fmt on my computer, but when I committed the file, I surprisingly found that the file did not format as the proper form that the repository showed.

Later, @mgeisler told me that the way the msgcat handles translation files is different between Windows and Linux. He also told me to try some values that matches the standard format. Ok, well, I not only tried 79 and other adjacent numbers, but also ran msgcat -o po/xx.po --no-wrap po/xx.po.

But unfortunately, none of these methods have worked.

So, I determined to open this issue after attempting varieties of methods. I hope someone can find out some ways to solve this issue, or it might make contributors who use Windows confused.

@mgeisler
Copy link
Collaborator

Hi @TheBlueAlgae,

Thanks for opening this! We should track the findings of #1381 here so we can find a solution.

Later, @mgeisler told me that the way the msgcat handles translation files is different between Windows and Linux. He also told me to try some values that matches the standard format. Ok, well, I not only tried 79 and other adjacent numbers, but also ran msgcat -o po/xx.po --no-wrap po/xx.po.

More precisely: I'm surprised to see that msgcat apparently works different between the two platforms. That was not what I hoped for since it complicates things a lot for contributors like yourself!

Status Right Now

I'm on Linux and use msgcat from the gettext-0.21-13 package in Debian. We do the same when we test translations, we get Gettext version 0.21 from Ubuntu.

This seems to work well: dprint check reports that all files are formatted correctly.

I will try installing Gettext on a Windows machine somehow. That will allow me to debug what is going on.

In parallel, you could try using Windows Subsystem for Linux (WSL) to install Gettext and the rest of the tools. The default Linux distrubtion is Ubuntu, so it should work very well out of the box.

@mgeisler
Copy link
Collaborator

I will try installing Gettext on a Windows machine somehow. That will allow me to debug what is going on.

I downloaded the Gettext binaries for Windows, I picked the gettext0.21-iconv1.16-static-64.zip to try on a laptop with a recent Windows.

I then downloaded da.po from this repository and I can reproduce the problem: There are subtle differences in how the file is formatted after running it through msgcat! There were 30 differences in the Danish file I used — they were differences in the wrapping of the English msgid fields. It looks like a change in how special characters such as \, +, etc are handled.

Next, I tried downloading a different set of Gettext tools: GNU gettext tools for Windows. The msgcat binary from the latest 0.22 release gives me the same result as what you find in the repository! The binaries there are maintained by the same author who wrote Poedit, so I'm sure they'll be maintained well.

Can you try installing the binaries from that repository instead and tell me if dprint fmt works for you then? If so, we can update the contribution instructions to recommend that repository instead.

@InfyniteHeap
Copy link
Contributor Author

InfyniteHeap commented Oct 23, 2023

Can you try installing the binaries from that repository instead and tell me if dprint fmt works for you then? If so, we can update the contribution instructions to recommend that repository instead.

Ok, I will download the second version of Gettext you mentioned and attempt to format files again. Then I will tell you if that worked well.

This was referenced Oct 23, 2023
henrif75 pushed a commit that referenced this issue Oct 25, 2023
…#1402)

I formatted the translation file on WSL. Worried about being failed
again, so I just improved some translations.

Update: Things seems very nice and I will continue my translating work.
Translation contributors who use Windows OS must use WSL instead of
using `dprint fmt` command on Windows itself, until the resolution that
can make the experience on Windows equal to Linux emerged.

To learn more about that, see this issue: #1394 .

---------

Co-authored-by: Emma Li <[email protected]>
@InfyniteHeap
Copy link
Contributor Author

Can you try installing the binaries from that repository instead and tell me if dprint fmt works for you then? If so, we can update the contribution instructions to recommend that repository instead.

Hi @mgeisler !

I feel so happy that the second version of Gettext Tool you mentioned seems worked well! I used it to format an edited translation file and then made a commit. The file is now passed all checks and is ready to be merged into main branch!

However, I have not verified whether the dprint on Windows can also work well. I directly used msgcat -o zh-CN.po zh-CN.po to test.

In addition, this Gettext Tool does not have a setup program, with some compressions distributed instead. So, after downloading a compression distribution from the Release download page, contributors must decompress it into a directory before using this tool. Then, it is better that add the path where the bin folder is to system environment variables.

@mgeisler
Copy link
Collaborator

I feel so happy that the second version of Gettext Tool you mentioned seems worked well! I used it to format an edited translation file and then made a commit. The file is now passed all checks and is ready to be merged into main branch!

Amazing, this is great news! Thanks a lot for verifying this 😄

In addition, this Gettext Tool does not have a setup program, with some compressions distributed instead. So, after downloading a compression distribution from the Release download page, contributors must decompress it into a directory before using this tool. Then, it is better that add the path where the bin folder is to system environment variables.

It's been a few years since I used Windows regularly... but what you say make sense. Do you think you could write up instructions for where to put the files (if there is a directly commonly found in %PATH%?) or how to update the %PATH% if that's easier?

We now have both Formatting and Preparation as places where we explain how to install the necessary tooling. I would suggest that we unify this into a single location (I'm thinking CONTRIBUTING.md) and then point people to that file from both TRANSLATIONS.md and README.md etc.

@mgeisler
Copy link
Collaborator

I created #1426 to remind ourselves to simplify the setup instructions into one place.

mgeisler added a commit that referenced this issue Nov 5, 2023
mgeisler added a commit that referenced this issue Nov 6, 2023
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 a pull request may close this issue.

2 participants