Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

r18n-rails-api

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

r18n-rails-api

  • 5.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

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

FAQs

Package last updated on 03 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc