Skip to content

Fix locale restoration for email reports.#13147

Open
techanvil wants to merge 6 commits into
developfrom
enhancement/12883-fix-email-report-builder-locale
Open

Fix locale restoration for email reports.#13147
techanvil wants to merge 6 commits into
developfrom
enhancement/12883-fix-email-report-builder-locale

Conversation

@techanvil

@techanvil techanvil commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Addresses issue:

Relevant technical choices

The changes specced in the IB didn't fix the issue - translations also occur via the methods Email_Template_Formatter::build_template_payload() and Email_Report_Sender::send().

Moving locale switching and restoration to Email_Log_Processor::process() is a correct fix for the issue.

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

🤖 This comment is automatically updated by CI workflows. Each section is managed independently.

📦 Build files for 6a3eeb8:

🎭 Playwright reports for 6a3eeb8:


$sections = $this->build_sections_for_log( $email_log, $user, $raw_payload );
$user_locale = get_user_locale( $user );
$switched_locale = switch_to_locale( $user_locale );

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The changes specced in the IB didn't fix the issue - translations also occur via the methods Email_Template_Formatter::build_template_payload() and Email_Report_Sender::send().

Moving locale switching and restoration to Email_Log_Processor::process() is a correct fix for the issue.

@techanvil techanvil changed the title Fix locale restoration in email report builder. Fix locale restoration for email reports. Jul 21, 2026
* @param Email_Report_Data_Section_Part[] $sections Built section parts.
* @return array
*/
private function to_sections_payload( array $sections ) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These methods were unused.

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.

1 participant