-
Notifications
You must be signed in to change notification settings - Fork 104
Prepare project to use Zanata for translations #362
Conversation
* Done by running `setup.py exup_messages`
* These lines doesn't seem to be accepted by Zanata import, most likely a bug of their import code. I'm deleting them to work around that issue.
* Also makes some refactoring... * Cleanup import list * Create a new method to execute other Commands that have to be called with parameters (not provided by distutils :/) * Avoid some line breaks using 99chars per line * Refactor ExtractUpdateMessages with the new run_other_command() * Rerganize setup() call to have better indentation * Make PyInstaller overwrite previous "dist/launcher" with no confirmation
* Be careful, this action is destructive and replaces translations on the server. Useful to bootstrap a new version / project.
That seems like a nice idea. Let me check the current state of Zanata. |
I contacted Transifex and they said that we qualify for an Open Source license. We can use their services for free. What do you think? Should we go with them? They say they have the largest translation community. |
Yes, Transifex is probably better. I doubt the Zanata project is going down any time soon, and the feature set does seem currently stable, but it would be better to be in the safer side. I'll check some Transifex documentation and see how we can push/pull Translations (if they even have such an API, which I bet they do) |
Can you create an organization / project for CDDA Launcher and invite me? Also, If you give me "Project Maintainer" Role could probably let me do some tests (I wanna add some new From what I read so far, the workflow is similar:
|
I'll create the organization in the next few minutes. |
What is your Transfinex username? If you don't have one, just create one by using their "Try for free" link I guess. It would probably be a good idea to reuse your github login with their system. |
Same as here: KurzedMetal |
Transifex seems to have some kind of Github integration where Transifex can push and pull directly on Github. I'm trying to activate it. That might help. If not let me know. |
Yes, you can configure Transifex to automatically check changes in a hosted file (like the .pot file in github master branch), and they check it twice a day. Your choice, both will probably work, you can probably even use both I guess. |
I was just trying to setup the GitHub integration but I don't think I succeeded. I see that you started adding some resources. I'll let you explore more of it and come back later. |
Yes, I was testing the I'll use those Anyways, I should have something soon, as it's very similar as what I had with Zanata. |
Good stuff. There are various ways of configuring the GitHub integration. I've set it to create pull requests instead of directly pushing into the repository. We might also need to tweak the .gitignore file to keep that pot file around. |
I created the new commands for Transifex, so now, the workflow should be like:
I also left around the code/configuration for Zanata, in case you want to use them in the future, but I could purge all reference of it if you want, your choice. As for the automated way to push new strings to Transifex, I realized that it would require you to run |
Yeah, that is a good idea. We could only translate that single simple phrase for everyone and keep the canonical license in English. |
Ok, I'm dead serious now :P that was the last push. ;P EDIT: Oh I noticed you managed to find where to add translators. |
I totally missed that before. If you don't squash the PR commits, the Zanata stuff will stay in the history anyways. |
* The more important part here is being able to translate "Build" word on the Changelog, this will make it match with other parts of the UI and avoid user confusion.
* We reuse existing used strings instead of generating a new one just for this section.
It seems I hit a babel bug when using Due to this, I'm getting the I'd really hate workaround it by changing the message, I was checking if I could pass some option to babel to avoid this but I couldn't find it so far. IMO we really don't need the %x formatting ever (I think you used that format syntax in a single line in the whole code and we could change it). EDIT: To summarize, babel is not handling correctly strings with |
* This is to workaround a bug in babel.compile_catalog which is doing string format check between "100% free software" and "100% software libre" thinking we are trying to convert from a "% f" (float) to a "% s" (string) and give us a validation error. I didn't find a way to disable this behaviour in babel.compile_catalog and thus the workaround. Keep in mind that this could be an issue in future translatable strings.
I'm confused about this part in def load_gettext_locale(locale_dir, locale, domain='cddagl'):
"""Load gettext into the application with specified locale file.
Fallback to default untranslated strings if locale file is not found.
"""
if locale == 'en':
return load_gettext_no_locale() Why are we not loading all the locales if en is selected? Why is 'en' the value for when we cannot find the locales? Would it not be possible for 'en' to be a normal value and we still need to load the locales at that point in load_gettext_locale? |
Until now, the code depended on an empty When 'en' was loaded, it was actually provided with an empty file (well, actually not "empty", but with no translations, but an empty file would have the same effect). That made the code use the translations found in the source code instead of the non-existent translations in the empty With two small changes, I made the code not depend on the empty Basically, that change add two lines of code to avoid having an useless empty file. There's no point in having a |
That issue happened because you still have the empty english Since the |
Alright, good to know. |
Seems good. Merging. |
May I translate it into Chinese?I have already requested on transifex. |
@chuanyueyouxia Sure! Let me check it out on Transifex and setup Chinese there. |
@chuanyueyouxia There are various forms of Chinese in the localization world. I know that you requested zh_CN but would it make sense to do others as well like one of these:
I know that there can be some subtle differences from region to region but it might not be worth to do them. For instance, I'm French Canadian. We have this fr_CA code here but there are multiple french variants like fr_FR (French from France), fr-BE (French in Belgium), etc. Since there are not enough differences, I decided to go for the generic fr code. Let me know what you think about the Chinese language for this. Also, I would need the email address or the username you used to create your profile on Transifex so I can add you to the Chinese translation team as a translator. Thanks |
I think I was able to add you to the correct team with the proper role on Transifex now so I will not need your username or email. If you need help with the translation or if there is something you don't understand, let us know. It can be somewhat difficult with the various codes and markups that are used. We'll be happy to help you out @chuanyueyouxia ! |
@remyroy Thanks! |
I think zh_HANS might be the generic simplified one that we are looking for. I'll switch to that one on Transifex and add you there on that team too. |
@chuanyueyouxia The switch to zh_HANS from zh_CN is completed on Transifex. You should be good now to start translating. Thanks |
Thanks a lot, @remyroy . You've been great! |
I realized that with the recent refactors I made, I was changing some translation strings and they needed to be re-translated. Suddenly I realized some translations haven't been updated in a while and the project don't have an easy way to receive translation contributions without fiddling with gettext tools... Let's be real, potential contributors to translatation are pushed off if they need to actually fiddle with tons of tools instead of actually translating, most of them aren't even tech savvy or devs...
I always thought that web tools for translation like Transifex were super cool and wanted to configurate one of these services for CDDA Launcher. I checked Transifex (which is actually used by CDDA itself too), but they require an "approved" registration for open source projects as the service is usually paid. So I googled around and I found Zanata, which seems a similar open source service with less registration hassle.
I already configured everything the project needs to push and get translation from this page.
The workflow would be:
setup.py zanata_expush
to extract strings and push them to Zanata servicesetup.py zanata_pull --approved-only
to get all the strings you approved in the web interface. Or no--approved-only
and you get everything anyways.setup.py create_installer
it would include the new translations (no need to do anything else).I already setup a temporary page for the project, so you could see it, register and join to check (cdda-launcher-test in Zanata). But if you want you can register your own and just change the configuration files (just so you can get the ownership of it, since it's your project)
If you wanna create your own, you only need to: create an account, create a project, add a version, update the
zanata.xml
file and configure your client (take a good look at that link, it's how you setup the client in your PC) and runsetup.py zanata_expush
. If you want to boostrap your new project and upload existing translations too you need to executesetup.py zanata_push --push-translations
too (this is only for an initial setup, because it overwrites translations in the server)A note worth mentioning: after I had a good progress in the configuration and almost everything working, I noticed some bad news around, Zanata was an open source project sponsored by Red Hat, but it seems they pulled the main devs from the projects a few months ago. The Zanata project seems mature and still hosted, so at least for now it works and it's better than you had before. But if you wanna try other service or maybe try getting a Transifex account for this project, maybe I could help setting it up too.