r-cute / rcute-cozmars-server

firmware for Cozmars robot
44 stars 19 forks source link

Use .cozmars directory #15

Closed anjok closed 3 years ago

anjok commented 3 years ago
anjok commented 3 years ago

Actually, please don't pull this yet as I can't test any of this due of a lack of a configured raspi. I still need some parts.

But I can't use different branches for the different issues as I don't know your schedule and the changes almost all overlap.

So what I did here:

The next step is to generate the locales/base.dot file and add the various translations.

But if possible, don't create conflicts for me for the next few days...

anjok commented 3 years ago

Unfortunately you would need to regenerate the Chinese text from the to-be-created gettext files. Since I have no idea what the characters are, I would just create a mess and it would take ages.

anjok commented 3 years ago

@hyansuper ok, localisation seems to work now. It would be great if you could take a look.

hyansuper commented 3 years ago

thank you for the effort, I am looking at it. I have not used gettext before, may take a while

anjok commented 3 years ago

Please re-fetch the PR, I squashed the commits and rebased on your latest code.

Note that it's very hard for me to merge incoming changes of yours into my branch as I have no idea what your code actually spells... so please decide soon if you want to do the localisation or not. If not, I have to keep my own fork and won't be able to contribute.

I was working with this here:

https://phrase.com/blog/posts/translate-python-gnu-gettext/

it's basically:

cd rcute_cozmars_server 
(wherever this is)/pygettext.py -d base -o locales/base.pot *.py *.html

Then generate loc files for each non-english language and fill in the blanks. It's really easy to use. I hacked it so that it also works in the html files.

You'd need to proofread the English (as they are the keys, they need to be pretty good and I really don't know what the text was saying before), rerun the pygettext.py and then fill in the generated Chinese.

I have a similar patch for the other two projects, but will make PRs only if you don't make changes before you pull them I just can't see what you are doing when you write Chinese :)

hyansuper commented 3 years ago

sorry I made some duplicated change requests

anjok commented 3 years ago

ok, will fix and push later

anjok commented 3 years ago

@hyansuper please review again.

anjok commented 3 years ago

also, see:

https://stackoverflow.com/questions/27214065/how-to-docstring-in-python-for-multiple-languages

for the doctoring comments. These would be good for the other two projects.

hyansuper commented 3 years ago

@anjok did you have to hack pygettext.py in order to handle .html? I think this command also works pygettext -d base -o locales/base.pot *.py static/*.html but a few english aren't extracted in html, especially those in javascript, maybe it has to do with "quote in quote in quoat...". I have to manually type into .pot file

anjok commented 3 years ago

Oh ok. I didn't verify it got everything. Worst case one need to put the error strings in a server side duct