-
-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(autofixes): skip devanagari danda fix for latin variants
This also adds type annotation to autofixes. Fixes #12517
- Loading branch information
Showing
3 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
# Copyright © Michal Čihař <[email protected]> | ||
# | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from weblate.trans.models import Unit | ||
|
||
|
||
class AutoFix: | ||
"""Base class for AutoFixes.""" | ||
|
@@ -16,11 +22,13 @@ def get_identifier(self): | |
def get_related_checks(): | ||
return [] | ||
|
||
def fix_single_target(self, target, source, unit) -> tuple[str, bool]: | ||
def fix_single_target( | ||
self, target: str, source: str, unit: Unit | ||
) -> tuple[str, bool]: | ||
"""Fix a single target, implement this method in subclasses.""" | ||
raise NotImplementedError | ||
|
||
def fix_target(self, target, unit): | ||
def fix_target(self, target: str, unit: Unit) -> tuple[list[str], bool]: | ||
"""Return a target translation array with a single fix applied.""" | ||
source_strings = unit.get_source_plurals() | ||
if unit.translation.component.is_multivalue: | ||
|
This file contains 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