Gettext OneSky¶ ↑
OneSky is a new service that lets developers reach a global audience by easily enabling them to translate their websites and applications to different languages through the help of the community.
This gem integrates OneSky and gettext. At its most basic, it allows you to take the phrases defined under gettext .pot file and upload it to OneSky for translation by the community. Afterwards, you can download available translations and save them as .po files.
This gem is supporting Ruby projects using gettext gem to handle localization. If you are using i18n, checkout i18n-one_sky gem
PO file support¶ ↑
-
One layer of Context
-
Text Domain as page
-
Reserved Context: Singular, Plural and General
— One layer of Context
Onesky currently only support 1 layer of context. That means only either “msgctxt” / “msgstr” / “msgstr” will be supported but not both.
— Text Domain as page
Regarding the text domain, please use the file name as the page parameter. That means if the po file is abc.po, just add the string with parameter page=abc.po.
— Reserved Context: Singular, Plural and General
“Singular” / “Plural” / “General” are reserved context words.
Onesky only support “Singular” and “Plural” for po files. That means only [0] and [1] are used. Which will return in result:
{"key": { "Singular": "Word", "Plural": "Words"}}
For the stuff without context, you may use “General” if there are other strings with same string key but different context:
{"key_of_book": { "General": "book", "verb": "book", "noun": "book"}}
Using inside a Rails project¶ ↑
-
Generate OneSky API key
-
Generate .pot
-
Upload .pot to OneSky
-
Upload translated .po to OneSky
-
Download latest translated files .po from OneSky
-
Overwrite old .po files
-
Generate .mo files
— Generate OneSky API key
If you haven’t done so yet, log in to your account at OneSky and create a new project for this Rails app. Also, find the API key and secret which you will supply here:
rails generate one_sky:init my_api_key my_api_secret my_project
This will create the configuration file config/one_sky.yml.
— Generate .pot
Use the gettext rake task
rake updatepo
— Upload .pot to OneSky
So assuming that you already have your .pot file generated, it’s time now to submit these phrases to OneSky:
rake one_sky:upload_phrases
— Upload translated .po to OneSky
You may have some translated .po files in your repository. Upload them to Onesky:
rake one_sky:upload_translated_phrases
— Download latest translated files .po from OneSky
Then ask your translators to provide the translations using the OneSky website. When they’re done and a few new languages are available, download them by:
rake one_sky:download_translations
This will save the translations inside po/**/from_one_sky.po files.
— Overwrite old .po files
Overwrite your own .po files by the downloaded from_one_sky.po file.
You now have more languages supported and it’s just a matter of pushing again to production. You can call upload and download over and over as you incrementally internationalize your site.
Using outside Rails¶ ↑
The steps are similar. Install it like any regular gem:
gem install gettext-one_sky
And see the gettext-one_sky.rake and GetText::OneSky::SimpleClient for the methods available in Ruby.
TODO¶ ↑
-
merge downloaded translation with .pot to generate the .po files
-
upload existing .po files to onesky service
-
handle textdomain.po
History¶ ↑
See CHANGELOG
Credits¶ ↑
See CREDITS
License¶ ↑
Copyright 2010-2011 OneSky, Inc.
Licensed under the MIT License.