GDQuest / learn-gdscript

Learn Godot's GDScript programming language from zero, right in your browser, for free.
https://gdquest.github.io/learn-gdscript/
Other
2.11k stars 159 forks source link

Add translation support for practice checks #561

Open NathanLovato opened 2 years ago

NathanLovato commented 2 years ago

For the practice check names we directly process the function names inside of the test scripts. We need to reproduce that when extracting the translation strings.

Wolfy7 commented 2 years ago

Hi Nathan. Can you describe this issue a bit more. I dont get exactly what you mean with

We need to reproduce that when extracting the translation strings.

I guess it has something to do with PracticeTeste.gd or/and maybe with PracticeInfoPanel.gd (set_tests_status)

NathanLovato commented 2 years ago

PracticeTester.gd has a function named _find_test_method_names() Which finds the functions used for testing practices and we then capitalize that and use the generated strings in the user interface to display the requirements the student has to pass in the practice.

These strings are currently not translated at all. They are not even collected when we generate the translation strings in res://i18n/extract.py.

This task thus has two requirements:

For the first requirement, ideally we would have extract.py get every practice check/test name from PracticeTester._find_test_method_names(). We can likely achieve that by calling Godot with a script. The script would instantiate every practice script, get the practice check names, and print them all to the standard output. The Python script could then read them all from the standard output through a pipe.

Does it make sense?

Wolfy7 commented 2 years ago

Hi Nathan. Thanks for clarification. Yes, i had seen _find_test_method_names() but i wasnt really aware of the Python script extract.py and how this is handle all together. I like take a deepe look here: https://github.com/GDQuest/learn-gdscript/blob/main/i18n/working-with-translations.md and also on the extract.py

Yes, it makes sense. But at the moment i´m not familiar with calling Godot with a script to instantiate every practive script and get then the standard output. Therfore a have to get more information how thisi could be done.

NathanLovato commented 2 years ago

In this case, I think this is best if we handle it because we have experienced doing those kinds of things. But thank you very much for offering your help!

Wolfy7 commented 2 years ago

Okay, no problem. Is there any thing i can help with let me know.

If your PR is then ready to solve this, i will may have look at it to get an overview how it works. If i dont forget it 😄