Skip to content

Commit

Permalink
add-ons: Fix autotranslate invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Oct 27, 2021
1 parent 0cc5b2c commit 30c76a1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions weblate/trans/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,11 @@ def auto_translate_component(
auto_source: str,
engines: List[str],
threshold: int,
component: Optional[Component] = None,
component: Optional[int],
):
if component is None:
component = Component.objects.get(pk=component_id)
component_obj = Component.objects.get(pk=component_id)

for translation in component.translation_set.iterator():
for translation in component_obj.translation_set.iterator():
if translation.is_source:
continue

Expand All @@ -440,15 +439,15 @@ def auto_translate_component(
mode,
filter_type,
auto_source,
component.id,
component,
engines,
threshold,
translation=translation,
component_wide=True,
)
component.update_source_checks()
component.run_batched_checks()
return {"component": component.id}
component_obj.update_source_checks()
component_obj.run_batched_checks()
return {"component": component_obj.id}


@app.task(trail=False)
Expand Down

0 comments on commit 30c76a1

Please sign in to comment.