Skip to content

Commit 01a3375

Browse files
committed
Reinstate translation functions
1 parent 9ea4c9b commit 01a3375

1 file changed

Lines changed: 35 additions & 19 deletions

File tree

src/class-convertkit-api-v4.php

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -155,27 +155,43 @@ public function __construct( $client_id, $redirect_uri, $access_token = false, $
155155
$this->log = new ConvertKit_Log( $this->plugin_path );
156156
}
157157

158-
// Define error messages.
158+
// Define translatable / localized error strings.
159+
// WordPress requires that the text domain be a string (e.g. 'woocommerce-convertkit') and not a variable,
160+
// otherwise localization won't work.
161+
// phpcs:disable
159162
$this->error_messages = array(
160-
'get_all_posts_posts_per_request_bound_too_low' => 'get_all_posts(): the posts_per_request parameter must be equal to or greater than 1.',
161-
'get_all_posts_posts_per_request_bound_too_high' => 'get_all_posts(): the posts_per_request parameter must be equal to or less than 50.',
162-
'get_posts_page_parameter_bound_too_low' => 'get_posts(): the page parameter must be equal to or greater than 1.',
163-
'get_posts_per_page_parameter_bound_too_low' => 'get_posts(): the per_page parameter must be equal to or greater than 1.',
164-
'get_posts_per_page_parameter_bound_too_high' => 'get_posts(): the per_page parameter must be equal to or less than 50.',
165-
'subscriber_authentication_send_code_email_empty' => 'subscriber_authentication_send_code(): the email parameter is empty.',
166-
'subscriber_authentication_send_code_redirect_url_empty' => 'subscriber_authentication_send_code(): the redirect_url parameter is empty.',
167-
'subscriber_authentication_send_code_redirect_url_invalid' => 'subscriber_authentication_send_code(): the redirect_url parameter is not a valid URL.',
168-
'subscriber_authentication_send_code_response_token_missing' => 'subscriber_authentication_send_code(): the token parameter is missing from the API response.',
169-
'subscriber_authentication_verify_token_empty' => 'subscriber_authentication_verify(): the token parameter is empty.',
170-
'subscriber_authentication_verify_subscriber_code_empty' => 'subscriber_authentication_verify(): the subscriber_code parameter is empty.',
171-
'subscriber_authentication_verify_response_error' => 'The entered code is invalid. Please try again, or click the link sent in the email.',
172-
'profiles_signed_subscriber_id_empty' => 'profiles(): the signed_subscriber_id parameter is empty.',
173-
'request_method_unsupported' => 'API request method %s is not supported in ConvertKit_API class.',
174-
'request_rate_limit_exceeded' => 'ConvertKit API Error: Rate limit hit.',
175-
'request_internal_server_error' => 'ConvertKit API Error: Internal server error.',
176-
'request_bad_gateway' => 'ConvertKit API Error: Bad gateway.',
177-
'response_type_unexpected' => 'ConvertKit API Error: The response is not of the expected type array.',
163+
// get_all_posts().
164+
'get_all_posts_posts_per_request_bound_too_low' => __( 'get_all_posts(): the posts_per_request parameter must be equal to or greater than 1.', 'convertkit' ),
165+
'get_all_posts_posts_per_request_bound_too_high' => __( 'get_all_posts(): the posts_per_request parameter must be equal to or less than 50.', 'convertkit' ),
166+
167+
// get_posts().
168+
'get_posts_page_parameter_bound_too_low' => __( 'get_posts(): the page parameter must be equal to or greater than 1.', 'convertkit' ),
169+
'get_posts_per_page_parameter_bound_too_low' => __( 'get_posts(): the per_page parameter must be equal to or greater than 1.', 'convertkit' ),
170+
'get_posts_per_page_parameter_bound_too_high' => __( 'get_posts(): the per_page parameter must be equal to or less than 50.', 'convertkit' ),
171+
172+
// subscriber_authentication_send_code().
173+
'subscriber_authentication_send_code_email_empty' => __( 'subscriber_authentication_send_code(): the email parameter is empty.', 'convertkit' ),
174+
'subscriber_authentication_send_code_redirect_url_empty' => __( 'subscriber_authentication_send_code(): the redirect_url parameter is empty.', 'convertkit' ),
175+
'subscriber_authentication_send_code_redirect_url_invalid' => __( 'subscriber_authentication_send_code(): the redirect_url parameter is not a valid URL.', 'convertkit' ),
176+
'subscriber_authentication_send_code_response_token_missing'=> __( 'subscriber_authentication_send_code(): the token parameter is missing from the API response.', 'convertkit' ),
177+
178+
// subscriber_authentication_verify().
179+
'subscriber_authentication_verify_token_empty' => __( 'subscriber_authentication_verify(): the token parameter is empty.', 'convertkit' ),
180+
'subscriber_authentication_verify_subscriber_code_empty' => __( 'subscriber_authentication_verify(): the subscriber_code parameter is empty.', 'convertkit' ),
181+
'subscriber_authentication_verify_response_error' => __( 'The entered code is invalid. Please try again, or click the link sent in the email.', 'convertkit' ),
182+
183+
// profile().
184+
'profiles_signed_subscriber_id_empty' => __( 'profiles(): the signed_subscriber_id parameter is empty.', 'convertkit' ),
185+
186+
// request().
187+
/* translators: HTTP method */
188+
'request_method_unsupported' => __( 'API request method %s is not supported in ConvertKit_API class.', 'convertkit' ),
189+
'request_rate_limit_exceeded' => __( 'ConvertKit API Error: Rate limit hit.', 'convertkit' ),
190+
'request_internal_server_error' => __( 'ConvertKit API Error: Internal server error.', 'convertkit' ),
191+
'request_bad_gateway' => __( 'ConvertKit API Error: Bad gateway.', 'convertkit' ),
192+
'response_type_unexpected' => __( 'ConvertKit API Error: The response is not of the expected type array.', 'convertkit' ),
178193
);
194+
// phpcs:enable
179195

180196
}
181197

0 commit comments

Comments
 (0)