Skip to content

onesky/i18n-one_sky-ruby

Repository files navigation

I18n OneSky

OneSky is a localization platform that makes websites and apps translation simple.

This gem integrates OneSky and I18n. At its most basic, it allows you to take the phrases defined under I18n’s default locale and upload them to OneSky for translation. You can then download translations and save them as Simple backend YAML files.

Added database backend storage support since version 0.0.3

Using inside a Rails project

In your Rails root, edit your Gemfile to include this gem:

# Gemfile
gem 'rails', '3.0.3'
...
gem 'i18n-one_sky'

Then tell Bundler to install:

bundle install

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 my_platform_id

This will create the configuration file config/one_sky.yml.

Once your phrases are defined for your default locale and all your views contain the ubiquitous t() methods, you can submit these phrases to OneSky:

rake one_sky:upload

Once the translations are ready, you can download them by:

rake one_sky:download

This will save the translations inside config/locales/*_one_sky.yml files. Now it’s just a matter of pushing again to production.

Using outside Rails

i18n-one_sky is also designed to be used outside Rails.

Install it like any regular gem:

gem install i18n-one_sky

And see I18n::OneSky::SimpleClient for the methods available in Ruby.

Using Database as translation storage, YAML as fallback (since version 0.0.3, Rails only)

The following command generates rails initializers and run db migration:

rails generate one_sky:init_active_record_backend

use the upload_phrases rake command to upload your default locale to one sky server:

rake one_sky:active_record:upload

Then, instead of running one_sky:download, run the following command to download and store the translations into translations database table:

rake one_sky:active_record:download

Using i18n-one_sky gem in Heroku

Because Heroku is read-only file system, you have to use database storage as storage backend. Either configure the “ONESKY_API_KEY”, “ONESKY_API_SECRET”, “ONESKY_PROJECT”, “ONESKY_PLATFORM_ID” environment variables manually or use the OneSky Heroku addon.

Read “Using Database as translation storage” sections for details to upload and download phrases.

History

See CHANGELOG

Credits

See CREDITS

License

Copyright 2010-2014 OneSky, Inc.

Licensed under the MIT License.

About

A set of I18n extensions that use the OneSky service.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages