glebm/i18n-tasks
71.2
Strong · 19 September 2026
8.2k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is a command-line tool and library for managing internationalization (i18n) data in Ruby applications. It provides capabilities to scan source code for translation keys, manage translation files in YAML or JSON formats, and perform operations such as pruning unused keys, merging trees, and checking for consistency. The tool also integrates with external translation services like DeepL and OpenAI to assist with translation workflows and supports extensibility through a plugin API for custom scanners and commands.
How it got here
2013–2014 — Modular architecture and AST scanning
22 changes.
The project underwent a significant architectural shift, replacing nested hashes with a dedicated data tree structure and refactoring the CLI into a modular DSL. It introduced a new AST-based scanner subsystem powered by Prism for accurate key detection and expanded the API to support extensible plugins and JSON locale data.
2015–2026 — Scanner refactoring and translation infrastructure
15 changes.
This period focused on a major architectural overhaul of the i18n scanning subsystem, replacing monolithic parsers with modular AST matchers and Prism-based components to improve accuracy and extensibility. Concurrently, the project introduced a robust, multi-backend translation infrastructure supporting services like OpenAI and DeepL, alongside comprehensive test coverage and performance benchmarking to ensure stability.
Features
Add Windows batch wrapper for i18n-tasks CLI
A new bin/i18n-tasks.cmd file has been added to enable running the i18n-tasks command-line tool on Windows systems. This batch script invokes the main Ruby executable located in the same directory, passing through all command-line arguments, thereby providing native Windows support for the CLI entry point.
bin · high confidence
Add performance benchmark suite for i18n-tasks
A new benchmark suite has been added to the \benchmarks\ directory to measure and track performance regressions in the i18n-tasks library. The suite includes scripts for scanning (\scanning\_bench.rb\), tree operations (\tree\_bench.rb\), data I/O (\data\_bench.rb\), and end-to-end pipelines (\end\_to\_end\_bench.rb\). It utilizes \benchmark-ips\ for throughput measurement and \memory\_profiler\ for optional memory profiling. The benchmarks run against synthetic fixtures of varying scales (small, medium, large) and support saving results to a baseline JSON file and comparing current runs against that baseline to detect slowdowns.
benchmarks · high confidence
Introduces extensible plugin API for scanners, commands, and AST matchers
The library now exposes a public API in \lib/i18n/tasks.rb\ that allows users to extend core functionality by registering custom scanners, CLI commands, and AST matchers via \I18n::Tasks.add\_scanner\, \add\_commands\, and \add\_ast\_matcher\. This change shifts the tool from a fixed set of operations to a modular architecture where third-party or internal plugins can hook into the search and command execution pipelines. The entry point also initializes the environment by requiring necessary ActiveSupport core extensions, progress bars, and terminal styling libraries, and automatically loads internal locale configuration files.
lib/i18n · high confidence
New AST-based and pattern-based I18n scanners with Prism support
The scanner subsystem has been refactored to introduce a modular architecture with a base \Scanner\ interface and a \FileScanner\ for file traversal. A new \ErbAstScanner\ enables accurate detection of translation keys in ERB templates by parsing embedded Ruby code using the \Parser\ gem and the \Prism\ parser (via a \prism\ configuration option). Existing functionality is now provided by \PatternScanner\ (regex-based) and \PatternWithScopeScanner\ (handling \scope:\ arguments), while \RubyScanner\ serves as the primary scanner for \.rb\ files, supporting both AST parsing and Prism. The system also includes a \ScannerMultiplexer\ to run multiple scanners concurrently and merge results, and introduces support for relative keys in controllers and mailers via the \RelativeKeys\ module.
lib/i18n/tasks/scanners · high confidence
New CLI commands for translation data management and parser comparison
This release introduces several new command-line tasks to the i18n-tasks library. The \check\_prism\ command allows users to compare keys discovered by the default parser against those found by the Prism parser, generating a report of discrepancies. Data manipulation capabilities are expanded with \mv\, \cp\, and \rm\ commands for moving, copying, and removing translation keys, as well as \normalize\ and \check\_normalized\ for managing key ordering. Additionally, new commands include \eq\base\ to identify keys with identical values across locales, \prune\ to remove unused keys (with an optional \--keep-order\ flag), and \tree\\*\ commands (\tree\_translate\, \tree\_merge\, \tree\_filter\, \tree\_subtract\, \tree\_set\_value\, \tree\_convert\) for performing operations on translation trees. The \missing\ command now supports filtering by pattern, and the \health\ command aggregates checks for consistent interpolations, reserved interpolations, and normalized keys.
lib/i18n/tasks/command/commands · high confidence
New isolating and pattern-based i18n data routers
The library now includes two new router implementations for managing translation file organization: \IsolatingRouter\, which routes keys based on source file paths and locale substitution, and \PatternRouter\, which allows users to define custom key-to-file path mappings using glob patterns. These new classes provide more flexible control over how i18n data is read and written, enabling users to structure their locale files according to specific naming conventions or directory layouts rather than relying on a single default strategy.
lib/i18n/tasks/data/router · high confidence
New translator backends and base infrastructure for i18n translations
The translation system now includes dedicated backends for OpenAI (using gpt-4o-mini with configurable prompts and temperature), DeepL (with XML tag handling, glossary support, and batched requests), Google Translate (a custom API implementation with newline preservation), Yandex, and Watsonx. These new translators rely on a newly introduced \BaseTranslator\ class that standardizes the translation pipeline, including handling of interpolation variables, HTML escaping, and progress reporting.
lib/i18n/tasks/translators · high confidence
Support for JSON locale data files
The library now supports reading and writing locale data in JSON format, in addition to the existing YAML support. A new JSON adapter has been added to handle parsing and dumping of JSON locale trees, allowing users to store their i18n data as JSON files. The YAML adapter has also been updated to fix issues with emoji encoding and trailing spaces in YAML output.
lib/i18n/tasks/data/adapter · high confidence
i18n-tasks v1.1.2: New CLI, configuration, and translation backends
This release introduces a new command-line interface (lib/i18n/tasks/cli.rb) and a centralized configuration module (lib/i18n/tasks/configuration.rb) that exposes defaults and supports environment variables for translation backends. It adds support for DeepL, OpenAI, Watsonx, and Yandex translation services, and includes a new \i18n-tasks irb\ console (lib/i18n/tasks/console\_context.rb) for interactive exploration of i18n data trees. The diff also shows the addition of a \CommandError\ class for better error handling and a \Prune\ module for removing unused keys.
lib/i18n/tasks · high confidence
Behavioural changes
New CLI Commander and Conservative Router for i18n tasks
The i18n-tasks library introduces a new \Commander\ class to manage CLI execution, which now logs a support message for Ukraine to stderr upon running tasks. Additionally, a new \ConservativeRouter\ is added as the default router; it preserves existing key paths or infers them from the base locale, falling back to the pattern router only when necessary, thereby reducing unintended path changes during key routing.
i18n-tasks · high confidence
New CLI option parsers for enum and locale arguments
The CLI now includes dedicated option parsers for enum and locale arguments, improving validation and error handling. The new \Enum::Parser\ and \Enum::ListParser\ validate command inputs against allowed values, providing clear error messages when invalid options are provided. The \Locale::Parser\ and \Locale::ListParser\ validate locale strings against a standard format, handle special cases like 'base' and 'all', and ensure the base locale appears first in lists. These changes enhance the robustness of CLI commands that accept enum or locale parameters.
_lib/i18n/tasks/command/option\parsers · high confidence
New terminal-based report output for i18n tasks
The \lib/i18n/tasks/reports\ directory now contains a new \Base\ class and a \Terminal\ reporter that generate structured, colorized table output for i18n analysis tasks. Users will see improved terminal reports for missing keys, inconsistent interpolations, reserved interpolations, used keys, unused keys, and keys equal to the base locale, featuring formatted locale headers, key/value tables, and usage counts. This replaces previous ad-hoc or less structured reporting mechanisms with a consistent, table-based view for all major i18n diagnostic tasks.
lib/i18n/tasks/reports · high confidence
Refactored CLI command definition into a modular DSL
The internal structure for defining CLI commands has been reorganized to use a dedicated Domain Specific Language (DSL). New files \lib/i18n/tasks/command/dsl.rb\ and \lib/i18n/tasks/command/collection.rb\ introduce a modular system where commands are defined using \cmd\ and \arg\ methods, with options extracted into separate modules (\Common\, \Locales\, \Data\). This change simplifies the command DSL, improves code organization, and prepares the codebase for Ruby 3.0 compatibility by reducing dependencies on ActiveSupport and adding frozen string literals.
lib/i18n/tasks/command · high confidence
Refactored CLI option definitions into modular files
The command-line interface options have been reorganized from a single monolithic structure into three distinct modules: \Common\ (handling global flags like \--config\ and \--nostdin\), \Data\ (managing data/output formats such as \yaml\, \json\, and the new \key-values\ format), and \Locales\ (handling locale filters and the \--backend\ flag for translation services). This change improves the maintainability of the CLI DSL by separating concerns, allowing users to benefit from the expanded format options and clearer option grouping without altering the external command syntax.
lib/i18n/tasks/command/options · high confidence
Refactors i18n scanner results into dedicated KeyOccurrences and Occurrence classes
The scanner's result handling has been restructured to use explicit value objects: \KeyOccurrences\ now represents a scanned key along with all its occurrences, including a new \merge\_keys\ method to consolidate multiple instances of the same key while preserving order and uniqueness. The \Occurrence\ class has been expanded to track additional context such as \raw\_key\, \default\_arg\, and \candidate\_keys\, and its \inspect\ format has been updated to include these details, providing richer information for debugging and analysis of translation key usage.
lib/i18n/tasks/scanners/results · high confidence
Refactors i18n scanner to use extensible AST matchers
The i18n scanner's internal architecture has been refactored to use a class-based AST matcher system, introducing a \BaseMatcher\ and specific matchers for \default\_i18n\_subject\, \message\_receivers\, and \rails\_model\. This change improves the scanner's ability to detect translation keys, including handling slash notation in ActiveRecord attribute translations and supporting \default\_i18n\_subject\ calls, while providing a more modular foundation for future matcher additions.
_lib/i18n/tasks/scanners/ast\matchers · high confidence
Replace nested hashes with a dedicated i18n data tree structure
The internal representation of i18n translation data has been refactored from nested Ruby hashes to a dedicated tree structure (Node, Siblings, Nodes). This change introduces explicit tree nodes with parent/child relationships, enabling more robust operations such as key renaming with reference updates, granular traversal (depth-first, breadth-first), and improved handling of merge conflicts and missing keys. Users benefit from more accurate reporting of unused or missing keys and better support for complex tree manipulations like moving or renaming keys while preserving symbolic references.
lib/i18n/tasks/data/tree · high confidence
Rewritten Prism scanner with modular argument and node handling
The Prism-based i18n scanner has been refactored to improve how it parses Ruby code and extracts translation keys. The previous monolithic visitor logic has been split into dedicated components: an \ArgumentsVisitor\ now handles the extraction of static values from method arguments (such as keys and scope options), while a new \nodes.rb\ module defines structured classes (\Root\, \TranslationCall\, etc.) to represent the parsed translation context. The main \Visitor\ class now delegates argument processing to the new visitor and uses these node structures to track scopes, receivers, and candidate keys more accurately. This change enhances the scanner's ability to correctly identify translation calls in complex scenarios, such as those involving dynamic arguments or specific Rails model patterns, by providing a more robust and maintainable parsing foundation.
_lib/i18n/tasks/scanners/prism\scanners · high confidence
Support for JSON locale files and improved file handling
The library now supports reading and writing locale data in JSON format in addition to the existing YAML support, allowing users to store translations in \.json\ files. This change also introduces a conservative router as the default for managing key paths, ensures that only changed files are written to disk to reduce unnecessary I/O, and adds warnings when nil keys are encountered in locale data files.
lib/i18n/tasks/data · high confidence
Switch to StandardRB and update development tooling
The project has migrated its Ruby linting configuration from the previous RuboCop setup to the StandardRB gem, inheriting its base configuration and disabling the legacy RuboCop rules. This change is accompanied by the addition of several development configuration files: a new \.overcommit.yml\ to enable RuboCop as a pre-commit hook, a \.codeclimate.yml\ for code quality analysis, a \.simplecov\ file for coverage reporting, and a \.git-blame-ignore-revs\ file to ignore the bulk formatting commit. Additionally, the \.gitignore\ has been expanded to exclude common Ruby build artifacts and benchmark fixtures, and the \.rubocop\_todo.yml\ has been generated to track remaining style offenses.
(repo-wide) · high confidence
Thread-safe caching for concurrent file access
The library now includes a thread-safe caching mechanism in the concurrent module to prevent race conditions when multiple threads access file caches simultaneously. This is implemented via a new \Cache\ class that uses a mutex to ensure atomic lookups and a \CachedValue\ class that guarantees a computation block is invoked at most once, even under concurrent access. This change addresses concurrency issues where values might be computed multiple times or accessed in an inconsistent state.
lib/i18n/tasks/concurrent · high confidence
Test coverage
Added ERB view fixtures for i18n-tasks testing; Added fixture views for comprehensive I18n key scanning tests; Added i18n test template for missing, unused, unnormalized, and inconsistent interpolation checks; Added i18n validation specs; Added test coverage for i18n-tasks command suite; Added test coverage for translation services; Added test fixture for controller I18n key detection; Added test fixture for i18n-tasks configuration; Added test fixtures for I18n key usage and custom scanner matching; Added test fixtures for custom scanner and plugin examples; Added tests for file scanning components; Added tests for locale tree structure and traversal; Added tests for pattern mapper, key literal validation, and scanner multiplexer; Expanded test coverage for i18n-tasks core features; New test support utilities for i18n-tasks specs.
Dependencies
Update gem dependencies and drop support for Ruby versions older than 3.1
The i18n-tasks gem now requires Ruby 3.1 or newer, dropping support for earlier versions. Several runtime dependencies have been updated or added to support this and improve functionality: 'parser' is now required at version 3.2.2.1 or higher, 'highline' is bumped to 3.0.0 or higher, 'rainbow' is constrained to versions 2.2.2 through 3.x, and 'ast' is required at 2.1.0 or higher. Additionally, 'prism' has been added as a new dependency, while 'erubi' is now explicitly listed as a runtime dependency (replacing the previous 'better\_html' dependency for ERB scanning).
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 71.
Lenses
- Code Health 97
- Architecture 86
- Maturity 57
- Readiness 77
- Security 94
Changes since last survey
- 300 commits — 266 feature/other, 34 fixes
By area
- lib/i18n — 124 commits
- (root) — 112 commits
- .github/workflows — 28 commits
- spec/fixtures — 6 commits
- templates/config — 5 commits
- config/locales — 4 commits
- spec/scanners — 3 commits
- (repo) — 2 commits
- spec/google_translate_spec.rb — 2 commits
- spec/i18n_tasks_spec.rb — 2 commits
- spec/locale_tree — 2 commits
- spec/prism_scanner_spec.rb — 2 commits
- spec/translators — 2 commits
- .github/dependabot.yml — 1 commit
- .vscode/settings.json — 1 commit
- spec/emoji_retention_spec.rb — 1 commit
- spec/used_keys_erb_spec.rb — 1 commit
- spec/used_keys_ruby_spec.rb — 1 commit
- templates/minitest — 1 commit
Notable commits
- fix: Bug fix: relative_exclude_method_name_paths
- fix: Chore: Fixes rubocop Lint/RescueException
- fix: DeepL: Fix single value translation
- fix: Fix "#{double_quoted["hash"]}" pattern
- fix: Fix 'config' option usage in CLI
- fix: Fix Find.find typo in config template (#507)
- fix: Fix Prism scanner recording unscoped key when scope is an unresolvable method call (#731)
- fix: Fix RailsModelMatcher to recognize slash notation in ActiveRecord attribute translations (#703)
- fix: Fix a Rubocop offense
- fix: Fix compatibility with ActiveSupport 7+
- fix: Fix crash when human_attribute_name is called with interpolated string argument (#728)
- fix: Fix jpeg invalid byte sequence when checking unused
- fix: Fix key splitting failures if key contains any parenthesis char
- fix: Fix not ignoring missing for pluralization (#389)
- fix: Fix private method called for warn deprecated (#513)
- fix: Fix rubocop
- fix: Fix rubocop
- fix: Fix unescaped interpolated reserved key in help text and handle escaped interpolations in inconsistent interpolations check (#553)
- fix: Fixes parsing of ERB comments without a space
- fix: Fixes rubocop errors
- …and 280 more
Architecture
- 0 containers · 1 bounded contexts · 0 dependency edges (baseline)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
glebm/i18n-tasks was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit fdbf7b14c846c321e6a540f69d3a641fc82088bd — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.