No commit activity in last 3 years
No release in over 3 years
Flexible syncronization solution of locales with LocaleApp.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.6
~> 10.0
>= 3.1.0, ~> 3.2.0

Runtime

< 5, >= 3.2
~> 0.9
~> 0.8
 Project Readme

Translator

It is an utility through which you can synchronize your locales with Localapp.

Installation

Add this line to your application's Gemfile:

gem 'translator_with_localeapp', '~> 1.0.1'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install translator_with_localeapp

Usage

With Redis:

require 'redis'
require 'translator'


Translator.setup do |config|
  # ==> Storage Configurations
  # config.storage = :Redis
  # config.storage_options = { host: 'localhost', port: 6379, db: 1 }

  # ==> Output Configuration
  # By default there is no logging, you can set it to any output
  # stream which respond to `puts`.
  # config.output_stream = nil

  # ==> Localeapp Configuration
  config.localeapp_api_key = ENV['LOCALEAPP_API_KEY']
  # It is the directory where localeapp will sync all the locales files.
  config.data_directory = Rails.root.join('config', 'locales')
end

file_paths = <paths of yml files>
Translator.load!(file_paths)

Storage

Uses moneta gem to wrap various Key/Value stores Docs for moneta can be found here

Parameters:

  • name (Symbol) — Name of adapter (See Moneta::Adapters)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :expires (Boolean/Integer) — Ensure that store supports expiration by inserting Expires if the underlying adapter doesn't support it natively and set default expiration time
  • :threadsafe (Boolean) — default: false — Ensure that the store is thread safe by inserting Moneta::Lock
  • :logger (Boolean/Hash) — default: false — Add logger to proxy stack (Hash is passed to logger as options)
  • :compress (Boolean/Symbol) — default: false — If true, compress value with zlib, or specify custom compress, e.g. :quicklz
  • :serializer (Symbol) — default: :marshal — Serializer used for key and value, disable with nil
  • :key_serializer (Symbol) — default: options[:serializer] — Serializer used for key, disable with nil
  • :value_serializer (Symbol) — default: options[:serializer] — Serializer used for value, disable with nil
  • :prefix (String) — Key prefix used for namespacing (default none)

Redis

See redis-db for options

Install Redis

brew install redis(Mac)

OR

sudo apt-get install redis(Ubuntu)

Start Redis

redis-server

Testing

Ensure Redis server is installed and started.

$ bundle install
$ bundle exec rspec spec

Contributing

1. Fork it ( https://github.com/kuldeepaggarwal/translator/fork ).
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Add test cases and verify all tests are green.
4. Commit your changes (`git commit -am 'Add some feature'`).
5. Push to the branch (`git push origin my-new-feature`).
6. Create new Pull Request.