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

Pretranslations with warnings are committed to the repository #3589

Open
mathjazz opened this issue Mar 3, 2025 · 2 comments
Open

Pretranslations with warnings are committed to the repository #3589

mathjazz opened this issue Mar 3, 2025 · 2 comments
Labels
P2 We want to ship it soon, possibly in the current quarter

Comments

@mathjazz mathjazz added the P2 We want to ship it soon, possibly in the current quarter label Mar 3, 2025
@eemeli
Copy link
Member

eemeli commented Mar 5, 2025

Took a quick look, the logic here seems to be the culprit:

pretranslations = get_pretranslations(entity, locale)
if not pretranslations:
continue
failed_checks = run_checks(
entity,
locale.code,
entity.string,
pretranslations[0][0],
use_tt_checks=False,
)
if failed_checks:
pretranslations = get_pretranslations(
entity, locale, preserve_placeables=True
)
for string, plural_form, user in pretranslations:
t = Translation(
entity=entity,

Essentially, we first get pretranslations with preserve_placeables=False, then run_checks() on them, and if they fail, get the pretranslations again but with preserve_placeables=True. Crucially, the checks are not then run again, so any remaining warnings and errors are not caught.

@mathjazz
Copy link
Collaborator Author

mathjazz commented Mar 5, 2025

run_checks() does not store failed checks in the DB. That's done further below by bulk_run_checks():

# Run checks on all translations
translation_pks = {translation.pk for translation in translations}
bulk_run_checks(Translation.objects.for_checks().filter(pk__in=translation_pks))
# Mark translations as changed
changed_translations = Translation.objects.filter(
pk__in=translation_pks,
# Do not sync translations with errors and warnings
errors__isnull=True,
warnings__isnull=True,
)
changed_translations.bulk_mark_changed()

Note that we haven't found any failing translations without errors or warnings shown in the UI. The problem is solely that failing translations end up in the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We want to ship it soon, possibly in the current quarter
Projects
None yet
Development

No branches or pull requests

2 participants