Skip to content

Add i18n support for 7 languages#10

Merged
MatrixA merged 2 commits intomainfrom
MatrixA/i18n-detect-output
Mar 11, 2026
Merged

Add i18n support for 7 languages#10
MatrixA merged 2 commits intomainfrom
MatrixA/i18n-detect-output

Conversation

@MatrixA
Copy link
Copy Markdown
Owner

@MatrixA MatrixA commented Mar 11, 2026

Summary

Implement complete internationalization (i18n) support for the aic CLI tool with automatic system locale detection. Users can now see detection results in their preferred language: English, Chinese (Simplified), German, Japanese, Korean, Hindi, or Spanish.

Key Changes

  • Added rust-i18n v3 and sys-locale crates for compile-time locale loading and runtime locale detection
  • Created i18n.rs module with locale detection, initialization, and message rendering utilities
  • Added 7 YAML translation files (locales/) with ~40 keys covering verdicts, headers, errors, and all signal descriptions
  • Extended Signal struct with msg_key and msg_params fields (serde-skipped) to enable dual rendering: English descriptions for JSON output, localized messages for human output
  • Implemented SignalBuilder pattern for constructing signals with both English and localized text
  • Updated all 10 detector modules to use SignalBuilder API
  • Localized human-readable output: verdict labels, section headers, error messages, signal descriptions
  • Added --lang CLI flag for manual locale override
  • Fixed integration tests to work with locale-aware assertions

Test Results

All 58 tests pass:

  • 44 unit tests ✓
  • 14 integration tests ✓
  • Verified JSON output stays in English (machine-readable)
  • Verified human output in multiple languages (en, zh-CN, ja, etc.)

🤖 Generated with Claude Code

MatrixA and others added 2 commits March 11, 2026 15:21
Implement complete i18n infrastructure with auto-detection of user locale:
- Add rust-i18n v3 and sys-locale crates
- Create i18n.rs module with locale detection and message rendering
- Add 7 language YAML files: English, Chinese (zh-CN), German, Japanese, Korean, Hindi, Spanish
- Extend Signal struct with msg_key/msg_params for localization (serde-skipped)
- Implement SignalBuilder pattern for constructing signals with both English descriptions (for JSON) and localized messages
- Update all 10 detector modules to use new SignalBuilder API
- Localize all human-readable output: verdicts, headers, error messages, signal descriptions
- Ensure JSON output remains in English for machine readability
- Add --lang CLI flag for manual locale override
- Fix integration tests with locale-dependent string assertions

This enables users to see detection results in their preferred language while maintaining backward compatibility with JSON output.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Convert module doc comment in i18n.rs to inner doc comment (//!) to
  avoid empty-line-after-doc-comments lint
- Remove unnecessary & on format!() and .to_string() calls passed to
  impl Into<String> params in audio_spectral.rs, exif.rs, png_text.rs,
  wav_metadata.rs (needless_borrows_for_generic_args)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MatrixA MatrixA merged commit e6a3a3f into main Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant