i18n

Internationalization guidelines for a Rails application that supports multiple languages and regional settings. They define English and German defaults, translation files, naming rules, and Rails configuration.

In plain words
What is it for?
Use them when adding languages, translation keys, locale files, or translated interface text to a Rails application.
Why use it?
They provide a consistent way to store and retrieve translated text across models, views, controllers, and shared messages.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/wintermeyer/cursor-rails-rules/i18n
Clone the repo
git clone --depth 1 https://github.com/wintermeyer/cursor-rails-rules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 804 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00804
Opus 5 $0.00000 $0.00402
Sonnet 5 $0.00000 $0.00161
Haiku 4.5 $0.00000 $0.00080

Measured 2d ago against content hash 4d5dd939f98f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

i18n scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/i18n.mdc · 155 lines

How it starts

The opening of the file, as written. The whole thing — 155 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Base I18n Standards

We always assume that the application supports multiple languages and locales. By default we go with English as the primary language and German as the secondary language.

Check if the 'rails-i18n' gem is installed. If not add it to the Gemfile:

gem 'rails-i18n', '~> 8.0.0'

and run a bundle install.

Configuration

  1. Setup
# config/application.rb
config.i18n.default_locale = :en
config.i18n.available_locales = [:en, :de]
config.i18n.fallbacks = true
  1. Directory Structure
config/locales/
├── en/
│   ├── models/
│   ├── views/
│   └── controllers/
└── de/
    ├── models/
    ├── views/
    └── controllers/

Key Structure

  1. Namespace Hierarchy
en:
  models:      # Model-specific translations
  views:       # View-specific translations
  controllers: # Controller-specific messages
  helpers:     # Form helpers and labels
  common:      # Shared translations
  1. Key Naming
  • Use lowercase
  • Use dots for nesting
  • Use underscores for words
  • Keep keys descriptive
  • Follow Ruby naming conventions

Implementation

  1. In Views
<%= t('.title') %>                     # Lazy lookup
<%= t('views.users.index.title') %>    # Full key
<%= t('.welcome', name: @user.name) %> # With interpolation
  1. In Controllers
flash[:notice] = t('.success')
redirect_back_or_to root_path, notice: t('.created')
  1. In Models
validates :status, inclusion: { in: %w[pending active],
  message: ->(object, data) { I18n.t("models.#{object.class.name.downcase}.errors.invalid_status") } }
  1. In Mailers
mail(
  to: @user.email,
  subject: t('.welcome_subject', name: @user.name)
)

Best Practices

  1. Key Organization
  • Group by feature/module
  • Use consistent nesting levels
  • Keep keys short but meaningful
  • Document non-obvious keys
  1. Translation Management
  • Use YAML for static content
  • Use Ruby for dynamic content
  • Keep translations DRY
  • Regular sync with translators
  1. Performance
  • Use lazy lookup when possible
  • Cache common translations
  • Avoid deep nesting
  • Preload translations in production

Read the full file on GitHub · 155 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 155 lines · 0 tokens per session scan A 4d5dd939f98f

Subscribe to this mod's changes

i18n is a cursor rule published in the GitHub repository wintermeyer/cursor-rails-rules (37 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 804 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.