Skip to content

Conversation

@moonchoe
Copy link
Contributor

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:

  • Implemented MultipleCapitalCheck in weblate/checks/chars.py using the regex library to properly handle Unicode uppercase characters.
  • Registered the new check in weblate/checks/models.py.
  • Added regex to project dependencies in pyproject.toml.
  • Added unit tests in weblate/checks/tests/test_chars_checks.py covering positive matches, negative matches (acronyms), and Unicode scenarios.

Verification:

  • Passed all new unit tests via pytest.
  • Passed code style and linting checks (ruff).

@moonchoe moonchoe requested a review from nijel as a code owner December 10, 2025 21:24
@nijel nijel linked an issue Dec 11, 2025 that may be closed by this pull request
Copy link
Member

@nijel nijel left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is useless.

import unicodedata
from typing import TYPE_CHECKING, ClassVar

import regex # pip install regex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, useless comment.

@github-actions
Copy link

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!

@github-actions github-actions bot added the wontfix Will be closed when no feedback arrives. label Jan 11, 2026
@nijel nijel force-pushed the features/issue-8753-multiple-capitals branch from bdf3bf3 to b47d26e Compare January 16, 2026 09:23
@nijel nijel requested a review from AliceVisek as a code owner January 16, 2026 09:23
@nijel nijel requested a review from Copilot January 16, 2026 09:24
@nijel nijel added this to the 5.16 milestone Jan 16, 2026
@nijel nijel self-assigned this Jan 16, 2026
Copy link
Contributor

Copilot AI left a 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 MultipleCapitalCheck implementation 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

# 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):
Copy link

Copilot AI Jan 16, 2026

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.

Suggested change
def check_single(self, source: str, target: str, unit: Unit):
def check_single(self, source: str, target: str, unit: Unit) -> bool:

Copilot uses AI. Check for mistakes.
@nijel
Copy link
Member

nijel commented Jan 16, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

@github-actions github-actions bot removed the wontfix Will be closed when no feedback arrives. label Jan 17, 2026
nijel added 2 commits January 19, 2026 09:24
Use only search as we do not need to find all the matches.
@nijel nijel requested a review from Copilot January 19, 2026 08:28
Copy link
Contributor

Copilot AI left a 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.

@nijel nijel enabled auto-merge (squash) January 19, 2026 13:27
@nijel nijel merged commit b0dbab4 into WeblateOrg:main Jan 19, 2026
50 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.

Check for more than one capital letter per word

2 participants