feat: add multilingual mass unit aliases for all 7 app languages#108
Open
feat: add multilingual mass unit aliases for all 7 app languages#108
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #99
Add non-Latin mass unit aliases (кг, г, тонна, 千克, 公斤, किलोग्राम, كيلوغرام, etc.) to MassUnit::parse() for Russian, Chinese, Hindi, Arabic, German, and French. Also fix pre-existing compilation error in number_grammar.rs where DurationUnit parse returned Unit instead of the expected (Unit, Vec<Unit>) tuple. Fixes #99 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Unicode combining mark support to lexer's scan_identifier() so that Devanagari (Hindi), Arabic diacritics, and other scripts with combining marks are properly tokenized as identifiers. - Add case-insensitive fallback for mass unit parsing in source unit context (German nouns are capitalized: "Kilogramm", "Gramm", etc.) - Add comprehensive test suite (53 tests) covering mass unit conversions in Russian, Chinese, Hindi, Arabic, German, and French. Fixes #99 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit a35b841.
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
📎 Log file uploaded as Gist (2317KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
🔄 Auto-restart triggered (iteration 1)Reason: CI failures detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable. |
The CI/CD pipeline manages version bumps via changelog fragments. The manual version change in Cargo.toml (0.8.2 → 0.9.0) was causing the "Version Modification Check" CI step to fail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
📎 Log file uploaded as Gist (2797KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #99
The calculator did not recognize non-Latin mass unit names like "кг" (Russian for "kg"). While currencies already had extensive multilingual support across all 7 app languages, mass units only had English aliases.
This PR adds:
MassUnit::parse()for Russian (кг, г, мг, тонна, унция with all grammatical cases), Chinese (公斤, 千克, 克, 吨, 磅, 盎司, 毫克), Hindi (किलोग्राम, ग्राम, टन, किलो, औंस, मिलीग्राम), Arabic (كيلوغرام, غرام, طن, رطل, أونصة, كغ), German (Kilogramm, Gramm, Kilo, Unze, Tonnen), and French (kilogramme, gramme, milligramme, once)number_grammar.rswhereDurationUnit::parsereturned the wrong typeChanges
src/types/unit.rsMassUnit::parse()src/grammar/lexer.rsis_unicode_mark()for combining mark support inscan_identifier()src/grammar/number_grammar.rsDurationUnitreturn type bugtests/issue_99_multilingual_mass_tests.rschangelog.d/Cargo.tomlTest plan
cargo fmt --checkpassescargo clippy --all-targets --all-featurespasses clean19 ton в кг) produces19000 kg🤖 Generated with Claude Code