Export Rails i18n YAML translations to JSON files so your React or Vue frontend can display translated strings without an extra API call.
Use wildcard patterns in the config to export only the translations your frontend needs, skipping server-only error messages.
Run the CLI linter to find missing translations across locales before they cause blank text in production.
Enable the fallback plugin so that missing translations in a non-default language gracefully fall back to the default language string.
Requires a Ruby/Rails project, also needs the separate npm companion package installed for the browser-side JavaScript usage.
This is a Ruby library that exports translation strings from Rails (a popular Ruby web framework) into JSON files that can be loaded and used in JavaScript running in the browser. The core problem it solves is that Rails stores its translations in YAML files on the server, but the front-end JavaScript code cannot read those directly, so this tool converts them into a format that both sides can share. You configure which translations to export using a YAML config file. Patterns let you include or exclude specific groups of translations using wildcards, so you can, for example, export everything except database-level error messages that the browser will never need. The output filenames can include placeholders for the language code and a checksum hash, which is useful for cache-busting when files change. The tool ships with a command-line interface that handles initialization, export, linting for missing translations, and checking translation coverage. You can also call it programmatically from Ruby code. A plugin system allows you to extend the export process. Two built-in plugins cover common needs: one embeds fallback translations from the default language so that missing phrases gracefully fall back, and another allows exporting to file formats other than JSON, such as TypeScript, by running translations through an ERB template. The companion JavaScript package for loading and using these exported translations in the browser is published separately on npm. The README notes the library works for projects that do not use Ruby at all, as long as they can generate the JSON files another way.
← fnando on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.