Skip to content

Commit

Permalink
fix: partial text domain update for the newspack plugin (#2646) (#2654)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford authored Sep 20, 2023
1 parent f942c6b commit 3b5b713
Show file tree
Hide file tree
Showing 8 changed files with 589 additions and 8,154 deletions.
24 changes: 12 additions & 12 deletions assets/blocks/reader-registration/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ function register_block() {
'newspack/reader-registration',
[
'name' => 'stacked',
'label' => __( 'Stacked', 'newspack' ),
'label' => __( 'Stacked', 'newspack-plugin' ),
'is_default' => true,
]
);
\register_block_style(
'newspack/reader-registration',
[
'name' => 'columns',
'label' => __( 'Columns (newsletter subscription)', 'newspack' ),
'label' => __( 'Columns (newsletter subscription)', 'newspack-plugin' ),
]
);
}
Expand Down Expand Up @@ -107,24 +107,24 @@ function render_block( $attrs, $content ) {
$registered = false;
$my_account_url = function_exists( 'wc_get_account_endpoint_url' ) ? \wc_get_account_endpoint_url( 'dashboard' ) : false;
$message = '';
$success_message = __( 'Thank you for registering!', 'newspack' ) . '<br />';
$success_message = __( 'Thank you for registering!', 'newspack-plugin' ) . '<br />';

if ( $my_account_url ) {
$success_message .= sprintf(
// Translators: %s is a link to My Account.
__( 'Please visit %s to verify and manage your account.', 'newspack' ),
'<a href="' . esc_url( $my_account_url ) . '">' . __( 'My Account', 'newspack' ) . '</a>'
__( 'Please visit %s to verify and manage your account.', 'newspack-plugin' ),
'<a href="' . esc_url( $my_account_url ) . '">' . __( 'My Account', 'newspack-plugin' ) . '</a>'
);
}

/** Handle default attributes. */
$default_attrs = [
'style' => 'stacked',
'label' => __( 'Sign up', 'newspack' ),
'newsletterLabel' => __( 'Subscribe to our newsletter', 'newspack' ),
'haveAccountLabel' => __( 'Already have an account?', 'newspack' ),
'signInLabel' => __( 'Sign in', 'newspack' ),
'signedInLabel' => __( 'An account was already registered with this email. Please check your inbox for an authentication link.', 'newspack' ),
'label' => __( 'Sign up', 'newspack-plugin' ),
'newsletterLabel' => __( 'Subscribe to our newsletter', 'newspack-plugin' ),
'haveAccountLabel' => __( 'Already have an account?', 'newspack-plugin' ),
'signInLabel' => __( 'Sign in', 'newspack-plugin' ),
'signedInLabel' => __( 'An account was already registered with this email. Please check your inbox for an authentication link.', 'newspack-plugin' ),
];
$attrs = \wp_parse_args( $attrs, $default_attrs );
foreach ( $default_attrs as $key => $value ) {
Expand Down Expand Up @@ -340,7 +340,7 @@ function get_block_classes( $attrs = [] ) {
function send_form_response( $data, $message = '' ) {
$is_error = \is_wp_error( $data );
if ( empty( $message ) ) {
$message = $is_error ? $data->get_error_message() : __( 'Thank you for registering!', 'newspack' );
$message = $is_error ? $data->get_error_message() : __( 'Thank you for registering!', 'newspack-plugin' );
}
if ( \wp_is_json_request() ) {
\wp_send_json( compact( 'message', 'data' ), \is_wp_error( $data ) ? 400 : 200 );
Expand Down Expand Up @@ -407,7 +407,7 @@ function process_form() {
// The honeypot field is called `email` to hopefully capture bots that might be looking for such a field.
$email = isset( $_REQUEST['npe'] ) ? \sanitize_email( $_REQUEST['npe'] ) : '';
if ( empty( $email ) ) {
return send_form_response( new \WP_Error( 'invalid_email', __( 'You must enter a valid email address.', 'newspack' ) ) );
return send_form_response( new \WP_Error( 'invalid_email', __( 'You must enter a valid email address.', 'newspack-plugin' ) ) );
}

$metadata = [];
Expand Down
154 changes: 77 additions & 77 deletions includes/reader-activation/class-reader-activation.php

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions includes/reader-revenue/my-account/class-woocommerce-my-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ public static function my_account_menu_items( $items ) {
// Add a nav item for Stripe's billing portal.
$stripe_customer_id = self::get_current_user_stripe_id();
if ( false !== $stripe_customer_id ) {
$custom_endpoints = [ self::BILLING_ENDPOINT => __( 'Billing', 'newspack' ) ];
$custom_endpoints = [ self::BILLING_ENDPOINT => __( 'Billing', 'newspack-plugin' ) ];
$items = array_slice( $items, 0, 1, true ) + $custom_endpoints + array_slice( $items, 1, null, true );
}

$default_disabled_items = [];

// Rename 'Logout' action to 'Log out', for grammatical reasons.
if ( isset( $items['customer-logout'] ) ) {
$items['customer-logout'] = __( 'Log out', 'newspack' );
$items['customer-logout'] = __( 'Log out', 'newspack-plugin' );
}

if ( Reader_Activation::is_enabled() ) {
Expand Down Expand Up @@ -167,14 +167,14 @@ public static function handle_password_reset_request() {
$is_error = false;
if ( \wp_verify_nonce( $nonce, self::RESET_PASSWORD_URL_PARAM ) ) {
$result = \retrieve_password( \wp_get_current_user()->user_email );
$message = __( 'Please check your email inbox for instructions on how to set a new password.', 'newspack' );
$message = __( 'Please check your email inbox for instructions on how to set a new password.', 'newspack-plugin' );
if ( \is_wp_error( $result ) ) {
Logger::error( 'Error resetting password: ' . $result->get_error_message() );
$message = $result->get_error_message();
$is_error = true;
}
} else {
$message = __( 'Something went wrong.', 'newspack' );
$message = __( 'Something went wrong.', 'newspack-plugin' );
$is_error = true;
}

Expand Down Expand Up @@ -235,7 +235,7 @@ public static function handle_delete_account_request() {
\wp_safe_redirect(
\add_query_arg(
[
'message' => $sent ? __( 'Please check your email inbox for instructions on how to delete your account.', 'newspack' ) : __( 'Something went wrong.', 'newspack' ),
'message' => $sent ? __( 'Please check your email inbox for instructions on how to delete your account.', 'newspack-plugin' ) : __( 'Something went wrong.', 'newspack-plugin' ),
'is_error' => ! $sent,
],
\remove_query_arg( self::DELETE_ACCOUNT_URL_PARAM )
Expand All @@ -258,7 +258,7 @@ public static function handle_delete_account() {

$form_nonce = \sanitize_text_field( $_POST[ self::DELETE_ACCOUNT_FORM ] );
if ( ! $form_nonce || ! \wp_verify_nonce( $form_nonce, self::DELETE_ACCOUNT_FORM ) ) {
\wp_die( \esc_html__( 'Invalid request.', 'newspack' ) );
\wp_die( \esc_html__( 'Invalid request.', 'newspack-plugin' ) );
}

if ( ! isset( $_POST['confirm_delete'] ) ) {
Expand All @@ -278,7 +278,7 @@ public static function handle_delete_account() {
$token = isset( $_POST['token'] ) ? \sanitize_text_field( $_POST['token'] ) : '';
$transient_token = \get_transient( 'np_reader_account_delete_' . $user_id );
if ( ! $token || ! $transient_token || $token !== $transient_token ) {
\wp_die( \esc_html__( 'Invalid request.', 'newspack' ) );
\wp_die( \esc_html__( 'Invalid request.', 'newspack-plugin' ) );
}
\delete_transient( 'np_reader_account_delete_' . $user_id );

Expand All @@ -300,14 +300,14 @@ public static function handle_magic_link_request() {
$is_error = false;
if ( \wp_verify_nonce( $nonce, self::SEND_MAGIC_LINK_PARAM ) ) {
$result = Reader_Activation::send_verification_email( \wp_get_current_user() );
$message = __( 'Please check your email inbox for a link to verify your account.', 'newspack' );
$message = __( 'Please check your email inbox for a link to verify your account.', 'newspack-plugin' );
if ( \is_wp_error( $result ) ) {
Logger::error( 'Error sending verification email: ' . $result->get_error_message() );
$message = $result->get_error_message();
$is_error = true;
}
} else {
$message = __( 'Something went wrong.', 'newspack' );
$message = __( 'Something went wrong.', 'newspack-plugin' );
$is_error = true;
}
wp_safe_redirect(
Expand Down Expand Up @@ -431,8 +431,8 @@ public static function add_rewrite_endpoints() {
public static function remove_required_fields( $required_fields ) {
if ( Donations::is_platform_wc() ) {
return [
'account_display_name' => __( 'Display name', 'newspack' ),
'account_email' => __( 'Email address', 'newspack' ),
'account_display_name' => __( 'Display name', 'newspack-plugin' ),
'account_email' => __( 'Email address', 'newspack-plugin' ),
];
}
return [];
Expand Down Expand Up @@ -518,7 +518,7 @@ public static function add_param_after_logout( $redirect_to ) {
*/
public static function show_message_after_logout() {
if ( isset( $_GET['logged_out'] ) && function_exists( 'wc_add_notice' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
\wc_add_notice( __( 'You have successfully logged out.', 'newspack' ), 'success' );
\wc_add_notice( __( 'You have successfully logged out.', 'newspack-plugin' ), 'success' );
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions includes/reader-revenue/templates/myaccount-edit-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
<?php \do_action( 'newspack_woocommerce_edit_account_form_start' ); ?>

<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide mt0">
<label for="account_display_name"><?php \esc_html_e( 'Display name', 'newspack' ); ?>&nbsp;<span class="required">*</span></label>
<label for="account_display_name"><?php \esc_html_e( 'Display name', 'newspack-plugin' ); ?>&nbsp;<span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="account_display_name" id="account_display_name" autocomplete="name" value="<?php echo \esc_attr( $user->display_name ); ?>" />
</p>

<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="account_email_display"><?php \esc_html_e( 'Email address', 'newspack' ); ?>&nbsp;<span class="required">*</span></label>
<label for="account_email_display"><?php \esc_html_e( 'Email address', 'newspack-plugin' ); ?>&nbsp;<span class="required">*</span></label>
<input type="email" disabled class="woocommerce-Input woocommerce-Input--email input-text" name="account_email_display" id="account_email_display" autocomplete="email" value="<?php echo \esc_attr( $user->user_email ); ?>" />
<input type="hidden" class="woocommerce-Input woocommerce-Input--email input-text" name="account_email" id="account_email" autocomplete="email" value="<?php echo \esc_attr( $user->user_email ); ?>" />
</p>
Expand All @@ -62,7 +62,7 @@

<p class="woocommerce-buttons-card">
<?php \wp_nonce_field( 'save_account_details', 'save-account-details-nonce' ); ?>
<button type="submit" class="woocommerce-Button button ma0" name="save_account_details" value="<?php \esc_attr_e( 'Save changes', 'newspack' ); ?>"><?php \esc_html_e( 'Save changes', 'newspack' ); ?></button>
<button type="submit" class="woocommerce-Button button ma0" name="save_account_details" value="<?php \esc_attr_e( 'Save changes', 'newspack-plugin' ); ?>"><?php \esc_html_e( 'Save changes', 'newspack-plugin' ); ?></button>
<input type="hidden" name="action" value="save_account_details" />
</p>

Expand All @@ -77,18 +77,18 @@
<h4 class="woocommerce-card__title">
<?php
if ( $without_password ) {
\esc_html_e( 'Create a Password', 'newspack' );
\esc_html_e( 'Create a Password', 'newspack-plugin' );
} else {
\esc_html_e( 'Reset Password', 'newspack' );
\esc_html_e( 'Reset Password', 'newspack-plugin' );
}
?>
</h4>
<span class="woocommerce-card__description">
<?php
if ( $without_password ) {
\esc_html_e( 'Email me a link to set my password', 'newspack' );
\esc_html_e( 'Email me a link to set my password', 'newspack-plugin' );
} else {
\esc_html_e( 'Email me a password reset link', 'newspack' );
\esc_html_e( 'Email me a password reset link', 'newspack-plugin' );
}
?>
</span>
Expand All @@ -104,15 +104,15 @@
<a href="<?php echo '?' . \esc_attr( $newspack_delete_account_arg ) . '=' . \esc_attr( \wp_create_nonce( $newspack_delete_account_arg ) ); ?>" class="is-destructive">
<span class="woocommerce-card__content">
<h4 class="woocommerce-card__title">
<?php \esc_html_e( 'Delete Account', 'newspack' ); ?>
<?php \esc_html_e( 'Delete Account', 'newspack-plugin' ); ?>
</h4>
<span class="woocommerce-card__description">
<?php \esc_html_e( 'Request account deletion', 'newspack' ); ?>
<?php \esc_html_e( 'Request account deletion', 'newspack-plugin' ); ?>
</span>
</span>
</a>
<p>
<?php \esc_html_e( 'Deleting your account will also cancel any newsletter subscriptions and recurring payments.', 'newspack' ); ?>
<?php \esc_html_e( 'Deleting your account will also cancel any newsletter subscriptions and recurring payments.', 'newspack-plugin' ); ?>
</p>
</div>

Expand Down
6 changes: 3 additions & 3 deletions includes/reader-revenue/templates/myaccount-verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@

<div class="newspack-verify-account-message">
<p>
<?php esc_html_e( 'You must verify your account before you can manage account settings. Verify with a link or by setting a password.', 'newspack' ); ?>
<?php esc_html_e( 'You must verify your account before you can manage account settings. Verify with a link or by setting a password.', 'newspack-plugin' ); ?>
</p>
<p>
<a class="woocommerce-Button button" href="<?php echo esc_url( $magic_link_url ); ?>">
<?php esc_html_e( 'Send me a link', 'newspack' ); ?>
<?php esc_html_e( 'Send me a link', 'newspack-plugin' ); ?>
</a>
<a class="woocommerce-Button button" href="<?php echo esc_url( $reset_password_url ); ?>">
<?php esc_html_e( 'Set a new password', 'newspack' ); ?>
<?php esc_html_e( 'Set a new password', 'newspack-plugin' ); ?>
</a>
</p>
</div>
Expand Down
Loading

0 comments on commit 3b5b713

Please sign in to comment.