fix: add support for additional languages/dialects (closes #9)#24
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds five new languages (Bengali, Gujarati, Punjabi, Swahili, Urdu): new text asset files for each language and corresponding enum values and file-code mappings in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
assets/data/bn.txt (1)
1-13: Remove duplicate tokens to reduce redundant matching.
khanki(Line 1, Line 11) andghu(Line 5, Line 13) are duplicated.Proposed cleanup
khanki madarchod bal choda ghu khankir magi saala bhenchod shala -khanki tor -ghu🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@assets/data/bn.txt` around lines 1 - 13, Remove the duplicate offensive tokens by keeping a single instance of "khanki" and a single instance of "ghu" in the token list (remove the second "khanki" and the second "ghu"), ensuring the file contains only unique tokens; preserve the original ordering of first occurrences when deduplicating and save the cleaned list back to the same file.lib/src/models/language.dart (1)
318-332: Add tests for the new language mappings and data loading.The new
fromString/fileCodemappings are correct, but there’s no coverage for Bengali/Gujarati/Punjabi/Swahili/Urdu intest/language_data_test.dart(seetest/language_data_test.dart:1-96). Please add round-trip mapping tests plus at least one bad-word detection check per new language.Also applies to: 494-503
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/src/models/language.dart` around lines 318 - 332, Add unit tests to cover the new Language mappings and data loading for Bengali, Gujarati, Punjabi, Swahili, and Urdu: in the language data test file add round-trip mapping assertions that Language.fromString(...) returns the expected enum (e.g., Language.fromString('bn') -> Language.bengali) and that the enum returns the correct fileCode/string representation (via the existing fileCode/toString helper) for each new language, and add at least one bad-word detection assertion per language using the existing bad-word lookup helper used by other tests (reuse the same pattern/assertions as existing tests for other languages so they load language data and detect a known bad word). Ensure you reference and exercise Language.fromString, the enum values (Language.bengali, Language.gujarati, Language.punjabi, Language.swahili, Language.urdu), and the fileCode accessor so the tests assert both mapping directions and bad-word detection.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@assets/data/bn.txt`:
- Around line 1-13: Remove the duplicate offensive tokens by keeping a single
instance of "khanki" and a single instance of "ghu" in the token list (remove
the second "khanki" and the second "ghu"), ensuring the file contains only
unique tokens; preserve the original ordering of first occurrences when
deduplicating and save the cleaned list back to the same file.
In `@lib/src/models/language.dart`:
- Around line 318-332: Add unit tests to cover the new Language mappings and
data loading for Bengali, Gujarati, Punjabi, Swahili, and Urdu: in the language
data test file add round-trip mapping assertions that Language.fromString(...)
returns the expected enum (e.g., Language.fromString('bn') -> Language.bengali)
and that the enum returns the correct fileCode/string representation (via the
existing fileCode/toString helper) for each new language, and add at least one
bad-word detection assertion per language using the existing bad-word lookup
helper used by other tests (reuse the same pattern/assertions as existing tests
for other languages so they load language data and detect a known bad word).
Ensure you reference and exercise Language.fromString, the enum values
(Language.bengali, Language.gujarati, Language.punjabi, Language.swahili,
Language.urdu), and the fileCode accessor so the tests assert both mapping
directions and bad-word detection.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: dfb5ec04-dd84-48ed-8e37-3ab26d635071
📒 Files selected for processing (6)
assets/data/bn.txtassets/data/gu.txtassets/data/pa.txtassets/data/sw.txtassets/data/ur.txtlib/src/models/language.dart
|
Hi @Deepak8858, I accidentally merged and reverted this earlier. I’ve recreated the PR from my side, thanks again for the contribution 🙌 |
This PR adds support for Bengali (bn), Gujarati (gu), Punjabi (pa), Swahili (sw), and Urdu (ur). These languages are now part of the
Languageenum and have corresponding bad word lists inassets/data/.Summary by CodeRabbit