0.0
No commit activity in last 3 years
No release in over 3 years
Use the multi-modal ArangoDB as your I18n backend.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.0
~> 3.2

Runtime

~> 0.14.0
 Project Readme

ArangoI18n

This gem lets you use the ArangoDB multi-modal database as an I18n backend in your Ruby projects.

Installation

Add this line to your application's Gemfile:

gem 'arango_i18n'

And then execute:

$ bundle

Or install it yourself as:

$ gem install arango_i18n

Usage

Using this gem with a Rails project might look something like this:

# config/initializers/i18n_backend.rb

database = Ashikawa::Core::Database.new do |config|
  config.url = "http://localhost:8529"
  config.database_name = 'my_app_i18n'
  config.username = ""
  config.password = ""
end

# database.collection("i18n") will return a collection object
# The collection will be created if it does not exist
I18n.backend = I18n::Backend::KeyValue.new(ArangoI18n::Store.new(database.collection("i18n")))

If there are existing translations lurking in config/locales/*.yml you probably will want to load them in with this:

I18n.backend.load_translations

Then end result of the code above is that the my_app_i18n database would have a collection called "i18n" which contains a bunch of documents that look something like this:

{ "key": "en.hello", "value": "\"Hello world\"" }
{ "key": "fr.hello", "value": "\"Bonjour le monde\"" }

Your translations then work as normal:

[3] pry(#<#<Class:0x007f06e47ef788>>)> t("hello")
=> "Hello world"
[4] pry(#<#<Class:0x007f06e47ef788>>)> I18n.locale = :fr
=> :fr
[5] pry(#<#<Class:0x007f06e47ef788>>)> t("hello")
=> "Bonjour le monde"

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.

Contributing

If you see something that can be improved, let me know. Open an issue, or send a pull request.

  1. Fork it ( https://github.com/sleepycat/arango_i18n/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request