-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Checks: Add MultipleCapitalCheck for issue #8753 #17265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checks: Add MultipleCapitalCheck for issue #8753 #17265
Conversation
nijel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- For the check to be used it needs to be listed in the default set of checks in weblate/settings_docker.py and weblate/checks/models.py.
- Can you please add documentation and changelog entry?
| KabyleCharactersCheck, | ||
| KashidaCheck, | ||
| MaxLengthCheck, | ||
| MultipleCapitalCheck, # added class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is useless.
weblate/checks/chars.py
Outdated
| import unicodedata | ||
| from typing import TYPE_CHECKING, ClassVar | ||
|
|
||
| import regex # pip install regex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, useless comment.
|
This pull request has been automatically marked as stale because there wasn’t any recent activity. It will be closed soon if no further action occurs. Thank you for your contributions! |
bdf3bf3 to
b47d26e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new quality check called MultipleCapitalCheck to detect words with multiple consecutive or misplaced capital letters (e.g., "HEllo", "CAmelCase"), which are commonly typos. The check helps translators identify potential capitalization errors.
Changes:
- Added
MultipleCapitalCheckimplementation to detect multiple consecutive uppercase letters in translations - Registered the check in configuration files for both Django settings and Docker settings
- Added test coverage for the new check including positive matches, acronym handling, and Unicode support
- Documented the new check in user documentation and changelog
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| weblate/checks/chars.py | Implements the MultipleCapitalCheck using regex library to match Unicode uppercase sequences |
| weblate/checks/models.py | Registers the new check in the default checks list |
| weblate/settings_docker.py | Adds the check to Docker configuration |
| weblate/checks/tests/test_chars_checks.py | Adds test cases for the new check |
| docs/user/checks.rst | Documents the check with usage details and flag information |
| docs/changes.rst | Adds changelog entry for the new feature |
weblate/checks/chars.py
Outdated
| # matches sequences of 2+ uppercase letters in *any language* | ||
| UPPERCASE_SEQ = regex.compile(r"\p{Lu}{2,}") | ||
|
|
||
| def check_single(self, source: str, target: str, unit: Unit): |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method signature is missing a return type annotation. For consistency with Weblate's type hint requirements, add -> bool as the return type annotation.
| def check_single(self, source: str, target: str, unit: Unit): | |
| def check_single(self, source: str, target: str, unit: Unit) -> bool: |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Use only search as we do not need to find all the matches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Issue #8753
introduces a new quality check called MultipleCapitalCheck. It detects words that contain multiple consecutive or misplaced capital letters (like HEllo or CAmelCase), which are commonly typos.
Changes:
Verification: