pontoon icon indicating copy to clipboard operation
pontoon copied to clipboard

Can't save term translation after updating the term's text in DB

Open flodolo opened this issue 1 year ago • 1 comments

I've changed the term's text to Review checker, since that's the correct capitalization in English (changed from the original) https://pontoon.mozilla.org/a/terminology/term/666/change/

To my surprise, the term showed up as untranslated for Italian. The other problem is that I cannot save the translation: https://pontoon.mozilla.org/it/terminology/all-resources/?status=missing&string=301053

Error in log is

Internal Server Error: /translations/create/
    response = get_response(request)
  File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    return func(request, *args, **kwargs)
  File "/app/pontoon/base/utils.py", line 126, in wrap
    return f(request, *args, **kwargs)
  File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/app/.heroku/python/lib/python3.9/contextlib.py", line 79, in inner
  File "/app/pontoon/translations/views.py", line 117, in create_translation
    translation.save(failed_checks=failed_checks)
  File "/app/pontoon/base/models.py", line 3429, in save
    self.entity.reset_term_translation(self.locale)
  File "/app/pontoon/base/models.py", line 2865, in reset_term_translation
    term = self.term
pontoon.base.models.Entity.term.RelatedObjectDoesNotExist: Entity has no term.

flodolo avatar Feb 13 '24 07:02 flodolo

To my surprise, the term showed up as untranslated for Italian.

That's what the spec says: https://github.com/mozilla/pontoon/blob/main/specs/0102-terminology-translation.md#synchronization-between-translation-project-and-data-model

See: When a Term instance is updated: section.

The other problem is that I cannot save the translation: https://pontoon.mozilla.org/it/terminology/all-resources/?status=missing&string=301053

The old (now obsolete) entity remains assigned to the Term rather than the newly created one. I fixed it manually for this particular case, so it can be translated.

mathjazz avatar Feb 13 '24 07:02 mathjazz