Since my last post, many people donated their time to translate my project wxBanker, and I have 7 translations in Launchpad now! (If anyone wants to add more, please do so, and I'll put you in the credits.) Now I'll outline the steps for actually integrating these translations into your project.
- Download the translations. Visit the translations page for your project in Launchpad, and click the "Download translations" link on the right. From here ensure "Everything" is selected, and change the Format to "MO format". This format is what the gettext framework we are using utilizes. Now click "Request Download". They won't typically be available immediately, but you should receive an e-mail in an hour or so with a link to the file.
- Once you receive the email from Launchpad, download the linked file. You should now have launchpad-export.tar.gz. Right click on it and "Extract Here". Rename the resulting "launchpad-export" folder to something like "locales", and put it in your project directory.
- Now all you have to do is tell gettext where the translations are. Previously we installed gettext via a line like gettext.install("wxbanker"), and now all we need to do is pass in the directory as a second argument. So assuming you renamed the launchpad-export directory to "locales" and put it in the directory of your source code, you'll change it to gettext.install("wxbanker", "locales"). This isn't the most robust and flexible way to do this, and I would recommend checking out my localization.py link below for a better example, especially if you are going to be doing this for a python application.
In a day or two I will also add a post on how to actually install other locales in Ubuntu and run your application in it, so that you can ensure you are seeing exactly what someone from that locale sees.
Congratulations on a localized application! Any questions?
No comments:
Post a Comment