Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#47093 closed defect (bug) (fixed)

Recovery mode email is not translated

Reported by: desrosj's profile desrosj Owned by: desrosj's profile 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 5 years ago.
47093.2.diff (541 bytes) - added by TimothyBlynJacobs 5 years ago.

Download all attachments as: .zip

Change History (13)

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


5 years ago

#2 follow-up: @TimothyBlynJacobs
5 years 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
5 years 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
5 years ago

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

Last edited 5 years ago by fierevere (previous) (diff)

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


5 years ago

#6 @wolly
5 years 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
5 years ago

  • Keywords has-patch added; needs-patch removed

#8 @swissspidy
5 years ago

The approach in 47093.2.diff looks reasonable to me 👍

#9 @desrosj
5 years ago

  • Keywords commit dev-reviewed added

#10 @desrosj
5 years 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
5 years ago

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