Commit 7080d388 authored by Michal Čihař's avatar Michal Čihař

Do auto translation string matching at database level

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent c65e3d58
......@@ -50,13 +50,16 @@ def auto_translate(user, translation, source, inconsistent, overwrite):
translation=translation
)
# Filter by strings
units = units.filter(
source__in=sources.values('source')
)
translation.commit_pending(None)
for unit in units.iterator():
update = sources.filter(source=unit.source)
if update.exists():
# Get first entry
update = update[0]
# Get first matching entry
update = sources.filter(source=unit.source)[0]
# No save if translation is same
if unit.fuzzy == update.fuzzy and unit.target == update.target:
continue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment