On 1/21/2021 1:14 PM, sylvain@... wrote:
Thanks for your great work!
I am on Fedora 33 now and I missed D-Rats so much as I have a
ratflector on a Raspberry Pi in a closet.
Few years ago I had a Python course, but I am really not good at it. If I can help for something let me know.
Personnaly, I would love to translate D-Rats in French, but it's
maybe not the right time to work on it and any ways, I reallly don't
know where to start.
I would not start with d-rats for learning how to do the translation.
I would start with a simple "hello world" type program in python and look at the on-line tutorials for using gettext.
As I understand it the procedure (Don't have development code handy here) roughly is:
You have to import gettext
You have to call some methods to setup the locale and this is important, the fallback for if the locale is not found. It seems by default the fallback is not enabled.
I also really have not done more than get the d-rats unit-tests from failing because the locale setup and fallback were not setup, so I am just learning this too.
But as I understand it, the way it works is that in the program instead of outputting strings to the user like "Hello World" and "Ok", "Cancel", etc, you put the strings in a special function named with an underscore characters, that is "_("Hello World").
The string in the function is then used as an index to look up a replacement string a locale specific file or database.
If the look up fails, it just outputs the string passed to it.
Since the strings are usually in English, that means for programmers of that language, like me, we don't need to learn much more than that.
But really the best way for even English language programmers is to use keywords for the strings and build an English local database file of all the text contents. This would give a quick guide to other translators, because they would not have to look up all the strings in the program.
Now for a GUI like D-RATS, there are "*.glade" files that contain string contants. GTK3 can be told to translate them, but those also need to be found and put in the database.
73,
-John
wb8tyw@.../wb8tyw@...