0.0
No release in over 3 years
R18n backend for Rails I18n and R18n filters and loader to support Rails translation format. R18n has nice Ruby-style syntax, filters, flexible locales, custom loaders, translation support for any classes, time and number localization, several user language support, agnostic core package with out-of-box support for Rails, Sinatra and desktop applications.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 0.5.0
~> 0.7.1
~> 3.10
~> 1.6
~> 0.5.1
~> 0.21.0
~> 0.11.0

Runtime

~> 1.0
~> 5.0
 Project Readme

R18n Rails API

Cirrus CI - Base Branch Build Status Codecov branch Code Climate Depfu License Gem

Rails I18n compatibility for R18n:

  • R18n loader for Rails I18n translation format;
  • R18n back-end.

It is just a wrapper for R18n core library. See R18n documentation for more information.

How To

Rails Translations

You can use R18n::Loader::Rails to load translations from I18n.load_path:

i18n/en.yml:

en:
  posts:
    one: One post
    many: %{count} posts

example.rb:

require 'r18n-rails-api'

I18n.load_path = ['i18n/en.yml']
i18n = R18n::I18n.new('en', R18n::Loader::Rails)

i18n.posts(count: 5) #=> "5 posts"

Back-end

You can use R18n as a back-end for Rails I18n:

require 'r18n-rails-api'

R18n.set('en', 'path/to/translation')
I18n.backend = R18n::Backend.new

I18n.l Time.now, format: :full #=> "6th of December, 2009 22:44"
I18n.t :greeting, name: 'John' #=> "Hi, John"
I18n.t :users, count: 5        #=> "5 users"

R18n Features

  • Nice Ruby-style syntax.
  • Filters.
  • Flexible locales.
  • Custom translations loaders.
  • Translation support for any classes.
  • Time and number localization.
  • Several user languages support.

License

R18n is licensed under the GNU Lesser General Public License version 3. You can read it in LICENSE file or in www.gnu.org/licenses/lgpl-3.0.html.

Author

Andrey “A.I.” Sitnik andrey@sitnik.ru