Rails Localization (i18n) - English & Arabic

Implement English and Arabic i18n in Rails apps with RTL support.

10|1|Updated Dec 20, 2025
One-click install
npx skills add https://github.com/Kaakati/rails-enterprise-dev --skill rails-localization-i18n-english-arabic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Rails Localization (i18n) - English & Arabic
Source: https://github.com/Kaakati/rails-enterprise-dev/tree/main/plugins/rails-enterprise-dev/skills/localization
Command: npx skills add https://github.com/Kaakati/rails-enterprise-dev --skill rails-localization-i18n-english-arabic

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps implement true internationalization in Rails apps, beyond simple translation. It covers RTL support, Arabic plurals, date/time formatting, and cultural adaptation for English and Arabic content.

Core Features & Use Cases

  • Locale configuration: available_locales, default_locale, and fallback chains.
  • Locale file structure: proper organization under config/locales/en/ar/defaults/shared.
  • ApplicationController & routing: set_locale, around_action, locale-scoped routes.
  • Practical use case: Building a bilingual Rails app that serves English and Arabic users with correct RTL layout and localized date formats.

Quick Start

Use this skill to enable English and Arabic in your Rails app by defining locales, wiring a locale switcher, and validating UI in both languages. For example, configure config.i18n.available_locales = [:en, :ar] and default_locale :en, then create proper YAML files under config/locales/en.yml and ar.yml and add a switcher in your layout.

Frequently Asked Questions about Rails Localization (i18n) - English & Arabic

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Rails i18n for English and Arabic translations?

Rails i18n enables multi-language support by configuring available_locales and default_locale in config/i18n, then organizing translation files under config/locales/en.yml and ar.yml. Create YAML files with key-value pairs for each language, set up a locale switcher in your layout, and use t() helpers in views to pull translated strings.

What's the best way to handle RTL layout for Arabic in a Rails app?

RTL support in Rails requires setting locale-specific stylesheets or CSS classes that reverse text direction and element alignment for Arabic. Configure i18n to detect the current locale, apply dir="rtl" attributes conditionally in views, and use CSS media queries or class-based styling to mirror layouts when locale is :ar.

How do I format dates and numbers differently for English and Arabic locales?

Rails i18n handles date and number formatting through locale files using strftime patterns and number formatting rules. Define formats in config/locales/en.yml and ar.yml under i18n.time.formats and i18n.number.formats, then use I18n.l() to localize dates and numbers, which automatically applies the correct locale's formatting rules.

Can I use Rails i18n with Arabic plural forms and gender agreement?

Arabic plurals and gender agreement are supported through Rails i18n's pluralization rules. Define complex plural rules in your locale configuration and use interpolation with count and gender variables in YAML translation keys to generate grammatically correct Arabic text based on context.

How do I implement locale switching in Rails routing and controllers?

Locale switching integrates with Rails routing using locale-scoped routes defined in config/routes.rb with scope :locale. Set the locale in ApplicationController using before_action or around_action callbacks that extract locale from URL params, cookies, or headers, then use set_locale to apply it globally for that request.

Do I need to translate content in Rails models and mailers, or just views?

Translations apply across controllers, views, models, and mailers using the same i18n infrastructure. Use t() or I18n.t() in any Rails class to access translation keys, enabling consistent localization of validation messages, email templates, and dynamic content generated outside the view layer.