Skip to content

Translate task-update notifications - #1684

Open
dlq wants to merge 1 commit into
aces:devfrom
dlq:translate-task-update-notifications
Open

dlq wants to merge 1 commit into
aces:devfrom
dlq:translate-task-update-notifications

Conversation

@dlq

@dlq dlq commented Oct 27, 2026

Copy link
Copy Markdown

Bulk task updates currently send English notification subjects and failure reasons in French sessions. Translate success/failure subjects, all four access/configuration failure reasons, and the shared task-count prefix (“Pour 1 tâche” / “Pour 6 tâches”). Preserve task links, update behavior, and non-task notification formatting.

Validation in the local Apple-container Rails portal, English and French:

  • Exercised the actual bulk-update controller’s background branch for success and all four failure reasons, with task mutations and process spawning stubbed. Checked generated headers, reasons, counts, and task links.
  • Checked singular/plural task counts and compared non-task helper output with the original formatting in both locales.
  • Desktop Chromium: opened the generated notifications in the live portal and expanded their details; subjects, reasons, counts and links passed, with no JavaScript errors.
  • Test messages were sent only to a disposable local QA account, with email disabled; the account and messages were removed afterward. No real task updates or processing jobs were run.
  • git diff --check passed; trial merge with [ADD] errors in I18n format #1677 at 0067e3e was clean.

Related to #1660. Independent branch based on dev; no validation-message keys overlap #1677.

@prioux prioux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bug in the PR, see comment.

:message_type => :notice,
:header => header,
:variable_text => "For #{view_pluralize(success_list.count,type)}"
:variable_text => message_count_prefix(success_list)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a mistake. The original code would log messages with a prefix that depends on the type of the first object in success_list, which could be any CBRAIN object. This was done by line 31 in the original code which said

type   = generic_human_type(success_list.first)

So we got messages like "For 3 files" or "For 5 users" or "For 7 tasks".

But this PR has hardcoded that the messages now always say "tasks". which will be very misleading when the list is not tasks.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Pierre — agreed that this shared helper must preserve the object type. That distinction is retained in the extracted message_count_prefix helper near the bottom of the file:

def message_count_prefix(objects)
  return I18n.t('task_message_helpers.for_tasks', :count => objects.size) if objects.first.is_a?(CbrainTask)
  "For #{view_pluralize(objects.size, generic_human_type(objects.first))}"
end

The translated task wording is used only when the first object is a CbrainTask. For files, users, and other non-task objects, the fallback still calls generic_human_type and view_pluralize, preserving the original wording such as “For 3 files” or “For 5 users”. Both the notice and error helpers call this method.

The English/French checks also compared non-task helper output against the original formatting. Non-task prefixes intentionally remain in their original English wording in this task-specific PR.

@prioux

prioux commented Oct 29, 2026

Copy link
Copy Markdown
Member

@dlq You're absolutely right, I didn't see the handling of the object types in there. All good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants