0.0
A long-lived project that still receives updates
We help you manage your locale translations with migrations, just the way Active Record helps you manage your db with migrations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

I18n Migrations

We help you manage your locale translations with migrations, just the way Active Record helps you manage your db with migrations.

There are several tools out there that allow you to dynamically store / load / translate strings in your app. We prefer to deploy our app with static files using the excellent i18n gem. But how to translate?

Our flow is:

  1. Use a migration to make a change (add/remove/update/move) to your translations locally. In this state, we will use google translate to quickly guess at translations.
  2. When ready to deploy, push these changes to google spreadsheets, one for each translation, there, your translators can fix google translate's mistakes.
  3. Pull to replace your translations with what's in those google spreadsheets.
  4. Migrate to play back any changes after pulling / merging / etc.

Installation

Add this line to your application's Gemfile:

gem 'i18n-migrations'

And then execute:

$ bundle

Or install it yourself as:

$ gem install i18n-migrations

From your project file, you'll want to run

$ i18n-migrate setup

This will create a config file you can edit.

Usage

Let's imagine that your config file look like this:

migration_dir: i18n/migrate
locales_dir: config/locales
main_locale: en
other_locales:
- es
..

In your project file, you should then have all your English terms in config/locales/en.yml

You can:

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Updating the gem version

  1. Create a commit with the new version number and push it up to Github
        git commit -m "vx.x.x"
        git push
    
  2. Create a tag in Github for the new release
        git tag -a vx.x.x -m "[INSERT CHANGE DESCRIPTION]"
        git push origin v.x.x
    
  3. Push up and merge the branch into the repo
  4. Build the new .gem file. This will create a new file labeled i18n-migrations-x.x.gem
        gem build i18n-migrations
    
  5. Push the newly built gem to RubyGems
        gem push i18n-migrations-x.x.x.gem
    
  6. Verify on the i18n-migrations RubyGems directory page that the new version has been published
  7. Delete the gem build file (i18n-migrations-x.x.x.gem)

Contributing

  1. Fork it ( https://github.com/[my-github-username]/i18n-migrations/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make sure tests are passing (rake)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request