Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

I18n tool to translate your Ruby application.

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile


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

See R18n documentation for more infomation.


  • 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 localize your application: format numbers 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

  1. Add merb_r18n to your merb application in config/init.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 |r|
      r.match(/\/(|en|ru|fr)/).to(:locale => "[1]") do |l|
        # Your application routers. You must use l instead r

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

  3. Create translations file in app/translations/. For example:

      add: Add post
      delete: Delete post %1
    comments: !!pl
      0: No comments
      1: One comment
      n: %1 comments
  4. Use translation messages in view. For example:

    <%= link_to, 'posts/add' %>
    <%= link_to, "posts/delete/#{}" %>
    <h1><%= i18n.comments(@post.comments.size) %></h1>
  5. Print localized time and numbers

    <%= %> <%= i18n.l @post.created_at, :date %>
  6. Print available translations:

      <% i18n.translations.each_pair do |locale, title| %>
      <li><a href="/<%= locale %>/"><%= title %></a></li>
      <% end %>


R18n is licensed under the GNU Lesser General Public License version 3. You can read it in LICENSE file or in


Andrey “A.I.” Sitnik <>

Something went wrong with that request. Please try again.