Skip to content
Ruby on Rails i18n

Ruby on Rails i18n: Convention-Based Translation Management

Ruby on Rails includes a built-in I18n API that uses YAML locale files to manage translations.

Locale files
YAML
Sync
npx lefine
I18n · config/locales
01config/locales/en.yml
# config/locales/en.ymlen:  welcome: "Welcome to %{app_name}"  items:    one: "%{count} item"    other: "%{count} items"
02app/controllers/home_controller.rb
# app/controllers/home_controller.rbclass HomeController < ApplicationController  def index    @welcome = t('welcome', app_name: 'My App')    @items = t('items', count: 5)  endend
03app/views/home/index.html.erb
# app/views/home/index.html.erb<h1><%= @welcome %></h1><p><%= @items %></p>
t('welcome', app_name: 'My App')
Welcome to My App

Rails i18n in Practice

Define translations in YAML locale files, use t() in controllers and views with interpolation, and render localized content in ERB templates.

01/Overview

The framework follows convention over configuration, with lazy lookup in views, automatic pluralization rules, and interpolation support. Rails provides locale-aware helpers for dates, numbers, and currencies out of the box, and its fallback system ensures missing translations degrade gracefully.

02/Capabilities

Ruby on Rails i18n Features

  • YAML locale files in config/locales with nested key organization
  • I18n.t() and I18n.l() API for translations and locale-aware formatting
  • Built-in pluralization with one/other rules and custom plural backends
  • Variable interpolation with %{variable} syntax in translation strings
  • Lazy lookup with t('.key') in views for automatic scope resolution
  • Fallback locale chains for graceful handling of missing translations
  • Translated routes and URL helpers with route_translator or similar gems
  • ActiveRecord model and attribute name translations, with database-backed content via gems such as Mobility
  • Locale-aware date, time, number, and currency formatting helpers
Get started

Start free.

Start Rails Localization Today

Manage your Rails YAML translations with AI-powered workflows and CDN delivery.