WordPress.org

Make WordPress Core

Opened 18 months ago

Closed 18 months ago

Last modified 16 months ago

#47093 closed defect (bug) (fixed)

Recovery mode email is not translated

Reported by: desrosj Owned by: desrosj
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords: servehappy has-patch commit dev-reviewed
Focuses: Cc:

Description

Reported by @fierevere and @wolly in Slack.

When the recovery mode email is sent out, it is always in en_US.

Attachments (2)

47093.diff (660 bytes) - added by TimothyBlynJacobs 18 months ago.
47093.2.diff (541 bytes) - added by TimothyBlynJacobs 18 months ago.

Download all attachments as: .zip

Change History (13)

This ticket was mentioned in Slack in #core by desrosj. View the logs.


18 months ago

#2 follow-up: @TimothyBlynJacobs
18 months ago

This happens if the fatal error occurs before load_default_textdomain() is called.

I was able to fix this by adding a call to load_default_textdomain at the top of WP_Recovery_Mode_Email_Service::send_recovery_mode_email. I guess we'd need to check something like this? Not super familiar with the potential ramifications.

if ( ! isset( $GLOBALS['wp_locale'] ) ) {
    load_default_textdomain();
}

Using wp_load_translations_early only works for me if I have WPLANG set in wp-config.php.

#3 in reply to: ↑ 2 @SergeyBiryukov
18 months ago

Replying to TimothyBlynJacobs:

I guess we'd need to check something like this? Not super familiar with the potential ramifications.

if ( ! isset( $GLOBALS['wp_locale'] ) ) {
    load_default_textdomain();
}

Looks good to me, let's do that.

Using wp_load_translations_early only works for me if I have WPLANG set in wp-config.php.

Related: #30049

#4 @fierevere
18 months ago

with both patches applied, issue with mail text, mail subject and die messages are solved for me.

Last edited 18 months ago by fierevere (previous) (diff)

This ticket was mentioned in Slack in #core by chanthaboune. View the logs.


18 months ago

#6 @wolly
18 months ago

I applied the two parches, and everything run as expected.

All the messages are in italian.

Email is in italian.

Thanx a loto

#7 @mukesh27
18 months ago

  • Keywords has-patch added; needs-patch removed

#8 @swissspidy
18 months ago

The approach in 47093.2.diff looks reasonable to me 👍

#9 @desrosj
18 months ago

  • Keywords commit dev-reviewed added

#10 @desrosj
18 months ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 45277:

Bootstrap/Load: Ensure recovery link email and related notices are properly translated.

When recovery mode is triggered before the site’s locale has been initialized, the message displayed to the user and the email sent to the site administrator with the recovery mode link are always rendered in en_US. This change ensures the site’s locale is used even when an error happens early in the loading process.

Reviewed by swissspidy, SergeyBiryukov, and desrosj.

Props wolly, TimothyBlynJacobs, fierevere.
Fixes #47093.

#11 @spacedmonkey
16 months ago

  • Component changed from Administration to Site Health
Note: See TracTickets for help on using tickets.