Skip to content
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

feat: localize comma in consistency checks #13948

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion weblate/checks/consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from django.utils.translation import gettext, gettext_lazy, ngettext

from weblate.checks.base import BatchCheckMixin, TargetCheck
from weblate.utils.html import format_html_join_comma
from weblate.utils.state import STATE_TRANSLATED

if TYPE_CHECKING:
Expand Down Expand Up @@ -206,7 +207,9 @@

return ngettext(
"Other source string: %s", "Other source strings: %s", len(other_sources)
) % ", ".join(gettext("“%s”") % source for source in other_sources)
) % format_html_join_comma(
"{}", ((gettext("“%s”") % source,) for source in other_sources)
)

def check_single(self, source: str, target: str, unit: Unit) -> bool:
"""Target strings are checked in check_target_unit."""
Expand Down Expand Up @@ -266,11 +269,11 @@
key = (unit.translation.language.code, unit.target)
lower_source = unit.source.lower()
found[key].add(lower_source)
remaining.append((key, unit))

Check failure on line 272 in weblate/checks/consistency.py

View workflow job for this annotation

GitHub Actions / mypy

Argument 1 to "append" of "list" has incompatible type "tuple[tuple[Any, Any], Any]"; expected "tuple[str, Unit]"
else:
yield unit

for key, unit in remaining:

Check failure on line 276 in weblate/checks/consistency.py

View workflow job for this annotation

GitHub Actions / mypy

Incompatible types in assignment (expression has type "str", variable has type "tuple[Any, Any]")
if len(found[key]) > 1:
yield unit

Expand Down
Loading