Skip to content

Latest commit

Β 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

rori18n

codecov

Production-grade Rails i18n toolchain. Built at Bobadilla Technologies and running in production across multiple client apps, including Requiems API.

Full replacement for i18n-tasks write commands, plus capabilities it lacks:

  • Extract hardcoded strings from ERB/Ruby and inject t() calls automatically
  • Merge sentence fragments split across ERB interpolations into a single t() call
  • Translate missing keys via Google Cloud Translation with brand-name protection
  • Rename a key across YAML and all source callers in one command
  • Deduplicate identical strings across files and consolidate them to shared.*

Also covers everything i18n-tasks does: lint, audit, prune.

Install

gem "rori18n-rails", group: :development
bundle install
bundle exec rails g rori18n:install
bin/rori18n generate --fix --root .

The binary is downloaded automatically on first run and cached locally. Supported platforms: macOS (Apple Silicon, Intel), Linux (x86_64).

Requirements: a Rails app with a config/locales/{lang}/ layout. A Google Cloud Translation API service account key is only needed for the translate command.

Full command reference, workflow walkthrough, and CI recipes: gem/README.md

Example

<!-- Before -->
<h1>Welcome back</h1>
<p>Hello <%= current_user.name %>, you have <%= count %> messages.</p>
bin/rori18n generate --fix --root .      # extract + inject t() calls
bin/rori18n merge-fragments --fix --root .  # merge the sentence fragment
<!-- After -->
<h1><%= t('.welcome_back') %></h1>
<p><%= t('.greeting', name: current_user.name, count: count) %></p>

The app behaves identically after this step β€” only source and YAML change. Then translate:

export GOOGLE_APPLICATION_CREDENTIALS=service-account.json
bin/rori18n translate --root . --to es,fr

vs i18n-tasks

Feature rori18n i18n-tasks
Extract hardcoded strings from ERB βœ… report, generate ❌
Inject t() calls into source βœ… generate --fix ❌
Merge ERB sentence fragments βœ… merge-fragments ❌
Translate missing keys βœ… translate (Google API) βœ… (multiple backends)
Lint undefined t() calls βœ… lint βœ… health / missing
Prune orphaned keys βœ… prune βœ… remove-unused
Rename keys + update callers βœ… refactor-key βœ… mv
Deduplicate shared values βœ… consolidate ❌
Rails integration Ruby gem, auto-installed binary Ruby gem in Gemfile

i18n-tasks is still useful as a passive health checker (bundle exec i18n-tasks health) because its Prism-based scanner handles some Rails-specific patterns (before_actions, model translations) that rori18n's static scanner does not. Run rori18n for all write operations; use i18n-tasks health-only in CI.

Using the CLI without Rails

The rori18n binary works standalone against any config/locales/ tree:

go install github.com/bobadilla-tech/rori18n@latest
export PATH="$PATH:$(go env GOPATH)/bin"
rori18n report --root <app-root>

Docs

About

πŸ’Ž Rails i18n toolchain. Extracts hardcoded strings, injects `t()` calls, translates via Google Cloud, deduplicates, and refactors keys.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages