PolyglotCli

Gem Version Code Climate Test Coverage Issue Count Build Status

Pulls and pushes translations to and from locale files.

Installation

Add this line to your application's Gemfile:

gem 'polyglot_cli'

And then execute:

$ bundle

Or install it yourself as:

$ gem install polyglot_cli

Setup

All commands have --help with detailed descriptions of options.

First we need to login to Polyglot:

polyglot 

This will prompt you for your email and password. If the the login attempt is successful. The API token will be written to a file in your home directory: ~/.polyglot.auth

Next you have to initialize the project and go through a quick setup:

polyglot init

This will prompt you to choose from a list of projects, and set your locale directory. The default locale directory is config/locales for rails apps.

Usage

Once you have setup the project you can use any of the following commands:

polyglot pull

This command will query the Polyglot API and retrieve all translations. If you use the --locale option it will only retrieve that locale. If you use --path option you will override the default locale path. Both options are optional. Please be careful when pulling, it will overwrite any changes that are not stored on the server.

polyglot pull [--locale --path]

polyglot push

This command will read the locale files and push them to the server. It will update and create both translations and translation keys. If your locales aren't up to date with the server, the command will fail. If you use the --locale option it will only retrieve that locale. If you use --path option you will override the default locale path. Both options are optional.

polyglot push [--locale --path]

polyglot status

This command simply checks if your version of the locales are up to date with the sever.

polyglot status

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also 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, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on Bitbucket at https://bitbucket.org/infinum_hr/rails-polyglot-cli/.

License

The gem is available as open source under the terms of the MIT License.