Translator Gem

This gem is for pushing and pulling translations to and from Smartling.

Installation

Add this line to your application's Gemfile:

# Gemfile
source "https://rubygems.org"
gem 'mc_translator', '~> 0.1.3'

And then execute:

$ bundle install

Then, in your Rakefile:

# Rakefile
require 'mc_translator'

Once you've got it installed, you'll need some basic configuration by setting up some ENV vars and adding a .translations.yml:

# .env.development
SMARTLING_USER_ID: xxxxxxxxxxxxxxxxxx
SMARTLING_USER_SECRET: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SMARTLING_PROJECT_ID: xxxxxxx
# .translations.yml
locales:
  - en-GB
matches:
  - pattern: '**/*en-US.yml'
    type: YAML
  - pattern: '**/*en-US.json'
    type: JSON
parentBranch: master

Usage

To keep things as simple as possible, we've added some Rake commands so that you can do this as simply as running:

# Push only changed files (git) to Smartling
$ rake translator:push

# Push all files that match to Smartling
$ rake translator:push:all

and

# Pull translated files related to a Smartling job with the same name as your branch
$ rake translator:pull

# Pull all translated files in Smartling project that match config
$ rake translator:pull:all