I'm Mary Poppins, y'all!

Inertia I18n

Keeps Rails YAML locales and frontend i18next JSON translations in sync for Inertia.js apps.

SvelteReactVueInertia.jsRuby on Rails

InertiaI18n bridges the translation gap in Rails/Inertia.js applications, converting between backend and frontend locale formats with a single source of truth.

#The Problem

Inertia.js applications have a split architecture:

  • Backend (Rails) - Uses YAML locale files (config/locales/*.yml)
  • Frontend (React/Svelte/Vue) - Uses i18next JSON files

This creates several challenges:

  1. Duplicate management - Maintaining translations in two formats
  2. Sync issues - Keys in YAML but missing in JSON (or vice versa)
  3. No usage tracking - Unused translation keys accumulate
  4. Manual process - Converting YAML → JSON by hand is error-prone

Existing tools like i18n-tasks only handle Rails/backend translations.

#The Solution

InertiaI18n provides:

  • YAML → JSON conversion with interpolation mapping (%{var}{{var}})
  • AST-based scanning to find translation usage in .svelte, .tsx, .vue files
  • Health checks to detect missing, unused, and unsynchronized keys
  • Watch mode for automatic regeneration during development
  • Rails integration via initializers and rake tasks

One source of truth: Rails YAML files, with JSON auto-generated.

Share this post