-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Automated Build System to Check and Integrate Language Translations #813
Comments
Hi NathanLovato, Thanks for this. As I'm not familiar with build systems, also considering this is my first open-source contribution, may I ask further guidance on following points ?
If the script runs locally :
If the script does not runs locally :
Finally (...for now...) Can you assign this to me ? Thanks in advance for your help ! |
Thanks for following-up, Nicolas. Here are the answers to your questions. The bulk of the work involved in this task is for step 6. The 6 steps were presented just to explain the translation workflow from a technical standpoint. Most of the code for steps one through four is done already so there is little to do there: The primary things we need a Python program for are, before making a release:
We should be able to run this program locally and manually to report on incomplete translations and get proper warnings. Then, optionally, the program should be able to incorporate the translation files into the released app as described in the issue description (the second bullet list) through command line options. The command line option should allow us to specify the path to the Godot project's directory, which will be necessary for the script to work on different computers and via GitHub actions. The github actions part should be a separate task, and probably something we should handle once the python program is done, because it would involve updating our existing release build action, which my teammate is comfortable changing already. Given the Python program it's just a bit of glue bash code. Now answering more specific questions:
Please let me know if you have any other questions. |
Great, I think I have a much better understanding now, thanks !
From your description I'm more thinking of two scripts : I'll keep you posted on my progress. |
There's no need for flexibility here, so a single script would be more efficient. Importantly, you never want to integrate translations without checking their completion first. There's a hard dependency there. So having two scripts could lead to a user mistake that the program shouldn't allow. Or if you add code to prevent mistakes, then usage + code are a little bit more complicated for a benefit we'll never use. I'd make it work like this:
|
Ok, thanks for you're feedback. I'll go with this solution. |
Thanks. Please don't worry about asking questions. They're welcome! If you've already worked with git and you know how to work with branches, this guide will explain how to create a pull request, which is a way to submit your work for review and integration into an open-source project on github:
You don't necessarily need to create new branches to contribute to open-source projects. Creating branches is mostly a good practice when a project has lots of activity. What you do need to do, though, is fork the project because you need to work on your own copy of the files and submit them via a pull request. If you do want to create a branch, you can do so directly on github. Here's a guide for this:
I hope this helps |
Hi NathanLovato, I'm currently digging into your code, more specifically the
If I'm correct, the parsing operation done in Also I didn't get the meaning of Regards, |
Thinking this further, does it really makes sense to integrate a language that has empty msgstr values ? Shouldn't we exclude a language as soon as it has some untranslated string and compute the completion indicator only on the Or should we be able to choose a behavior through command's options ? |
I have applied the algorithm detailed above, and obtained following output (after extract and sync outputs) :
Note that this is a raw print of my result dict for now. I will improve the readability. Should I output a result per PO file ? For the moment I simply imported the parse function with |
How come that the number of total strings is not constant among the different languages ? |
Hi have done further progress. Here is an example output :
For now I opted for a completion indicator only on the missing strings basis, with this precision on fuzzies. But of course it is easy to change and adapt for any formula that would suits the team. The copy is not effective for now, it is solely displaying folders that would be integrated without actually doing it. If you want to check the code, it is present in my forked repo for now : https://github.com/ml4nC3/learn-gdscript/blob/main/i18n/check_and_integrate_translations.py Let me know if this fits what you expected or not. EDIT : Spanish at 60% feels pretty low for a language that is currently considered as complete... Is there something to investigate here ? |
Sounds great, and your task is to code points 4 to 6, which is what you've been working on so far it seems. So perfect.
If I remember correctly it is a tag added by the Python library that extracts text strings from GDScript and scene files in Godot. This library is used in
There's something to investigate, yes. Several languages which supposedly had all entries translated are showing 60% completion. FR, ES, IT, etc. had complete translations. The fuzzy count seems about right as we tweaked many sentences in the source app that now need review. There are certainly a couple of new entries since these translations were done, but not 40%.
It can be, yes, but it's something to consider. For one, if there are just a handful of translations missing, and a language doesn´t have translators, users could still benefit from a 90%+ complete translation. Then, translators/the community generally works linearly through lessons. So they might have lessons 1 through 12 translated, and 13 and up unfinished. In this case too for users who don´t speak english, 12 lessons is better than 0 I think. Another possible task after closing this issue would be outputting metadata that the app could use to tell users if a translation is complete or not at runtime and how to contribute translations. But it´s perhaps a stretch considering that we'll be working on the Godot 4 remake of this app. |
This can be due to POT and PO files not having been synced since a good while. Especially as some languages get added via a web platform, weblate. Unfortunately, we constantly have more on our plates than we can handle, so in the absence of fully automated systems or contributors giving us a hand, we can't keep up with some manual things we have to do (we have... 70 open-source repositories I think these days? Can't keep up with that with a team of only 4 full-time) |
Thanks for your feedback !
I've spent a bit of time to understand what's going on. From what I've seen there is mismatches in I also have noticed a strange behavior on language loading in the app. Switching to Spanish gave me first a complete translations, When I switched to French lot of sentences where not found and displayed although I was able to find them in the PO file. Srtange thing, when I switched back to Spanish the sentences untranslated where the same than French... I'll play further with this scenario to try to understand what's going on. |
On this string break issue, it seems it is linked to a default behavior from The documentation says :
In
And it is indeed stopping the POT file from having lines wrapped. However it is only half way to the solution because current PO files are already created with lines wrapped, so the Hence I'm seeing two approaches for a full resolution :
Let me know how you feel about this. Am I getting too far ? From this point I'll wait for your feedback before progressing further. |
Okay, let me know !
My gut feeling is that the application should not be sensible to such a difference. Furthermore it is a default behavior in I'll go first confirming my hypothesis on how the application reads the strings and see if there is a simple way of tweeking it. This is also an occasion for me to dive in the UI usage of Godot which is my short term goal right now !
I have absolutely no issue letting someone changing my code. Open source is meant to be collaborative, and it is crucial that the core team ensure it's appropriation of anything part of their code base. Just let me know what have been done and why, I'm here to learn !
Okay, I'll check that first. I guess it would be for the better that you review what I did up to now, but I'm not yet comfortable with the process : is it fine if I send you some code although the solution is not yet fully functional ? Next step for me is to read that Pull request guide you shared earlier and I'll get back to you on that. |
Sounds great, go for it then!
I would think this default to be more of an artifact of old guidelines, with code editors not supporting long lines and line wrapping too well in the past. Even not so far back, I've been using Emacs for some years and long line support and solid line wrapping wasn't quite there yet when I started using it... around 2016 or so. We would wrap lines like this on the Godot documentation, and there isn't really a need for it anymore other than staying consistent with documents from 9 years ago.
Actually, it's completely fine if you prefer to wait to be further along before creating a pull request. Whatever works.
I truly appreciate not only the time and efforts you're putting into this, but also the great mindset and communication. Thank you very much for that! |
I've sent a Pull Request more as a test to see how it is going than an actual request. I've seen there is a requirement on commit messages that I might not have respected. I will probably have to correct that at least, but do let me know if there is something else. |
Thank you very much! I will review and test your code as soon as possible.
Please don't worry about that. I can change the message upon merging the pull request. |
…ons (#814) fix #813 Co-authored-by: nicolas <[email protected]> Co-authored-by: Nathan Lovato <[email protected]>
Issue: We need a build system that can automatically check if translations for a given language are (nearly) complete and integrate those translations into the app. This build script should be able to add or remove languages automatically depending on the completion level of a given language.
Workflow:
i18n/extract.py
from the project's root folder.sync_translations.py
to update all the PO files which contain the actual translations per language.We need to ensure that lessons are fully translated (maybe over 90% or 95% translated is OK) before integrating translation files into the app. This feature should be included as part of the build script. The script should also warn about languages with outdated or incomplete translations.
To register languages in the app (show in menu), you can:
Unfortunately, tooling for PO files is not great, so I suggest implementing our mini-parser to check the completion percentage. A minimal parser is available on this link: https://github.com/GDQuest/learn-gdscript/blob/b53ba8e1cc5da074520b0e061c50c02d2a5fe3fc/i18n/match_and_merge_po_translations.py
It can be used as a base to read entries and calculate the translation percentage. In PO files, entries that need translation have the
fuzzy
keyword. I think that's all we need to check but be sure to double-check if other cases exist.The text was updated successfully, but these errors were encountered: