How to Translate Galaxy Zoo
Not too long ago we announced that Galaxy Zoo has gone open source – along with several other Zooniverse projects. Part of that announcement was that it is now possible for anyone to translate the Galaxy Zoo website into their own language and have that pulled back into the main site. We love translation at the Zooniverse! Using GitHub (our code repository) means we can open up the translation process to everyone.
I’ve been answering a lot of emails about how this process works so I thought I would outline a tutorial here on the blog. To get started go to: https://github.com/zooniverse/Galaxy-Zoo/tree/master/public/locales and download the .json file corresponding to your language. If there is not yet one there you have two options:
- Clone the app locally from GitHub and run the translate.rb file in root
- If step 1 doesn’t make any sense then contact firstname.lastname@example.org and we can create the file for you.
These JSON files are tree structures of strings in “key”: “value” pairs that contain all the translatable text on Galaxy Zoo. You need to translate just the values , which are the parts after the colon (:) shown in bold in the example chunk of the file below.
“wont_work”: “This site probably won’t work until you update your browser.”,
“recommended”: “We recommend using <a href=\”http://www.mozilla.org/firefox/\” target=\”_blank\”>Mozilla Firefox</a> or <a href=\”http://www.google.com/chrome\” target=\”_blank\”>Google Chrome</a>.”,
“ie”: “If you use <a href=\”http://www.microsoft.com/windows/internet-explorer/\” target=\”_blank\”>Microsoft Internet Explorer</a>, make sure you’re running the latest version.”,
“chrome_frame”: “If you can’t install the latest Internet Explorer, try <a href=\”http://google.com/chromeframe\” target=\”_blank\”>Chrome Frame</a>!”,
You do not translate the parts before the colon as these are the keys that are used to identify each string. so in the example you do not translate “zooniverse”, “browser_check”, “won’t_work, “recommended”, “ie”, “chrome_frame” or “dismiss”. Here’s the Spanish version of the above segment of the file:
“wont_work”: “Es probable que este sitio no funcione hasta que actualices tu navegador.”,
“recommended”: “Te recomendamos usar <a href=\”http://www.mozilla.org/firefox/\” target=\”_blank\”>Mozilla Firefox</a> o <a href=\”http://www.google.com/chrome\” target=\”_blank\”>Google Chrome</a>.”,
“ie”: “Si utilizas <a href=\”http://www.microsoft.com/windows/internet-explorer/\” target=\”_blank\”>Microsoft Internet Explorer</a>, asegúrate que estés usando la última versión.”,
“chrome_frame”: “Si no puedes instalar la última versión de Internet Explorer, intenta usar <a href=\”http://google.com/chromeframe\” target=\”_blank\”>Chrome Frame</a>!”,
Note that any quotation marks need to be escaped i.e. ” becomes \” – these files have to be valid JSON and there is a handy online tool for validating this at http://jsonlint.com/ – here you can paste in the whole file and it will tell you where there are any formatting errors if you have any.
There is very little scope for doing language-specific formatting on the website. This means that if text is too long when it’s been translated it may run off the page or be cut-off on the screen. Because of this, you need to keep the translated strings to approximately the same length. If this causes issues let us know. To test out the translation and see how it looks, which you’re welcome to do ant any time, you can either email your current file to email@example.com or run the Galaxy Zoo app locally by cloning it from GitHub (https://github.com/zooniverse/Galaxy-Zoo/).
We also have an email list for Zooniverse Translators. If you’d like to join it in order to ask questions of other translators and hear about other projects you might want to translate then email firstname.lastname@example.org. If you are planning on doing a translation it would be worth joining the list to coordinate with other translators in your language.
NOTE: If you’re familiar with GitHub, you can clone the Galaxy Zoo repo, create a local JSON file for your language and just submit a Pull Request when you’re ready. You can find the translation-creator script here.
When your translation is complete will find find an astronomer somewhere in the world who speaks your language, in order to double-check (peer-review!) the new text and give feedback. This is done to ensure that the site is still conveying the original meaning and acts as a good error-checking mechanism.
Good luck with your translation, and thank you! Hopefully we can open up Galaxy Zoo to many more people around the world.