From eacffb823a1b70cb936bece93c607b1e3d19777d Mon Sep 17 00:00:00 2001 From: Konstantin Kovshenin Date: Wed, 26 Apr 2017 18:36:20 +0300 Subject: [PATCH] Helper: Add l10n functions to all strings --- includes/admin/helper/class-wc-helper.php | 35 ++++++--- includes/admin/helper/views/html-main.php | 76 ++++++++++--------- .../admin/helper/views/html-oauth-start.php | 4 +- .../helper/views/html-section-account.php | 9 ++- 4 files changed, 73 insertions(+), 51 deletions(-) diff --git a/includes/admin/helper/class-wc-helper.php b/includes/admin/helper/class-wc-helper.php index 0e765c675c4..aa19dc2b2e8 100644 --- a/includes/admin/helper/class-wc-helper.php +++ b/includes/admin/helper/class-wc-helper.php @@ -165,23 +165,30 @@ class WC_Helper { case 'activate-success': $subscription = self::_get_subscription_from_product_id( absint( $_GET['wc-helper-product-id'] ) ); $notices[] = array( - 'message' => sprintf( '%s activated successfully. You will now receive updates for this product.', esc_html( $subscription['product_name'] ) ), 'type' => 'updated', + /* translators: %s: product name */ + 'message' => sprintf( __( '%s activated successfully. You will now receive updates for this product.', 'woocommerce' ), + '' . esc_html( $subscription['product_name'] ) . '' ), ); break; case 'activate-error': $subscription = self::_get_subscription_from_product_id( absint( $_GET['wc-helper-product-id'] ) ); $notices[] = array( - 'message' => sprintf( 'An error has occurred when activating %s. Please try again later.', esc_html( $subscription['product_name'] ) ), 'type' => 'error', + /* translators: %s: product name */ + 'message' => sprintf( __( 'An error has occurred when activating %s. Please try again later.', 'woocommerce' ), + '' . esc_html( $subscription['product_name'] ) . '' ), ); break; case 'deactivate-success': $subscription = self::_get_subscription_from_product_id( absint( $_GET['wc-helper-product-id'] ) ); $local = self::_get_local_from_product_id( absint( $_GET['wc-helper-product-id'] ) ); - $message = sprintf( 'Subscription for %s deactivated successfully. You will no longer receive updates for this product.', esc_html( $subscription['product_name'] ) ); + + /* translators: %s: product name */ + $message = sprintf( __( 'Subscription for %s deactivated successfully. You will no longer receive updates for this product.', 'woocommerce' ), + '' . esc_html( $subscription['product_name'] ) . '' ); if ( $local && is_plugin_active( $local['_filename'] ) && current_user_can( 'activate_plugins' ) ) { $deactivate_plugin_url = add_query_arg( array( @@ -191,7 +198,9 @@ class WC_Helper { 'wc-helper-nonce' => wp_create_nonce( 'deactivate-plugin:' . $subscription['product_id'] ), ), admin_url( 'admin.php' ) ); - $message = sprintf( 'Subscription for %1$s deactivated successfully. You will no longer receive updates for this product. Click here if you wish to deactive the plugin as well.', esc_html( $subscription['product_name'] ), esc_url( $deactivate_plugin_url ) ); + /* translators: %1$s: product name, %2$s: deactivate url */ + $message = sprintf( __( 'Subscription for %1$s deactivated successfully. You will no longer receive updates for this product. Click here if you wish to deactive the plugin as well.', 'woocommerce' ), + '' . esc_html( $subscription['product_name'] ) . '', esc_url( $deactivate_plugin_url ) ); } $notices[] = array( @@ -203,44 +212,50 @@ class WC_Helper { case 'deactivate-error': $subscription = self::_get_subscription_from_product_id( absint( $_GET['wc-helper-product-id'] ) ); $notices[] = array( - 'message' => sprintf( 'An error has occurred when deactivating the subscription for %s. Please try again later.', esc_html( $subscription['product_name'] ) ), 'type' => 'error', + /* translators: %s: product name */ + 'message' => sprintf( __( 'An error has occurred when deactivating the subscription for %s. Please try again later.', 'woocommerce' ), + '' . esc_html( $subscription['product_name'] ) . '' ), ); break; case 'deactivate-plugin-success': $subscription = self::_get_subscription_from_product_id( absint( $_GET['wc-helper-product-id'] ) ); $notices[] = array( - 'message' => sprintf( 'The extension %s has been deactivated successfully.', esc_html( $subscription['product_name'] ) ), 'type' => 'updated', + /* translators: %s: product name */ + 'message' => sprintf( __( 'The extension %s has been deactivated successfully.', 'woocommerce' ), + '' . esc_html( $subscription['product_name'] ) . '' ), ); break; case 'deactivate-plugin-error': $subscription = self::_get_subscription_from_product_id( absint( $_GET['wc-helper-product-id'] ) ); $notices[] = array( - 'message' => sprintf( 'An error has occurred when deactivating the extension %1$s. Please proceed to the Plugins screen to deactivate it manually.', esc_html( $subscription['product_name'] ), admin_url( 'plugins.php' ) ), 'type' => 'error', + /* translators: %1$s: product name, %2$s: plugins screen url */ + 'message' => sprintf( __( 'An error has occurred when deactivating the extension %1$s. Please proceed to the Plugins screen to deactivate it manually.', 'woocommerce' ), + '' . esc_html( $subscription['product_name'] ) . '', admin_url( 'plugins.php' ) ), ); break; case 'helper-connected': $notices[] = array( - 'message' => 'You have successfully connected your store to WooCommerce.com', + 'message' => __( 'You have successfully connected your store to WooCommerce.com', 'woocommerce' ), 'type' => 'updated', ); break; case 'helper-disconnected': $notices[] = array( - 'message' => 'You have successfully disconnected your store from WooCommerce.com', + 'message' => __( 'You have successfully disconnected your store from WooCommerce.com', 'woocommerce' ), 'type' => 'updated', ); break; case 'helper-refreshed': $notices[] = array( - 'message' => 'Authentication and subscription caches refreshed successfully.', + 'message' => __( 'Authentication and subscription caches refreshed successfully.', 'woocommerce' ), 'type' => 'updated', ); break; diff --git a/includes/admin/helper/views/html-main.php b/includes/admin/helper/views/html-main.php index 5d992e98a16..a0edb952aae 100644 --- a/includes/admin/helper/views/html-main.php +++ b/includes/admin/helper/views/html-main.php @@ -6,16 +6,16 @@ -

Subscriptions

-

Below is a list of products available on your WooCommerce.com account. To receive plugin updates please make sure the product is installed, activated and connected to your WooCommerce.com account.

+

+

- - - - + + + + @@ -55,35 +55,39 @@
- Update to + + - available + + [?] - available + + [?] - available + + @@ -91,34 +95,35 @@ 0 ) { - printf( '(%d of %d used)', $subscription['sites_active'], $subscription['sites_max'] ); + /* translators: %1$d: sites active, %2$d max sites active */ + printf( __( '(%1$d of %2$d used)', 'woocommerce' ), $subscription['sites_active'], $subscription['sites_max'] ); } ?>
- Not installed
+
- Installed on this site
+
@@ -126,20 +131,20 @@ - +
ProductSubscriptionSite usageAction
- Expired :(
+
- Auto renews on:
+
- Expiring soon!
+
- Expires on:
+
- Update + - Renew + - Deactivate + - Renew + - Activate + - Download + - Renew +
Could not find any subscriptions on your WooCommerce.com account
-

Installed Extensions Without a Subscription

+

- - + + - + @@ -163,23 +168,24 @@ ?> - + diff --git a/includes/admin/helper/views/html-oauth-start.php b/includes/admin/helper/views/html-oauth-start.php index 97c9fd36de0..63778a942af 100644 --- a/includes/admin/helper/views/html-oauth-start.php +++ b/includes/admin/helper/views/html-oauth-start.php @@ -9,12 +9,12 @@ WooCommerce -

Sorry to see you go. Feel free to reconnect again using the button below.

+

Sorry to see you go. Feel free to reconnect again using the button below.', 'woocommerce' ); ?>

-

Connect your store

+

diff --git a/includes/admin/helper/views/html-section-account.php b/includes/admin/helper/views/html-section-account.php index d3b0efc28f1..879cf0099ee 100644 --- a/includes/admin/helper/views/html-section-account.php +++ b/includes/admin/helper/views/html-section-account.php @@ -1,15 +1,16 @@ -

Your Account

+

- %s', esc_html( $auth_user_data['email'] ) ); ?> + + %s', 'woocommerce' ), esc_html( $auth_user_data['email'] ) ); ?> - Refresh - Disconnect + +

ProductSubscription Action
-
- installed + + %1$s installed', 'woocommerce' ), esc_html( $data['Name'] ), esc_html( $data['Version'] ) ); ?> - (latest) +
- available + + [?]
No/Invalid subscription - Purchase Subscription +