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

merb_r18n

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merb_r18n

  • 0.2.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Merb R18n

A plugin for the Merb framework that provides i18n support to translate your site in several languages.

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

== Features

  • It has special support for countries with two official languages. If there isn’t translation in user locale, it will be found in locales, which user may know (not only in default locale). For example, many people in Belarus can understand Russian, and locale has information about it.
  • It can format numbers and time to the rules of the user locale, translate month and week days name and give other locale information.
  • It has translation for commons words, like “OK”, “Cancel”, etc.
  • It storage translation in rich YAML format. You can put procedures and pluralization (“1 comment”, “5 comments”) in your translation.

== How To

=== Merb App

  1. Add merb_r18n to your merb application in config/dependencies.rb:

    dependency 'merb_r18n'

  2. Add route to set locale manually in your config/router.rb. For example set available translations:

    Merb::Router.prepare do match('(/:locale)', :locale => /(en|ru)/) do # Your application routers. default_routes end end

    You may use another way, just set :locale param.

  3. Create translations file in app/i18n/. For example app/i18n/en.yml:

    post: add: Add post edit: Edit %1

    comments: !!pl 0: No comments 1: One comment n: %1 comments

  4. Use translation messages in view. For example:

    <%= link_to i18n.post.add, 'posts/add' %> <%= link_to i18n.post.edit(post.title), "posts/edit/#{@post.id}" %> <%= link_to i18n.delete, "posts/delete/#{@post.id}" %>

    <%= i18n.comments(@post.comments.size) %>

  5. Print localized time and numbers. For example:

    <%= i18n.l @post.created_at, :date %>

  6. Print available translations:

    • <%= title %>

=== Merb Slice

  1. Add merb_r18n to your merb slice in lib/YOUR_SLICE.rb:

    dependency 'merb_r18n'

  2. Create translations file in app/i18n/. For example app/i18n/en.yml:

    post: add: Add post edit: Edit %1

    comments: !!pl 0: No comments 1: One comment n: %1 comments

  3. Use translation messages in view. For example:

    <%= i18n.comments(@post.comments.size) %>

  4. Print localized time and numbers. For example:

    <%= i18n.l @post.created_at, :date %>

  5. In host application you can override translations. Just create files in app/i18n/ in application root. For example app/i18n/en.yml:

    post: add: Write your idea

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

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

FAQs

Package last updated on 05 Aug 2009

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