Repository navigation
Batch actions: Add the ability to pretranslate strings - #4455
Conversation
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
|
I haven't looked at the code, but
This should not be available to contributors. I would go as far as to limit this to members of the pretranslator group. |
What do you mean by "pretranslator group"? Batch actions in general are only available to translators. |
There is a
In this case, I don't think it should. We want visibility on which projects have pretranslation enabled, and check quality. |
|
Could you elaborate in more detail a bit on how you envision that to work? How would I as a translator join the group?
Why is that not possible if pretranslation is available to translators or managers? |
|
Can we move this conversation to the issue?
They wouldn't, that's a manually curated group, because the associated API has a cost and can be abused. Pretranslation is enabled on a locale+project base with strict criteria. Why would we suddenly change this, through batch actions of all places?
Pretranslation is not available to translators or managers. Pretranslation is enabled on a project and locale, and by default will translate all resources in the project: what's the goal of having a batch action? |
f335fbf to
9f335e9
Compare
|
@MundiaNderi |
|
Looks like it was posted in the wrong PR? #4406 (comment) Can it be that you run the migration with an old version of moz-l10n, and that didn't fix existing strings with PLATFORM()? See #4533 (comment) |
Ah yes - the 'wrong PR' was what I had open during the meeting. I will look into the new issue and see if there's any correlation, then revert, possibly tomorrow evening / Friday. |
fce5ee6 to
a1ea4ee
Compare
Yup - let's keep the validation pipeline used by the pretranslation task. |
|
One more thing we should change: batch pretranslation currently runs synchronously inside the atomic HTTP request, and it can easily time out while performing external MT calls; it should instead run in the background with an in-progress UI state. |
b0bc75a to
d387b86
Compare
This still needs to be addressed. |
mathjazz
left a comment
There was a problem hiding this comment.
Thanks for the update.
Found a few issue, see the outstanding comment about async and the inline comment.
Also, in pontoon/batch/views.py:183:update_translation_memory() we are adding pretranslations to TM. Pretranslations are unapproved machine output, so they shouldn't go into Translation Memory.
This comment was marked as abuse.
This comment was marked as abuse.
Batch actions: Add the ability to pretranslate strings This is a draft pr because I want to context switch Allows contributors to manually batch pretranslate strings for locales supported by translation engines.
candidate fails to parse, rather than failing the whole batch. Mirrors the existing behavior in pretranslation/tasks.py
EditorMenu only renders when no entities are batch-selected, so requestInProgress === 'pretranslate' can never coincide with it being mounted. In-progress feedback already exists in Pretranslate.tsx.
pretranslation candidate or an unparsable one
b5895e5 to
c35ec9e
Compare
mathjazz
left a comment
There was a problem hiding this comment.
Thanks for the update! Left a comment inline.
- Recalculate TranslatedResource stats even when every pretranslation fails its checks, so error/warning counts don't go stale - Report invalid entity PKs and invalid translation PKs separately instead of mixing them in one list; sum them for the task result - Fall back to per-translation activation when the bulk update hits an IntegrityError - Poll for the pretranslation status immediately, and extend the client timeout to 1 hour to match SYNC_TASK_TIMEOUT - Allow superusers through IsPretranslator via can_pretranslate() - Remove the unused `pretranslate` field from BatchActionsForm
mathjazz
left a comment
There was a problem hiding this comment.
Almost there - just a few comments left.
…ures - Expose SYNC_TASK_TIMEOUT to the translate page via a data attribute and use it for the pretranslation polling window, falling back to 1 hour - Remove the unused `pretranslate` param from the client API call - Log a warning when a pretranslation cannot be activated after an IntegrityError
mathjazz
left a comment
There was a problem hiding this comment.
Tested locally and it looks good - great work!
Thanks for addressing the review feedback.
Please add a paragraph to the docs and note that the feature is only available to users with permissions and we can merge it.

Fixes #2790
This is a draft pr because I want to context switch
Allows contributors to manually batch pretranslate strings for locales supported by translation engines.