From 62e04e0f6a3bf86d64b9fedb38db0b67b8c00418 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 11 Mar 2026 20:48:05 +0100 Subject: [PATCH 1/3] fix typos --- providers/class-two-factor-email.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/class-two-factor-email.php b/providers/class-two-factor-email.php index 7722e33e..a74da20f 100644 --- a/providers/class-two-factor-email.php +++ b/providers/class-two-factor-email.php @@ -297,7 +297,7 @@ public function generate_and_email_token( $user ) { $ttl_minutes ), sprintf( - /* translators: $1$s: IP address of user, $2$s: user login */ + /* translators: %1$s: IP address of user, %2$s: user login */ __( 'A user from IP address %1$s has successfully authenticated as %2$s. If this wasn\'t you, please change your password.', 'two-factor' ), $remote_ip, $user->user_login From 950cb2814927ffc61c353d8e5e4902dac8e0c660 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 11 Mar 2026 20:59:40 +0100 Subject: [PATCH 2/3] make emails translateable --- class-two-factor-core.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/class-two-factor-core.php b/class-two-factor-core.php index c034c53d..9e9a7087 100644 --- a/class-two-factor-core.php +++ b/class-two-factor-core.php @@ -1886,7 +1886,8 @@ public static function send_password_reset_emails( $user ) { */ public static function notify_user_password_reset( $user ) { $user_message = sprintf( - 'Hello %1$s, an unusually high number of failed login attempts have been detected on your account at %2$s. + /* translators: 1: username, 2: site URL, 3: URL to password best-practices article, 4: URL to reset password */ + __( 'Hello %1$s, an unusually high number of failed login attempts have been detected on your account at %2$s. These attempts successfully entered your password, and were only blocked because they failed to enter your second authentication factor. Despite not being able to access your account, this behavior indicates that the attackers have compromised your password. The most common reasons for this are that your password was easy to guess, or was reused on another site which has been compromised. @@ -1894,7 +1895,7 @@ public static function notify_user_password_reset( $user ) { To pick a new password, please visit %4$s - This is an automated notification. If you would like to speak to a site administrator, please contact them directly.', + This is an automated notification. If you would like to speak to a site administrator, please contact them directly.', 'two-factor' ), esc_html( $user->user_login ), home_url(), 'https://wordpress.org/documentation/article/password-best-practices/', @@ -1902,7 +1903,7 @@ public static function notify_user_password_reset( $user ) { ); $user_message = str_replace( "\t", '', $user_message ); - return wp_mail( $user->user_email, 'Your password was compromised and has been reset', $user_message ); + return wp_mail( $user->user_email, __( 'Your password was compromised and has been reset', 'two-factor' ), $user_message ); } /** @@ -1916,10 +1917,15 @@ public static function notify_user_password_reset( $user ) { */ public static function notify_admin_user_password_reset( $user ) { $admin_email = get_option( 'admin_email' ); - $subject = sprintf( 'Compromised password for %s has been reset', esc_html( $user->user_login ) ); + $subject = sprintf( + /* translators: %s: username */ + __( 'Compromised password for %s has been reset', 'two-factor' ), + esc_html( $user->user_login ) + ); $message = sprintf( - 'Hello, this is a notice from the Two Factor plugin to inform you that an unusually high number of failed login attempts have been detected on the %1$s account (ID %2$d). + /* translators: 1: username, 2: user ID, 3: URL to developer docs */ + __( 'Hello, this is a notice from the Two Factor plugin to inform you that an unusually high number of failed login attempts have been detected on the %1$s account (ID %2$d). Those attempts successfully entered the user\'s password, and were only blocked because they entered invalid second authentication factors. @@ -1927,7 +1933,7 @@ public static function notify_admin_user_password_reset( $user ) { If you do not wish to receive these notifications, you can disable them with the `two_factor_notify_admin_user_password_reset` filter. See %3$s for more information. - Thank you', + Thank you', 'two-factor' ), esc_html( $user->user_login ), $user->ID, 'https://developer.wordpress.org/plugins/hooks/' @@ -2023,10 +2029,10 @@ public static function user_two_factor_options( $user ) { ); $notices['warning two-factor-warning-revalidate-session'] = sprintf( - esc_html__( 'To update your Two-Factor options, you must first revalidate your session.', 'two-factor' ) . - ' ' . esc_html__( 'Revalidate now', 'two-factor' ) . '', + /* translators: %s: URL to revalidate the session */ + __( 'To update your Two-Factor options, you must first revalidate your session. Revalidate now', 'two-factor' ), esc_url( $url ) - ); + ); } if ( empty( $providers ) ) { From ec5ad025bc9a720bee246428751305f750b0b2f2 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 11 Mar 2026 21:04:22 +0100 Subject: [PATCH 3/3] fix phpstan issue --- class-two-factor-core.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class-two-factor-core.php b/class-two-factor-core.php index 9e9a7087..505b9658 100644 --- a/class-two-factor-core.php +++ b/class-two-factor-core.php @@ -2032,7 +2032,7 @@ public static function user_two_factor_options( $user ) { /* translators: %s: URL to revalidate the session */ __( 'To update your Two-Factor options, you must first revalidate your session. Revalidate now', 'two-factor' ), esc_url( $url ) - ); + ); } if ( empty( $providers ) ) {