Skip to content

Commit 74bbcc6

Browse files
authored
Merge pull request #169 from WebDevStudios/fix/CC-349-textdomain-loading
update and make use of .org matching textdomain
2 parents 920bcc3 + 0b2c8fa commit 74bbcc6

File tree

16 files changed

+127
-118
lines changed

16 files changed

+127
-118
lines changed

plugin.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
<?php
22
/**
33
* Constant Contact + WooCommerce
4-
*
54
* @since 2019-02-15
65
* @author Constant Contact <https://www.constantcontact.com/>
76
* @package cc-woo
8-
*
97
* @wordpress-plugin
108
* Plugin Name: Constant Contact + WooCommerce
119
* Description: Add products to your emails and sync your contacts.
1210
* Plugin URI: https://github.com/WebDevStudios/constant-contact-woocommerce
1311
* Version: 2.1.0
1412
* Author: Constant Contact
1513
* Author URI: https://www.constantcontact.com/
16-
* Text Domain: cc-woo
14+
* Text Domain: constant-contact-woocommerce
1715
* WC requires at least: 3.6.0
1816
* WC tested up to: 6.8.2
1917
* Requires PHP: 7.2
@@ -26,7 +24,7 @@
2624

2725
if ( ! is_readable( $cc_woo_autoloader ) ) {
2826
/* Translators: Placeholder is the current directory. */
29-
throw new \Exception( sprintf( __( 'Please run `composer install` in the plugin folder "%s" and try activating this plugin again.', 'cc-woo' ), dirname( __FILE__ ) ) );
27+
throw new \Exception( sprintf( __( 'Please run `composer install` in the plugin folder "%s" and try activating this plugin again.', 'constant-contact-woocommerce' ), dirname( __FILE__ ) ) );
3028
}
3129

3230
require_once $cc_woo_autoloader;

src/AbandonedCheckouts/CheckoutHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public function maybe_capture_guest_checkout() {
7676
] );
7777

7878
if ( empty( $data['nonce'] ) || ! wp_verify_nonce( $data['nonce'], 'woocommerce-process_checkout' ) ) {
79-
wp_send_json_error( esc_html__( 'Invalid nonce.', 'cc-woo' ) );
79+
wp_send_json_error( esc_html__( 'Invalid nonce.', 'constant-contact-woocommerce' ) );
8080
}
8181

8282
$email = filter_var( $data['email'], FILTER_VALIDATE_EMAIL );
8383

8484
if ( ! $email ) {
85-
wp_send_json_error( esc_html__( 'Invalid email.', 'cc-woo' ) );
85+
wp_send_json_error( esc_html__( 'Invalid email.', 'constant-contact-woocommerce' ) );
8686
}
8787

8888
WC()->session->set( 'billing_email', $email );

src/AbandonedCheckouts/CheckoutRecovery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected function recover_products( $products ) {
142142
'%d item from your previous order is currently unavailable and could not be added to your cart.',
143143
'%d items from your previous order are currently unavailable and could not be added to your cart.',
144144
( count( $products ) - count( $products_added ) ),
145-
'cc-woo'
145+
'constant-contact-woocommerce'
146146
),
147147
( count( $products ) - count( $products_added ) )
148148
),

src/Api/KeyManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private function is_woo_commerce_api_key_query( $query ) {
152152
public function disconnect_cc_woo() {
153153

154154
/* This action is documented in Plugin.php */
155-
do_action( 'cc_woo_disconnect', esc_html__( 'REST API Key Revoked.', 'cc-woo' ) );
155+
do_action( 'cc_woo_disconnect', esc_html__( 'REST API Key Revoked.', 'constant-contact-woocommerce' ) );
156156

157157
/* This action is documented in Plugin.php */
158158
do_action( 'wc_ctct_disconnect' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Intentional improperly-prefixed hookname, used in webhooks.

src/Plugin.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function add_ssl_notice() {
108108
$connected = get_option( 'cc_woo_import_connection_established' );
109109

110110
if ( ! $connected && ( isset( $_SERVER['HTTPS'] ) && 'on' !== $_SERVER['HTTPS'] ) ) {
111-
$message = __( 'Your site does not appear to be using a secure connection (SSL). You might face issues when connecting to your account. Please add HTTPS to your site to make sure you have no issues connecting.', 'cc-woo' );
111+
$message = __( 'Your site does not appear to be using a secure connection (SSL). You might face issues when connecting to your account. Please add HTTPS to your site to make sure you have no issues connecting.', 'constant-contact-woocommerce' );
112112
new Notice(
113113
new NoticeMessage( $message, 'error', true )
114114
);
@@ -138,7 +138,7 @@ private function deactivate( $reason ) {
138138
*
139139
* @param string $message Deactivation message.
140140
*/
141-
do_action( 'cc_woo_disconnect', esc_html__( 'Plugin deactivated.', 'cc-woo' ) );
141+
do_action( 'cc_woo_disconnect', esc_html__( 'Plugin deactivated.', 'constant-contact-woocommerce' ) );
142142

143143
$this->do_deactivation_process();
144144

@@ -167,13 +167,13 @@ public function check_for_required_dependencies() {
167167
// Ensure requirements.
168168
if ( ! $compatibility_checker->is_available() ) {
169169
// translators: placeholder is the minimum supported WooCommerce version.
170-
$message = sprintf( esc_html__( 'WooCommerce version "%1$s" or greater must be installed and activated to use %2$s.', 'cc-woo' ), PluginCompatibilityCheck::MINIMUM_WOO_VERSION, self::PLUGIN_NAME );
170+
$message = sprintf( esc_html__( 'WooCommerce version "%1$s" or greater must be installed and activated to use %2$s.', 'constant-contact-woocommerce' ), PluginCompatibilityCheck::MINIMUM_WOO_VERSION, self::PLUGIN_NAME );
171171
throw new Exception( $message );
172172
}
173173

174174
if ( ! $compatibility_checker->is_compatible( \WooCommerce::instance() ) ) {
175175
// translators: placeholder is the minimum supported WooCommerce version.
176-
$message = sprintf( esc_html__( 'WooCommerce version "%1$s" or greater is required to use %2$s.', 'cc-woo' ), PluginCompatibilityCheck::MINIMUM_WOO_VERSION, self::PLUGIN_NAME );
176+
$message = sprintf( esc_html__( 'WooCommerce version "%1$s" or greater is required to use %2$s.', 'constant-contact-woocommerce' ), PluginCompatibilityCheck::MINIMUM_WOO_VERSION, self::PLUGIN_NAME );
177177
throw new Exception( $message );
178178
}
179179
} catch ( Exception $e ) {
@@ -210,6 +210,7 @@ public function register_hooks() {
210210
add_action( 'plugins_loaded', [ $this, 'check_for_required_dependencies' ] );
211211
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ] );
212212
add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ], 99 );
213+
add_action( 'init', [ $this, 'load_plugin_textdomain' ] );
213214

214215
register_activation_hook( $this->plugin_file, [ $this, 'do_activation_process' ] );
215216
register_deactivation_hook( $this->plugin_file, [ $this, 'do_deactivation_process' ] );
@@ -327,7 +328,7 @@ public function do_deactivation_process() {
327328
delete_option( ConnectionStatus::CC_CONNECTION_USER_ID );
328329
delete_option( ConnectionStatus::CC_FIRST_CONNECTION );
329330
delete_option( ConnectionStatus::CC_CONNECTION_ESTABLISHED_KEY );
330-
331+
331332

332333
// WooCommerce Options
333334
delete_option( 'cc_woo_store_information_first_name' );
@@ -366,5 +367,15 @@ public function admin_enqueue_scripts() {
366367
wp_enqueue_style( 'cc-woo-admin', trailingslashit( plugin_dir_url( $this->get_plugin_file() ) ) . 'app/admin.css' );
367368
wp_enqueue_style( 'cc-woo-google-fonts', 'https://fonts.googleapis.com/css2?family=Maven+Pro:wght@400;700&display=swap', false );
368369
}
370+
371+
/**
372+
* Load textdomain.
373+
*
374+
* @author Michael Beckwith <[email protected]>
375+
* @since 2.1.0
376+
*/
377+
public function load_plugin_textdomain() {
378+
load_plugin_textdomain( 'constant-contact-woocommerce' );
379+
}
369380
}
370381

src/Rest/AbandonedCheckouts/Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function get_items_permissions_check( $request ) {
8989
);
9090
$ctct_logger->log();
9191

92-
return new WP_Error( 'cc-woo-rest-not-allowed', esc_html__( 'Sorry, you cannot list resources.', 'cc-woo' ), [ 'status' => rest_authorization_required_code() ] );
92+
return new WP_Error( 'cc-woo-rest-not-allowed', esc_html__( 'Sorry, you cannot list resources.', 'constant-contact-woocommerce' ), [ 'status' => rest_authorization_required_code() ] );
9393
}
9494

9595
return true;

0 commit comments

Comments
 (0)