Fix WordPress.WP.I18n.MissingTranslatorsComment errors
[MAILPOET-4524]
This commit is contained in:
@@ -85,6 +85,7 @@ class DynamicSegmentsResponseBuilder {
|
||||
$data['missing_plugin_message'] = $this->segmentDependencyValidator->getCustomErrorMessage($missingPlugin)
|
||||
?:
|
||||
sprintf(
|
||||
// translators: %s is the name of the missing plugin.
|
||||
__('Activate the %s plugin to see the number of subscribers and enable the editing of this segment.', 'mailpoet'),
|
||||
$missingPlugin
|
||||
);
|
||||
|
@@ -176,6 +176,7 @@ class DynamicSegments extends APIEndpoint {
|
||||
Error::BAD_REQUEST => str_replace(
|
||||
'%1$s',
|
||||
"'" . join("', '", $activelyUsedNewslettersSubjects[$segment->getId()] ) . "'",
|
||||
// translators: %1$s is a comma-seperated list of emails for which the segment is used.
|
||||
_x('Segment cannot be deleted because it’s used for %1$s email', 'Alert shown when trying to delete segment, which is assigned to any automatic emails.', 'mailpoet')
|
||||
),
|
||||
]);
|
||||
|
@@ -116,6 +116,7 @@ class Forms extends APIEndpoint {
|
||||
return $this->badRequest([
|
||||
APIError::BAD_REQUEST =>
|
||||
sprintf(
|
||||
// translators: %1$s is a comma-seperated list of allowed values, %2$s the status the user specified.
|
||||
__('Invalid status. Allowed values are (%1$s), you specified %2$s', 'mailpoet'),
|
||||
join(', ', [FormEntity::STATUS_ENABLED, FormEntity::STATUS_DISABLED]),
|
||||
$status
|
||||
|
@@ -67,6 +67,7 @@ class Mailer extends APIEndpoint {
|
||||
|
||||
if ($result['response'] === false) {
|
||||
$error = sprintf(
|
||||
// translators: %s is the error message.
|
||||
__('The email could not be sent: %s', 'mailpoet'),
|
||||
$result['error']->getMessage()
|
||||
);
|
||||
|
@@ -184,6 +184,7 @@ class Segments extends APIEndpoint {
|
||||
APIError::BAD_REQUEST => str_replace(
|
||||
'%1$s',
|
||||
"'" . join("', '", $activelyUsedNewslettersSubjects[$segment->getId()] ) . "'",
|
||||
// translators: %1$s is a comma-seperated list of emails for which the segment is used.
|
||||
_x('List cannot be deleted because it’s used for %1$s email', 'Alert shown when trying to delete segment, which is assigned to any automatic emails.', 'mailpoet')
|
||||
),
|
||||
]);
|
||||
@@ -195,6 +196,7 @@ class Segments extends APIEndpoint {
|
||||
APIError::BAD_REQUEST => str_replace(
|
||||
'%1$s',
|
||||
"'" . join("', '", $activelyUsedFormNames[$segment->getId()] ) . "'",
|
||||
// translators: %1$s is a comma-seperated list of forms for which the segment is used.
|
||||
_nx(
|
||||
'List cannot be deleted because it’s used for %1$s form',
|
||||
'List cannot be deleted because it’s used for %1$s forms',
|
||||
|
@@ -106,6 +106,7 @@ class Services extends APIEndpoint {
|
||||
$successMessage = __('Your MailPoet Sending Service key has been successfully validated', 'mailpoet');
|
||||
} elseif ($state == Bridge::KEY_EXPIRING) {
|
||||
$successMessage = sprintf(
|
||||
// translators: %s is the expiration date.
|
||||
__('Your MailPoet Sending Service key expires on %s!', 'mailpoet'),
|
||||
$this->dateTime->formatDate(strtotime($result['data']['expire_at']))
|
||||
);
|
||||
@@ -128,6 +129,7 @@ class Services extends APIEndpoint {
|
||||
break;
|
||||
default:
|
||||
$code = !empty($result['code']) ? $result['code'] : Bridge::CHECK_ERROR_UNKNOWN;
|
||||
// translators: %s is the error message.
|
||||
$errorMessage = __('Error validating MailPoet Sending Service key, please try again later (%s).', 'mailpoet');
|
||||
// If site runs on localhost
|
||||
if (1 === preg_match("/^(http|https)\:\/\/(localhost|127\.0\.0\.1)/", $this->wp->siteUrl())) {
|
||||
@@ -168,6 +170,7 @@ class Services extends APIEndpoint {
|
||||
$successMessage = __('Your Premium key has been successfully validated', 'mailpoet');
|
||||
} elseif ($state == Bridge::KEY_EXPIRING) {
|
||||
$successMessage = sprintf(
|
||||
// translators: %s is the expiration date.
|
||||
__('Your Premium key expires on %s', 'mailpoet'),
|
||||
$this->dateTime->formatDate(strtotime($result['data']['expire_at']))
|
||||
);
|
||||
@@ -194,6 +197,7 @@ class Services extends APIEndpoint {
|
||||
default:
|
||||
$code = !empty($result['code']) ? $result['code'] : Bridge::CHECK_ERROR_UNKNOWN;
|
||||
$error = sprintf(
|
||||
// translators: %s is the error message.
|
||||
__('Error validating Premium key, please try again later (%s)', 'mailpoet'),
|
||||
$this->getErrorDescriptionByCode($code)
|
||||
);
|
||||
@@ -238,6 +242,7 @@ class Services extends APIEndpoint {
|
||||
return $this->createBadRequest(__('Sender email address is not set.', 'mailpoet'));
|
||||
}
|
||||
if (!in_array($fromEmail, $authorizedEmails, true)) {
|
||||
// translators: %s is the email address, which is not authorized.
|
||||
return $this->createBadRequest(sprintf(__("Sender email address '%s' is not authorized.", 'mailpoet'), $fromEmail));
|
||||
}
|
||||
|
||||
@@ -263,6 +268,7 @@ class Services extends APIEndpoint {
|
||||
$text = __('Contact your hosting support to check the connection between your host and https://bridge.mailpoet.com', 'mailpoet');
|
||||
break;
|
||||
default:
|
||||
// translators: %s is the code.
|
||||
$text = sprintf(_x('code: %s', 'Error code (inside parentheses)', 'mailpoet'), $code);
|
||||
break;
|
||||
}
|
||||
|
@@ -98,9 +98,11 @@ class API {
|
||||
$foundSegmentsIds = [];
|
||||
foreach ($foundSegments as $segment) {
|
||||
if ($segment->type === Segment::TYPE_WP_USERS) {
|
||||
// translators: %d is the ID of the segment
|
||||
throw new APIException(__(sprintf("Can't unsubscribe from a WordPress Users list with ID %d.", $segment->id), 'mailpoet'), APIException::SUBSCRIBING_TO_WP_LIST_NOT_ALLOWED);
|
||||
}
|
||||
if ($segment->type === Segment::TYPE_WC_USERS) {
|
||||
// translators: %d is the ID of the segment
|
||||
throw new APIException(__(sprintf("Can't unsubscribe from a WooCommerce Customers list with ID %d.", $segment->id), 'mailpoet'), APIException::SUBSCRIBING_TO_WC_LIST_NOT_ALLOWED);
|
||||
}
|
||||
$foundSegmentsIds[] = $segment->id;
|
||||
@@ -110,6 +112,7 @@ class API {
|
||||
if (count($foundSegmentsIds) !== count($listIds)) {
|
||||
$missingIds = array_values(array_diff($listIds, $foundSegmentsIds));
|
||||
$exception = sprintf(
|
||||
// translators: %s is a comma-separated list of list IDs.
|
||||
_n('List with ID %s does not exist.', 'Lists with IDs %s do not exist.', count($missingIds), 'mailpoet'),
|
||||
implode(', ', $missingIds)
|
||||
);
|
||||
@@ -167,6 +170,7 @@ class API {
|
||||
$newSubscriber->save();
|
||||
if ($newSubscriber->getErrors() !== false) {
|
||||
throw new APIException(
|
||||
// translators: %s is a comma-seperated list of errors.
|
||||
__(sprintf('Failed to add subscriber: %s', strtolower(implode(', ', $newSubscriber->getErrors()))), 'mailpoet'),
|
||||
APIException::FAILED_TO_SAVE_SUBSCRIBER
|
||||
);
|
||||
|
@@ -45,7 +45,8 @@ class Segments {
|
||||
$segment = $this->segmentsRepository->createOrUpdate($data['name'], $data['description'] ?? '');
|
||||
} catch (\Exception $e) {
|
||||
throw new APIException(
|
||||
sprintf(__('Failed to add subscriber: %s', 'mailpoet'), $e->getMessage()),
|
||||
// translators: %s is the error message
|
||||
sprintf(__('Failed to add subscriber: %s', 'mailpoet'), $e->getMessage()),
|
||||
APIException::FAILED_TO_SAVE_LIST
|
||||
);
|
||||
}
|
||||
|
@@ -115,12 +115,15 @@ class Subscribers {
|
||||
$foundSegmentsIds = [];
|
||||
foreach ($foundSegments as $foundSegment) {
|
||||
if ($foundSegment->getType() === SegmentEntity::TYPE_WP_USERS) {
|
||||
// translators: %d is the ID of the segment
|
||||
throw new APIException(__(sprintf("Can't subscribe to a WordPress Users list with ID %d.", $foundSegment->getId()), 'mailpoet'), APIException::SUBSCRIBING_TO_WP_LIST_NOT_ALLOWED);
|
||||
}
|
||||
if ($foundSegment->getType() === SegmentEntity::TYPE_WC_USERS) {
|
||||
// translators: %d is the ID of the segment
|
||||
throw new APIException(__(sprintf("Can't subscribe to a WooCommerce Customers list with ID %d.", $foundSegment->getId()), 'mailpoet'), APIException::SUBSCRIBING_TO_WC_LIST_NOT_ALLOWED);
|
||||
}
|
||||
if ($foundSegment->getType() !== SegmentEntity::TYPE_DEFAULT) {
|
||||
// translators: %d is the ID of the segment
|
||||
throw new APIException(__(sprintf("Can't subscribe to a list with ID %d.", $foundSegment->getId()), 'mailpoet'), APIException::SUBSCRIBING_TO_LIST_NOT_ALLOWED);
|
||||
}
|
||||
$foundSegmentsIds[] = $foundSegment->getId();
|
||||
@@ -130,6 +133,7 @@ class Subscribers {
|
||||
if (count($foundSegmentsIds) !== count($listIds)) {
|
||||
$missingIds = array_values(array_diff($listIds, $foundSegmentsIds));
|
||||
$exception = sprintf(
|
||||
// translators: %s is a comma-separated list of list IDs.
|
||||
_n('List with ID %s does not exist.', 'Lists with IDs %s do not exist.', count($missingIds), 'mailpoet'),
|
||||
implode(', ', $missingIds)
|
||||
);
|
||||
@@ -149,6 +153,7 @@ class Subscribers {
|
||||
$this->subscribersRepository->flush();
|
||||
} catch (\Exception $e) {
|
||||
throw new APIException(
|
||||
// translators: %s is the error message
|
||||
__(sprintf('Failed to save a status of a subscriber : %s', $e->getMessage()), 'mailpoet'),
|
||||
APIException::FAILED_TO_SAVE_SUBSCRIBER
|
||||
);
|
||||
@@ -195,6 +200,7 @@ class Subscribers {
|
||||
foreach ($result as $queue) {
|
||||
if ($queue instanceof Sending && $queue->getErrors()) {
|
||||
throw new APIException(
|
||||
// translators: %s is a comma-separated list of errors
|
||||
__(sprintf('Subscriber added, but welcome email failed to send: %s', strtolower(implode(', ', $queue->getErrors()))), 'mailpoet'),
|
||||
APIException::WELCOME_FAILED_TO_SEND
|
||||
);
|
||||
@@ -211,6 +217,7 @@ class Subscribers {
|
||||
$this->confirmationEmailMailer->sendConfirmationEmailOnce($subscriberEntity);
|
||||
} catch (\Exception $e) {
|
||||
throw new APIException(
|
||||
// translators: %s is the error message
|
||||
__(sprintf('Subscriber added to lists, but confirmation email failed to send: %s', strtolower($e->getMessage())), 'mailpoet'),
|
||||
APIException::CONFIRMATION_FAILED_TO_SEND
|
||||
);
|
||||
|
@@ -51,7 +51,9 @@ class PurchasedInCategory {
|
||||
'slug' => self::SLUG,
|
||||
'title' => _x('Purchased In This Category', 'This is the name of a type for automatic email for ecommerce. Those emails are sent automatically every time a customer buys for the first time a product in a given category', 'mailpoet'),
|
||||
'description' => __('Let MailPoet send an email to customers who purchase a product for the first time in a specific category.', 'mailpoet'),
|
||||
// translators: %s is the name of the category.
|
||||
'listingScheduleDisplayText' => __('Email sent when a customer buys a product in category: %s', 'mailpoet'),
|
||||
// translators: %s is the name of the category.
|
||||
'listingScheduleDisplayTextPlural' => __('Email sent when a customer buys a product in categories: %s', 'mailpoet'),
|
||||
'options' => [
|
||||
'multiple' => true,
|
||||
|
@@ -72,7 +72,9 @@ class PurchasedProduct {
|
||||
'slug' => self::SLUG,
|
||||
'title' => __('Purchased This Product', 'mailpoet'),
|
||||
'description' => __('Let MailPoet send an email to customers who purchase a specific product for the first time.', 'mailpoet'),
|
||||
// translators: %s is the name of the product.
|
||||
'listingScheduleDisplayText' => __('Email sent when a customer buys product: %s', 'mailpoet'),
|
||||
// translators: %s is the name of the products.
|
||||
'listingScheduleDisplayTextPlural' => __('Email sent when a customer buys products: %s', 'mailpoet'),
|
||||
'options' => [
|
||||
'multiple' => true,
|
||||
|
@@ -109,6 +109,7 @@ class WooCommerce {
|
||||
|
||||
private function displayEventWarning($event) {
|
||||
$notice = sprintf('%s %s',
|
||||
// translators: %s is the name of the event.
|
||||
sprintf(__('WooCommerce %s event is misconfigured.', 'mailpoet'), $event),
|
||||
__('Please contact our technical support for assistance.', 'mailpoet')
|
||||
);
|
||||
|
@@ -75,6 +75,7 @@ class UpdateWorkflowController {
|
||||
|
||||
private function checkWorkflowStatus(string $status): void {
|
||||
if (!in_array($status, [Workflow::STATUS_ACTIVE, Workflow::STATUS_INACTIVE, Workflow::STATUS_DRAFT], true)) {
|
||||
// translators: %s is the status.
|
||||
throw UnexpectedValueException::create()->withMessage(__(sprintf('Invalid status: %s', $status), 'mailpoet'));
|
||||
}
|
||||
}
|
||||
|
@@ -32,12 +32,14 @@ class Exceptions {
|
||||
public static function migrationFailed(string $error): InvalidStateException {
|
||||
return InvalidStateException::create()
|
||||
->withErrorCode(self::MIGRATION_FAILED)
|
||||
// translators: %s is the error message.
|
||||
->withMessage(__(sprintf('Migration failed: %s', $error), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function databaseError(string $error): InvalidStateException {
|
||||
return InvalidStateException::create()
|
||||
->withErrorCode(self::DATABASE_ERROR)
|
||||
// translators: %s is the error message.
|
||||
->withMessage(__(sprintf('Database error: %s', $error), 'mailpoet'));
|
||||
}
|
||||
|
||||
@@ -57,60 +59,70 @@ class Exceptions {
|
||||
public static function jsonNotObject(string $json): UnexpectedValueException {
|
||||
return UnexpectedValueException::create()
|
||||
->withErrorCode(self::JSON_NOT_OBJECT)
|
||||
// translators: %s is the mentioned JSON string.
|
||||
->withMessage(__(sprintf("JSON string '%s' doesn't encode an object.", $json), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function workflowNotFound(int $id): NotFoundException {
|
||||
return NotFoundException::create()
|
||||
->withErrorCode(self::WORKFLOW_NOT_FOUND)
|
||||
->withMessage(__(sprintf("Workflow with ID '%s' not found.", $id), 'mailpoet'));
|
||||
// translators: %d is the ID of the workflow.
|
||||
->withMessage(__(sprintf("Workflow with ID '%d' not found.", $id), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function workflowRunNotFound(int $id): NotFoundException {
|
||||
return NotFoundException::create()
|
||||
->withErrorCode(self::WORKFLOW_RUN_NOT_FOUND)
|
||||
->withMessage(__(sprintf("Workflow run with ID '%s' not found.", $id), 'mailpoet'));
|
||||
// translators: %d is the ID of the workflow run.
|
||||
->withMessage(__(sprintf("Workflow run with ID '%d' not found.", $id), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function workflowStepNotFound(string $id): NotFoundException {
|
||||
return NotFoundException::create()
|
||||
->withErrorCode(self::WORKFLOW_STEP_NOT_FOUND)
|
||||
// translators: %s is the ID of the workflow step.
|
||||
->withMessage(__(sprintf("Workflow step with ID '%s' not found.", $id), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function workflowTriggerNotFound(int $workflowId, string $key): NotFoundException {
|
||||
return NotFoundException::create()
|
||||
->withErrorCode(self::WORKFLOW_TRIGGER_NOT_FOUND)
|
||||
->withMessage(__(sprintf("Workflow trigger with key '%s' not found in workflow ID '%s'.", $key, $workflowId), 'mailpoet'));
|
||||
// translators: %1$s is the key, %2$d is the workflow ID.
|
||||
->withMessage(__(sprintf('Workflow trigger with key "%1$s" not found in workflow ID "%2$d".', $key, $workflowId), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function workflowRunNotRunning(int $id, string $status): InvalidStateException {
|
||||
return InvalidStateException::create()
|
||||
->withErrorCode(self::WORKFLOW_RUN_NOT_RUNNING)
|
||||
->withMessage(__(sprintf("Workflow run with ID '%s' is not running. Status: %s", $id, $status), 'mailpoet'));
|
||||
// translators: %1$d is the ID of the workflow run, %2$s it's current status.
|
||||
->withMessage(__(sprintf('Workflow run with ID "%1$d" is not running. Status: %2$s', $id, $status), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function subjectNotFound(string $key): NotFoundException {
|
||||
return NotFoundException::create()
|
||||
->withErrorCode(self::SUBJECT_NOT_FOUND)
|
||||
// translators: %s is the key of the subject not found.
|
||||
->withMessage(__(sprintf("Subject with key '%s' not found.", $key), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function subjectClassNotFound(string $key): NotFoundException {
|
||||
return NotFoundException::create()
|
||||
->withErrorCode(self::SUBJECT_NOT_FOUND)
|
||||
// translators: %s is the key of the subject class not found.
|
||||
->withMessage(__(sprintf("Subject of class '%s' not found.", $key), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function subjectLoadFailed(string $key, array $args): InvalidStateException {
|
||||
return InvalidStateException::create()
|
||||
->withErrorCode(self::SUBJECT_LOAD_FAILED)
|
||||
->withMessage(__(sprintf("Subject with key '%s' and args '%s' failed to load.", $key, Json::encode($args)), 'mailpoet'));
|
||||
// translators: %1$s is the name of the key, %2$s the arguments.
|
||||
->withMessage(__(sprintf('Subject with key "%1$s" and args "%2$s" failed to load.', $key, Json::encode($args)), 'mailpoet'));
|
||||
}
|
||||
|
||||
public static function multipleSubjectsFound(string $key): InvalidStateException {
|
||||
return InvalidStateException::create()
|
||||
->withErrorCode(self::MULTIPLE_SUBJECTS_FOUND)
|
||||
// translators: %s is the name of the key.
|
||||
->withMessage(__(sprintf("Multiple subjects with key '%s' found, only one expected.", $key), 'mailpoet'));
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,8 @@ class SegmentSubject implements Subject {
|
||||
$id = $args['segment_id'];
|
||||
$this->segment = $this->segmentsRepository->findOneById($args['segment_id']);
|
||||
if (!$this->segment) {
|
||||
throw NotFoundException::create()->withMessage(__(sprintf("Segment with ID '%s' not found.", $id), 'mailpoet'));
|
||||
// translators: %d is the ID.
|
||||
throw NotFoundException::create()->withMessage(__(sprintf("Segment with ID '%d' not found.", $id), 'mailpoet'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -75,7 +75,8 @@ class SubscriberSubject implements Subject {
|
||||
$id = $args['subscriber_id'];
|
||||
$this->subscriber = $this->subscribersRepository->findOneById($id);
|
||||
if (!$this->subscriber) {
|
||||
throw NotFoundException::create()->withMessage(__(sprintf("Subscriber with ID '%s' not found.", $id), 'mailpoet'));
|
||||
// translators: %d is the ID.
|
||||
throw NotFoundException::create()->withMessage(__(sprintf("Subscriber with ID '%d' not found.", $id), 'mailpoet'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -307,16 +307,19 @@ class MP2Migrator {
|
||||
// User Lists
|
||||
$usersListsCount = ORM::for_table($this->mp2ListTable)->count();
|
||||
$totalCount += $usersListsCount;
|
||||
// translators: %d is the number of lists.
|
||||
$result .= sprintf(_n('%d subscribers list', '%d subscribers lists', $usersListsCount, 'mailpoet'), $usersListsCount) . "\n";
|
||||
|
||||
// Users
|
||||
$usersCount = ORM::for_table($this->mp2UserTable)->count();
|
||||
$totalCount += $usersCount;
|
||||
// translators: %d is the number of subscribers.
|
||||
$result .= sprintf(_n('%d subscriber', '%d subscribers', $usersCount, 'mailpoet'), $usersCount) . "\n";
|
||||
|
||||
// Forms
|
||||
$formsCount = ORM::for_table($this->mp2FormTable)->count();
|
||||
$totalCount += $formsCount;
|
||||
// translators: %d is the number of forms.
|
||||
$result .= sprintf(_n('%d form', '%d forms', $formsCount, 'mailpoet'), $formsCount) . "\n";
|
||||
|
||||
$this->progressbar->setTotalCount($totalCount);
|
||||
@@ -355,6 +358,7 @@ class MP2Migrator {
|
||||
|
||||
$this->segmentsMapping = $this->getImportedMapping('segments');
|
||||
|
||||
// translators: %d is the number of segments imported.
|
||||
$this->log(sprintf(_n("%d segment imported", "%d segments imported", $importedSegmentsCount, 'mailpoet'), $importedSegmentsCount));
|
||||
}
|
||||
|
||||
@@ -433,6 +437,7 @@ class MP2Migrator {
|
||||
}
|
||||
}
|
||||
|
||||
// translators: %d is the number of custom fields imported.
|
||||
$this->log(sprintf(_n("%d custom field imported", "%d custom fields imported", $importedCustomFieldsCount, 'mailpoet'), $importedCustomFieldsCount));
|
||||
}
|
||||
|
||||
@@ -593,6 +598,7 @@ class MP2Migrator {
|
||||
$this->progressbar->incrementCurrentCount($usersCount);
|
||||
} while (($users != null) && ($usersCount > 0));
|
||||
|
||||
// translators: %d is the number of subscribers imported.
|
||||
$this->log(sprintf(_n("%d subscriber imported", "%d subscribers imported", $importedSubscribersCount, 'mailpoet'), $importedSubscribersCount));
|
||||
}
|
||||
|
||||
@@ -839,6 +845,7 @@ class MP2Migrator {
|
||||
$this->progressbar->incrementCurrentCount($formsCount);
|
||||
} while (($forms != null) && ($formsCount > 0));
|
||||
|
||||
// translators: %d is the number of forms imported.
|
||||
$this->log(sprintf(_n("%d form imported", "%d forms imported", $importedFormsCount, 'mailpoet'), $importedFormsCount));
|
||||
}
|
||||
|
||||
|
@@ -45,15 +45,19 @@ class PrivacyPolicy {
|
||||
__('MailPoet creates and stores two cookies if you are using WooCommerce and MailPoet together. Those cookies are:', 'mailpoet') .
|
||||
'</p>' .
|
||||
'<p>' .
|
||||
// translators: %s is the name of the cookie.
|
||||
sprintf(__('Cookie name: %s', 'mailpoet'), 'mailpoet_revenue_tracking' ) .
|
||||
'<br>' .
|
||||
// translators: %s is the number of days.
|
||||
sprintf(__('Cookie expiry: %s days.', 'mailpoet'), WPFunctions::get()->numberFormatI18n(14) ) .
|
||||
'<br>' .
|
||||
__('Cookie description: The purpose of this cookie is to track which newsletter sent from your website has acquired a click-through and a subsequent purchase in your WooCommerce store.', 'mailpoet') .
|
||||
'</p> ' .
|
||||
'<p>' .
|
||||
// translators: %s is the name of the cookie.
|
||||
sprintf(__('Cookie name: %s', 'mailpoet'), 'mailpoet_abandoned_cart_tracking' ) .
|
||||
'<br>' .
|
||||
// translators: %s is the number of days.
|
||||
sprintf(__('Cookie expiry: %s days.', 'mailpoet'), WPFunctions::get()->numberFormatI18n(3650) ) .
|
||||
'<br>' .
|
||||
__('Cookie description: The purpose of this cookie is to track a user that has abandoned their cart in your WooCommerce store to then be able to send them an abandoned cart newsletter from MailPoet.', 'mailpoet') .
|
||||
|
@@ -102,7 +102,8 @@ class Renderer {
|
||||
return $this->renderer->render($template, $context);
|
||||
} catch (\RuntimeException $e) {
|
||||
throw new \Exception(sprintf(
|
||||
__('Failed to render template "%s". Please ensure the template cache folder "%s" exists and has write permissions. Terminated with error: "%s"'),
|
||||
// translators: %1$s is the name of the render, %2$s the folder path, %3$s the error message.
|
||||
__('Failed to render template "%1$s". Please ensure the template cache folder "%2$s" exists and has write permissions. Terminated with error: "%3$s"'),
|
||||
$template,
|
||||
$this->cachePath,
|
||||
$e->getMessage()
|
||||
|
@@ -89,6 +89,7 @@ class RequirementsChecker {
|
||||
$dependencyPath = $this->getDependencyPath($dependency);
|
||||
if (!$dependencyPath) {
|
||||
$error = sprintf(
|
||||
// translators: %s is the dependency.
|
||||
__('A MailPoet dependency (%s) does not appear to be loaded correctly, thus MailPoet will not work correctly. Please reinstall the plugin.', 'mailpoet'),
|
||||
$dependency
|
||||
);
|
||||
@@ -100,7 +101,8 @@ class RequirementsChecker {
|
||||
$isLoadedByPlugin = preg_match($pattern, $dependencyPath);
|
||||
if (!$isLoadedByPlugin) {
|
||||
$error = sprintf(
|
||||
__('MailPoet has detected a dependency conflict (%s) with another plugin (%s), which may cause unexpected behavior. Please disable the offending plugin to fix this issue.', 'mailpoet'),
|
||||
// translators: %1$s is the dependency and %2$s the plugin.
|
||||
__('MailPoet has detected a dependency conflict (%1$s) with another plugin (%2$s), which may cause unexpected behavior. Please disable the offending plugin to fix this issue.', 'mailpoet'),
|
||||
$dependency,
|
||||
$dependencyPath
|
||||
);
|
||||
|
@@ -61,6 +61,7 @@ class ServicesChecker {
|
||||
$dateTime = new DateTime();
|
||||
$date = $dateTime->formatDate(strtotime($mssKey['data']['expire_at']));
|
||||
$error = Helpers::replaceLinkTags(
|
||||
// translators: %s is a date.
|
||||
__("Your newsletters are awesome! Don't forget to [link]upgrade your MailPoet email plan[/link] by %s to keep sending them to your subscribers.", 'mailpoet'),
|
||||
'https://account.mailpoet.com?s=' . $this->subscribersFeature->getSubscribersCount(),
|
||||
['target' => '_blank']
|
||||
@@ -116,6 +117,7 @@ class ServicesChecker {
|
||||
$dateTime = new DateTime();
|
||||
$date = $dateTime->formatDate(strtotime($premiumKey['data']['expire_at']));
|
||||
$error = Helpers::replaceLinkTags(
|
||||
// translators: %s is a date.
|
||||
__("Your License Key for MailPoet is expiring! Don't forget to [link]renew your license[/link] by %s to keep enjoying automatic updates and Premium support.", 'mailpoet'),
|
||||
'https://account.mailpoet.com',
|
||||
['target' => '_blank']
|
||||
|
@@ -129,6 +129,7 @@ class Worker {
|
||||
$context = $this->prepareContext($newsletter, $sendingQueue, $link);
|
||||
$subject = $sendingQueue->getNewsletterRenderedSubject();
|
||||
return [
|
||||
// translators: %s is the subject of the email.
|
||||
'subject' => sprintf(_x('Stats for email %s', 'title of an automatic email containing statistics (newsletter open rate, click rate, etc)', 'mailpoet'), $subject),
|
||||
'body' => [
|
||||
'html' => $this->renderer->render('emails/statsNotification.html', $context),
|
||||
@@ -149,6 +150,7 @@ class Worker {
|
||||
$hasValidApiKey = $this->subscribersFeature->hasValidApiKey();
|
||||
$context = [
|
||||
'subject' => $subject,
|
||||
// translators: %1$s is the percentage of clicks, %2$s the percentage of opens and %3$s the number of unsubscribes.
|
||||
'preheader' => sprintf(_x(
|
||||
'%1$s%% clicks, %2$s%% opens, %3$s%% unsubscribes in a nutshell.', 'newsletter open rate, click rate and unsubscribe rate', 'mailpoet'),
|
||||
number_format($clicked, 2),
|
||||
|
@@ -31,9 +31,11 @@ class ApiDataSanitizer {
|
||||
|
||||
private function checkMandatoryStringParameter(array $data, $parameterName) {
|
||||
if (empty($data[$parameterName])) {
|
||||
// translators: %s is the name of the missing argument.
|
||||
throw new InvalidArgumentException(sprintf(__('Mandatory argument "%s" is missing', 'mailpoet'), $parameterName), self::ERROR_MANDATORY_ARGUMENT_MISSING);
|
||||
}
|
||||
if (!is_string($data[$parameterName])) {
|
||||
// translators: %s is the name of the malformed argument.
|
||||
throw new InvalidArgumentException(sprintf(__('Mandatory argument "%s" has to be string', 'mailpoet'), $parameterName), self::ERROR_MANDATORY_ARGUMENT_WRONG_TYPE);
|
||||
}
|
||||
}
|
||||
@@ -85,6 +87,7 @@ class ApiDataSanitizer {
|
||||
return $this->getExtraParamsForDate($data['params']);
|
||||
}
|
||||
|
||||
// translators: %s is the name of the type.
|
||||
throw new InvalidArgumentException(sprintf(__('Invalid type "%s"', 'mailpoet'), $type), self::ERROR_INVALID_TYPE);
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@ class FormSaveController {
|
||||
|
||||
public function duplicate(FormEntity $formEntity): FormEntity {
|
||||
$duplicate = clone $formEntity;
|
||||
// translators: %s is name of the form which has been duplicated.
|
||||
$duplicate->setName(sprintf(__('Copy of %s', 'mailpoet'), $formEntity->getName()));
|
||||
|
||||
// reset timestamps
|
||||
|
@@ -28,6 +28,7 @@ class AmazonSESMapper {
|
||||
public function getErrorFromResponse($response, $subscriber) {
|
||||
$message = ($response) ?
|
||||
$response->Error->Message->__toString() : // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
// translators: %s is the name of the method.
|
||||
sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_AMAZONSES);
|
||||
|
||||
$level = MailerError::LEVEL_HARD;
|
||||
|
@@ -7,6 +7,7 @@ use MailPoet\Mailer\SubscriberError;
|
||||
|
||||
trait BlacklistErrorMapperTrait {
|
||||
public function getBlacklistError($subscriber) {
|
||||
// translators: %s is the name of the method.
|
||||
$message = sprintf(__('%s has returned an unknown error.', 'mailpoet'), self::METHOD);
|
||||
$subscriberErrors = [new SubscriberError($subscriber, null)];
|
||||
return new MailerError(MailerError::OPERATION_SEND, MailerError::LEVEL_SOFT, $message, null, $subscriberErrors);
|
||||
|
@@ -183,7 +183,8 @@ class MailPoetMapper {
|
||||
$emailVolumeLimit = $this->subscribersFeature->getEmailVolumeLimit();
|
||||
$date = Carbon::now()->startOfMonth()->addMonth();
|
||||
$message = sprintf(
|
||||
__('You have sent more emails this month than your MailPoet plan includes (%s), and sending has been temporarily paused. To continue sending with MailPoet Sending Service please [link]upgrade your plan[/link], or wait until sending is automatically resumed on <b>%s</b>.', 'mailpoet'),
|
||||
// translators: %1$s is email volume limit and %2$s the date when you can resume sending.
|
||||
__('You have sent more emails this month than your MailPoet plan includes (%1$s), and sending has been temporarily paused. To continue sending with MailPoet Sending Service please [link]upgrade your plan[/link], or wait until sending is automatically resumed on <b>%2$s</b>.', 'mailpoet'),
|
||||
$emailVolumeLimit,
|
||||
$this->wp->dateI18n(get_option('date_format'), $date->getTimestamp())
|
||||
);
|
||||
|
@@ -19,6 +19,7 @@ abstract class PHPMailerMapper {
|
||||
}
|
||||
|
||||
public function getErrorForSubscriber($subscriber) {
|
||||
// translators: %s is the name of the method.
|
||||
$message = sprintf(__('%s has returned an unknown error.', 'mailpoet'), $this->getMethodName());
|
||||
$subscriberErrors = [new SubscriberError($subscriber, null)];
|
||||
return new MailerError(MailerError::OPERATION_SEND, MailerError::LEVEL_HARD, $message, null, $subscriberErrors);
|
||||
|
@@ -15,6 +15,7 @@ class SendGridMapper {
|
||||
public function getErrorFromResponse($response, $subscriber) {
|
||||
$response = (!empty($response['errors'][0])) ?
|
||||
$response['errors'][0] :
|
||||
// translators: %s is the name of the method.
|
||||
sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_SENDGRID);
|
||||
|
||||
$level = MailerError::LEVEL_HARD;
|
||||
|
@@ -240,6 +240,7 @@ class Model extends \MailPoetVendor\Sudzy\ValidModel {
|
||||
$column = $matches[1];
|
||||
$this->setError(
|
||||
sprintf(
|
||||
// translators: %1$s is the name of the database column.
|
||||
__('Another record already exists. Please specify a different "%1$s".', 'mailpoet'),
|
||||
$column
|
||||
),
|
||||
|
@@ -168,6 +168,7 @@ class Subscriber extends Model {
|
||||
->whereNull('deleted_at')
|
||||
->count();
|
||||
$subscribersWithoutSegmentLabel = sprintf(
|
||||
// translators: %s is the number of subscribers without a segment.
|
||||
__('Subscribers without a list (%s)', 'mailpoet'),
|
||||
number_format($subscribersWithoutSegment)
|
||||
);
|
||||
|
@@ -171,6 +171,7 @@ class NewsletterSaveController {
|
||||
$duplicate->setUpdatedAt($createdAt);
|
||||
$duplicate->setDeletedAt(null);
|
||||
|
||||
// translators: %s is the subject of the mail which has been copied.
|
||||
$duplicate->setSubject(sprintf(__('Copy of %s', 'mailpoet'), $newsletter->getSubject()));
|
||||
// generate new unsubscribe token
|
||||
$duplicate->setUnsubscribeToken($this->security->generateUnsubscribeTokenByEntity($duplicate));
|
||||
|
@@ -78,6 +78,7 @@ class SendPreviewController {
|
||||
$result = $this->mailerFactory->getDefaultMailer()->send($renderedNewsletter, $emailAddress, $extraParams);
|
||||
if ($result['response'] === false) {
|
||||
$error = sprintf(
|
||||
// translators: %s contains the actual error message.
|
||||
__('The email could not be sent: %s', 'mailpoet'),
|
||||
$result['error']->getMessage()
|
||||
);
|
||||
|
@@ -31,6 +31,7 @@ class AutomationEmailScheduler {
|
||||
public function createSendingTask(NewsletterEntity $email, SubscriberEntity $subscriber): ScheduledTaskEntity {
|
||||
if ($email->getType() !== NewsletterEntity::TYPE_AUTOMATION) {
|
||||
throw InvalidStateException::create()->withMessage(
|
||||
// translators: %s is the type which was given.
|
||||
sprintf(__("Email with type 'automation' expected, '%s' given."), $email->getType())
|
||||
);
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ class SegmentSaveController {
|
||||
*/
|
||||
public function duplicate(SegmentEntity $segmentEntity): SegmentEntity {
|
||||
$duplicate = clone $segmentEntity;
|
||||
// translators: %s is the name of the segment
|
||||
$duplicate->setName(sprintf(__('Copy of %s', 'mailpoet'), $segmentEntity->getName()));
|
||||
|
||||
$this->segmentsRepository->verifyNameIsUnique($duplicate->getName(), $duplicate->getId());
|
||||
|
@@ -206,6 +206,7 @@ class API {
|
||||
$this->loggerFactory->getLogger(LoggerFactory::TOPIC_BRIDGE)->error('CreateAuthorizedEmailAddress API call failed.', $logData);
|
||||
|
||||
$errorResponseData = json_decode($errorBody, true);
|
||||
// translators: %d is the error code.
|
||||
$fallbackError = sprintf(__('An error has happened while performing a request, the server has responded with response code %d'), $code);
|
||||
|
||||
$errorData = is_array($errorResponseData) && isset($errorResponseData['error']) ? $errorResponseData['error'] : $fallbackError;
|
||||
|
@@ -67,6 +67,7 @@ class SettingsController {
|
||||
],
|
||||
'signup_confirmation' => [
|
||||
'enabled' => true,
|
||||
// translators: %1$s is the name of the blog
|
||||
'subject' => sprintf(__('Confirm your subscription to %1$s', 'mailpoet'), WPFunctions::get()->getOption('blogname')),
|
||||
'body' => __("Hello,\n\nWelcome to our newsletter!\n\nPlease confirm your subscription to our list by clicking the link below: \n\n[activation_link]I confirm my subscription![/activation_link]\n\nThank you,\n\nThe Team", 'mailpoet'),
|
||||
],
|
||||
|
@@ -91,6 +91,7 @@ class NewSubscriberNotificationMailer {
|
||||
'link_premium' => WPFunctions::get()->getSiteUrl(null, '/wp-admin/admin.php?page=mailpoet-upgrade'),
|
||||
];
|
||||
return [
|
||||
// translators: %s is name of the segment.
|
||||
'subject' => sprintf(__('New subscriber to %s', 'mailpoet'), $segmentNames),
|
||||
'body' => [
|
||||
'html' => $this->renderer->render('emails/newSubscriberNotification.html', $context),
|
||||
|
@@ -27,6 +27,7 @@ class RequiredCustomFieldValidator {
|
||||
foreach ($allCustomFields as $customFieldId => $customFieldName) {
|
||||
if ($this->isCustomFieldMissing($customFieldId, $data)) {
|
||||
throw new Exception(
|
||||
// translators: %s is the name of the custom field.
|
||||
__(sprintf('Missing value for custom field "%s"', $customFieldName), 'mailpoet')
|
||||
);
|
||||
}
|
||||
|
@@ -251,6 +251,7 @@ class SubscriberListingRepository extends ListingRepository {
|
||||
$subscribersWithoutSegmentCount = $subscribersWithoutSegmentStats[$key];
|
||||
|
||||
$subscribersWithoutSegmentLabel = sprintf(
|
||||
// translators: %s is the number of subscribers without a list.
|
||||
__('Subscribers without a list (%s)', 'mailpoet'),
|
||||
number_format((float)$subscribersWithoutSegmentCount)
|
||||
);
|
||||
|
@@ -246,6 +246,7 @@ class SubscriberSaveController {
|
||||
private function verifyEmailIsUnique(string $email): void {
|
||||
$existingSubscriber = $this->subscribersRepository->findOneBy(['email' => $email]);
|
||||
if ($existingSubscriber) {
|
||||
// translators: %s is email address which already exists.
|
||||
$exceptionMessage = __(sprintf('A subscriber with E-mail "%s" already exists.', $email), 'mailpoet');
|
||||
throw new ConflictException($exceptionMessage);
|
||||
}
|
||||
|
@@ -122,6 +122,7 @@ class SubscriberSubscribeController {
|
||||
if ($timeout > 0) {
|
||||
$timeToWait = $this->throttling->secondsToTimeString($timeout);
|
||||
$meta['refresh_captcha'] = true;
|
||||
// translators: %s is the amount of time the user has to wait.
|
||||
$meta['error'] = sprintf(__('You need to wait %s before subscribing again.', 'mailpoet'), $timeToWait);
|
||||
return $meta;
|
||||
}
|
||||
|
@@ -357,6 +357,7 @@ class Pages {
|
||||
private function getConfirmTitle() {
|
||||
if ($this->isPreview()) {
|
||||
$title = sprintf(
|
||||
// translators: %s is a comma-separated list of segment names.
|
||||
__("You have subscribed to: %s", 'mailpoet'),
|
||||
'demo 1, demo 2'
|
||||
);
|
||||
@@ -369,6 +370,7 @@ class Pages {
|
||||
$title = __("You are now subscribed!", 'mailpoet');
|
||||
} else {
|
||||
$title = sprintf(
|
||||
// translators: %s is a comma-separated list of segment names.
|
||||
__("You have subscribed to: %s", 'mailpoet'),
|
||||
join(', ', $segmentNames)
|
||||
);
|
||||
|
@@ -67,8 +67,11 @@ class Throttling {
|
||||
$min = floor($seconds % 3600 / 60);
|
||||
$sec = $seconds % 3600 % 60;
|
||||
$result = [
|
||||
// translators: %s is the number of hours
|
||||
'hours' => $hrs ? sprintf(__('%d hours', 'mailpoet'), $hrs) : '',
|
||||
// translators: %s is the number of minutes
|
||||
'minutes' => $min ? sprintf(__('%d minutes', 'mailpoet'), $min) : '',
|
||||
// translators: %s is the number of seconds
|
||||
'seconds' => $sec ? sprintf(__('%d seconds', 'mailpoet'), $sec) : '',
|
||||
];
|
||||
return join(' ', array_filter($result));
|
||||
|
@@ -190,8 +190,10 @@ class Functions extends AbstractExtension {
|
||||
$label = null;
|
||||
$labels = [
|
||||
'minute' => __('every minute', 'mailpoet'),
|
||||
// translators: %1$d is the amount of minutes.
|
||||
'minutes' => __('every %1$d minutes', 'mailpoet'),
|
||||
'hour' => __('every hour', 'mailpoet'),
|
||||
// translators: %1$d is the amount of hours.
|
||||
'hours' => __('every %1$d hours', 'mailpoet'),
|
||||
];
|
||||
|
||||
|
@@ -32,6 +32,7 @@ class EmailWithInvalidSegmentNotice {
|
||||
|
||||
private function display($newsletterSubject) {
|
||||
$notice = sprintf(
|
||||
// translators: %s is the subject of the newsletter.
|
||||
__('You are sending “%s“ to the deleted list. To continue sending, please restore the list. Alternatively, delete the newsletter if you no longer want to keep sending it.', 'mailpoet'),
|
||||
$this->wp->escHtml($newsletterSubject)
|
||||
);
|
||||
|
@@ -58,6 +58,7 @@ class InactiveSubscribersNotice {
|
||||
$goToSettingsString = __('Go to the Advanced Settings', 'mailpoet');
|
||||
|
||||
$notice = sprintf(
|
||||
// translators: %d is the number of inactive subscribers.
|
||||
__('Good news! MailPoet won’t send emails to your %s inactive subscribers. This is a standard practice to maintain good deliverability and open rates. But if you want to disable it, you can do so in settings. [link]Read more.[/link]', 'mailpoet'),
|
||||
$this->wp->numberFormatI18n($inactiveSubscribersCount)
|
||||
);
|
||||
|
@@ -22,6 +22,7 @@ class PHPVersionWarnings {
|
||||
}
|
||||
|
||||
public function display($phpVersion) {
|
||||
// translators: %s is the PHP version
|
||||
$errorString = __('Your website is running on PHP %s which MailPoet does not officially support. Read our [link]simple PHP upgrade guide.[/link]', 'mailpoet');
|
||||
$errorString = sprintf($errorString, $phpVersion);
|
||||
$error = Helpers::replaceLinkTags($errorString, 'https://kb.mailpoet.com/article/251-upgrading-the-websites-php-version', [
|
||||
|
@@ -53,6 +53,7 @@ class UnauthorizedEmailInNewslettersNotice {
|
||||
private function getNewslettersLinks($validationError) {
|
||||
$links = '';
|
||||
foreach ($validationError['invalid_senders_in_newsletters'] as $error) {
|
||||
// translators: %s is the newsletter subject.
|
||||
$linkText = _x('Update the from address of %s', '%s will be replaced by a newsletter subject', 'mailpoet');
|
||||
$linkText = str_replace('%s', EscapeHelper::escapeHtmlText($error['subject']), $linkText);
|
||||
$linkUrl = $this->wp->adminUrl('admin.php?page=' . Menu::MAIN_PAGE_SLUG . '#/send/' . $error['newsletter_id']);
|
||||
|
@@ -54,6 +54,7 @@ class UnauthorizedEmailNotice {
|
||||
}
|
||||
|
||||
private function getMessageText($validationError) {
|
||||
// translators: %s is the email address.
|
||||
$text = _x('<b>Sending all of your emails has been paused</b> because your email address <b>%s</b> hasn’t been authorized yet.',
|
||||
'Email addresses have to be authorized to be used to send emails. %s will be replaced by an email address.',
|
||||
'mailpoet');
|
||||
|
@@ -189,6 +189,7 @@ class Validator {
|
||||
$type = is_array($type) ? $type : [$type];
|
||||
return new WP_Error(
|
||||
'rest_invalid_type',
|
||||
// translators: %1$s is the current parameter and %2$s a comma-separated list of the allowed types.
|
||||
sprintf(__('%1$s is not of type %2$s.', 'mailpoet'), $param, implode(',', $type)),
|
||||
['param' => $param]
|
||||
);
|
||||
|
Reference in New Issue
Block a user