Skip to content

Commit

Permalink
Formats: Fix handling context in monolingual formats
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Mar 11, 2021
1 parent 1f0b5ef commit cfc4e75
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion weblate/formats/ttkit.py
Expand Up @@ -371,7 +371,7 @@ def create_unit(
target = multistring(target)
if key:
unit.setid(key)
if hasattr(unit, "setcontext"):
if hasattr(unit, "setcontext") and self.set_context_bilingual:
unit.setcontext(key)
elif target is not None and self.set_context_bilingual:
unit.setid(context)
Expand Down Expand Up @@ -1029,6 +1029,7 @@ class PoMonoFormat(BasePoFormat):
)
unit_class = PoMonoUnit
bilingual_class = PoFormat
set_context_bilingual = False

def create_unit_key(self, key: str, source: Union[str, List[str]]) -> str:
if isinstance(source, list):
Expand All @@ -1042,6 +1043,7 @@ class TSFormat(TTKitFormat):
loader = tsfile
autoload = ("*.ts",)
unit_class = TSUnit
set_context_bilingual = False

@classmethod
def untranslate_store(cls, store, language, fuzzy=False):
Expand Down

0 comments on commit cfc4e75

Please sign in to comment.