Skip to content

Commit

Permalink
Fix translators messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Aug 22, 2024
1 parent 66bfb86 commit 7fa4eb8
Show file tree
Hide file tree
Showing 25 changed files with 133 additions and 92 deletions.
19 changes: 9 additions & 10 deletions inc/settings/mollie_advanced_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
'lt_LT' => __('Lithuanian', 'mollie-payments-for-woocommerce'),
],
'desc' => sprintf(
__('Sending a language (or locale) is required. The option \'Automatically send WordPress language\' will try to get the customer\'s language in WordPress (and respects multilanguage plugins) and convert it to a format Mollie understands. If this fails, or if the language is not supported, it will fall back to American English. You can also select one of the locales currently supported by Mollie, that will then be used for all customers.', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: link tag Placeholder 2: closing tag */
__('Sending a language (or locale) is required. The option \'Automatically send WordPress language\' will try to get the customer\'s language in WordPress (and respects multilanguage plugins) and convert it to a format Mollie understands. If this fails, or if the language is not supported, it will fall back to American English. You can also select one of the locales currently supported by Mollie, that will then be used for all customers.', 'mollie-payments-for-woocommerce'),
'<a href="https://www.mollie.com/nl/docs/reference/payments/create" target="_blank">',
'</a>'
),
Expand All @@ -80,8 +81,8 @@
[
'id' => $pluginName . '_customer_details',
'title' => __('Store customer details at Mollie', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: enabled or disabled */
'desc' => sprintf(
/* translators: Placeholder 1: enabled or disabled Placeholder 2: translated string */
__(
'Should Mollie store customers name and email address for Single Click Payments? Default <code>%1$s</code>. Required if WooCommerce Subscriptions is being used! Read more about <a href=\'https://help.mollie.com/hc/en-us/articles/115000671249-What-are-single-click-payments-and-how-does-it-work-\'>%2$s</a> and how it improves your conversion.',
'mollie-payments-for-woocommerce'
Expand Down Expand Up @@ -110,9 +111,9 @@
),
],
'default' => PaymentService::PAYMENT_METHOD_TYPE_ORDER,
/* translators: Placeholder 1: opening link tag, placeholder 2: closing link tag */
'desc' => sprintf(
__(
/* translators: Placeholder 1: opening link tag, placeholder 2: closing link tag */
__(
'Click %1$shere%2$s to read more about the differences between the Payments and Orders API',
'mollie-payments-for-woocommerce'
),
Expand Down Expand Up @@ -160,9 +161,9 @@ class="mollie-settings-advanced-payment-desc-label button button-secondary butto
array_keys($api_payment_description_labels),
$api_payment_description_labels
)),
/* translators: Placeholder 1: Opening paragraph tag, placeholder 2: Closing paragraph tag */
sprintf(
__(
/* translators: Placeholder 1: Opening paragraph tag, placeholder 2: Closing paragraph tag */
__(
'Select among the available variables the description to be used for this transaction.%1$s(Note: this only works when the method is set to Payments API)%2$s',
'mollie-payments-for-woocommerce'
),
Expand All @@ -180,12 +181,10 @@ class="mollie-settings-advanced-payment-desc-label button button-secondary butto
'type' => 'text',
'custom_attributes' => ['maxlength' => '30'],
'default' => __('Gateway Fee', 'mollie-payments-for-woocommerce'),
'desc' => sprintf(
__(
'desc' => __(
'This is the label will appear in frontend when the surcharge applies',
'mollie-payments-for-woocommerce'
)
),
),
],
[
'id' => $pluginName . '_removeOptionsAndTransients',
Expand Down
18 changes: 8 additions & 10 deletions inc/settings/mollie_applepay_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
[
'id' => 'title',
'title' => __('Title', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: Gateway title */
'desc' => sprintf(
/* translators: Placeholder 1: Gateway title */
__(
'This controls the title which the user sees during checkout. Default <code>%s</code>',
'mollie-payments-for-woocommerce'
Expand All @@ -44,12 +44,10 @@
[
'id' => 'display_logo',
'title' => __('Display logo', 'mollie-payments-for-woocommerce'),
'desc' => sprintf(
__(
'desc' => __(
'Display logo',
'mollie-payments-for-woocommerce'
)
),
),
'desc_tip' => true,
'type' => 'checkbox',
'default' => 'yes',
Expand All @@ -59,8 +57,8 @@
[
'id' => 'description',
'title' => __('Description', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: Gateway description */
'desc' => sprintf(
/* translators: Placeholder 1: Gateway description */
__(
'Payment method description that the customer will see on your checkout. Default <code>%s</code>',
'mollie-payments-for-woocommerce'
Expand Down Expand Up @@ -88,9 +86,9 @@
[
'id' => 'mollie_apple_pay_button_enabled_cart',
'title' => __('Enable Apple Pay Button on Cart page', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: enabled or disabled */
'desc' => sprintf(
__(
/* translators: Placeholder 1: enabled or disabled */
__(
'Enable the Apple Pay direct buy button on the Cart page',
'mollie-payments-for-woocommerce'
),
Expand All @@ -104,9 +102,9 @@
[
'id' => 'mollie_apple_pay_button_enabled_product',
'title' => __('Enable Apple Pay Button on Product page', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: enabled or disabled */
'desc' => sprintf(
__(
/* translators: Placeholder 1: enabled or disabled */
__(
'Enable the Apple Pay direct buy button on the Product page',
'mollie-payments-for-woocommerce'
),
Expand Down
4 changes: 2 additions & 2 deletions src/Activation/ActivationModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public function mollieWcNoticeApiKeyMissing()
}

$notice = new AdminNotice();
/* translators: Placeholder 1: Opening strong tag. Placeholder 2: Closing strong tag. Placeholder 3: Opening link tag to settings. Placeholder 4: Closing link tag.*/
$message = sprintf(
esc_html__(
/* translators: Placeholder 1: Opening strong tag. Placeholder 2: Closing strong tag. Placeholder 3: Opening link tag to settings. Placeholder 4: Closing link tag.*/
esc_html__(
'%1$sMollie Payments for WooCommerce: API keys missing%2$s Please%3$s set your API keys here%4$s.',
'mollie-payments-for-woocommerce'
),
Expand Down
8 changes: 6 additions & 2 deletions src/Activation/ConstraintsChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ public function maybeShowWarning($constraint, $warning)

protected function showNotice(array $errors)
{
$message = sprintf(__('%1$sMollie Payments for WooCommerce is inactive:%2$s', 'mollie-payments-for-woocommerce'), '<p><strong>', '</strong></p>');
$message = sprintf(
/* translators: Placeholder 1: opening tags Placeholder 2: closing tags */
__('%1$sMollie Payments for WooCommerce is inactive:%2$s', 'mollie-payments-for-woocommerce'), '<p><strong>', '</strong></p>');
foreach ($errors as $error) {
$message .= sprintf('<p>%s</p>', $error);
}
$message .= sprintf(__('%1$sCorrect the above errors to use Mollie Payments for Woocommerce%2$s', 'mollie-payments-for-woocommerce'), '<p>', '</p>');
$message .= sprintf(
/* translators: Placeholder 1: opening tags Placeholder 2: closing tags */
__('%1$sCorrect the above errors to use Mollie Payments for Woocommerce%2$s', 'mollie-payments-for-woocommerce'), '<p>', '</p>');
$errorLevel = 'notice-error';
$this->notice->addNotice($errorLevel, $message);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Buttons/ApplePayButton/AppleAjaxRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,9 @@ function ($result, $order_id) {
)
);
} else {
/* translators: Placeholder 1: Payment method title */
$message = sprintf(
__(
/* translators: Placeholder 1: Payment method title */
__(
'Could not create %s payment.',
'mollie-payments-for-woocommerce'
),
Expand Down
8 changes: 4 additions & 4 deletions src/Buttons/ApplePayButton/ApplePayDirectHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public function __construct(AdminNotice $notice, AppleAjaxRequests $ajaxRequests
public function bootstrap($buttonEnabledProduct, $buttonEnabledCart)
{
if (!$this->isApplePayCompatible()) {
/* translators: Placeholder 1: Opening strong tag. Placeholder 2: Closing strong tag. Placeholder 3: Opening link tag to documentation. Placeholder 4: Closing link tag.*/
$message = sprintf(
esc_html__(
/* translators: Placeholder 1: Opening strong tag. Placeholder 2: Closing strong tag. Placeholder 3: Opening link tag to documentation. Placeholder 4: Closing link tag.*/
esc_html__(
'%1$sServer not compliant with Apple requirements%2$s Check %3$sApple Server requirements page%4$s to fix it in order to make the Apple Pay button work',
'mollie-payments-for-woocommerce'
),
Expand All @@ -53,9 +53,9 @@ public function bootstrap($buttonEnabledProduct, $buttonEnabledCart)
}

if (!$this->merchantValidated()) {
/* translators: Placeholder 1: Opening link tag to documentation. Placeholder 2: Closing link tag.*/
$message = sprintf(
esc_html__(
/* translators: Placeholder 1: Opening link tag to documentation. Placeholder 2: Closing link tag.*/
esc_html__(
'Apple Pay Validation Error: Please review the %1$sApple Server requirements%2$s. If everything appears correct, click the Apple Pay button to retry validation.',
'mollie-payments-for-woocommerce'
),
Expand Down
8 changes: 4 additions & 4 deletions src/Buttons/PayPalButton/PayPalAjaxRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public function createWcOrder()
) {
wp_send_json_success($result);
} else {
/* translators: Placeholder 1: Payment method title */
$message = sprintf(
__(
/* translators: Placeholder 1: Payment method title */
__(
'Could not create %s payment.',
'mollie-payments-for-woocommerce'
),
Expand Down Expand Up @@ -152,9 +152,9 @@ public function createWcOrderFromCart()
) {
wp_send_json_success($result);
} else {
/* translators: Placeholder 1: Payment method title */
$message = sprintf(
__(
/* translators: Placeholder 1: Payment method title */
__(
'Could not create %s payment.',
'mollie-payments-for-woocommerce'
),
Expand Down
1 change: 1 addition & 0 deletions src/Gateway/GatewayModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ public function addPaymentMethodMandatoryFields($fields, string $gatewayName, st
$errors->add(
'validation',
sprintf(
/* translators: Placeholder 1: field name. */
__('%s is a required field.', 'woocommerce'),
"<strong>$fieldLabel</strong>"
)
Expand Down
1 change: 1 addition & 0 deletions src/Gateway/MolliePaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ protected function noOrderPaymentFailure($orderId): array
$this->notice->addNotice(
'error',
sprintf(
/* translators: Placeholder 1: order id. */
__(
'Could not load order %s',
'mollie-payments-for-woocommerce'
Expand Down
4 changes: 2 additions & 2 deletions src/Gateway/Surcharge.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ protected function name_fixed_fee_percentage($paymentMethod)
$amountFix = $paymentMethod->getProperty(self::FIXED_FEE);
$currency = get_woocommerce_currency_symbol();
$amountPercent = $paymentMethod->getProperty(self::PERCENTAGE);
/* translators: Placeholder 1: Fee amount tag. Placeholder 2: Currency. Placeholder 3: Percentage amount. */
return sprintf(
__(' + %1$s %2$s + %3$s%% fee might apply', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: Fee amount tag. Placeholder 2: Currency. Placeholder 3: Percentage amount. */
__(' + %1$s %2$s + %3$s%% fee might apply', 'mollie-payments-for-woocommerce'),
$currency,
$amountFix,
$amountPercent
Expand Down
3 changes: 2 additions & 1 deletion src/MerchantCapture/Capture/Action/CapturePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public function __invoke()
);
$this->order->add_order_note(
sprintf(
__(
/* translators: Placeholder 1: Order price */
__(
'The payment capture of %s has been sent successfully, and we are currently awaiting confirmation.',
'mollie-payments-for-woocommerce'
),
Expand Down
16 changes: 8 additions & 8 deletions src/Payment/MollieOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,9 @@ public function refund_amount($order, $amount, $paymentObject, $reason)
$apiKey = $this->settingsHelper->getApiKey();

if ($paymentObject->isCreated() || $paymentObject->isAuthorized() || $paymentObject->isShipping()) {
/* translators: Placeholder 1: payment status.*/
$noteMessage = sprintf(
_x(
/* translators: Placeholder 1: payment status.*/
_x(
'Can not refund order amount that has status %1$s at Mollie.',
'Order note error',
'mollie-payments-for-woocommerce'
Expand All @@ -777,9 +777,9 @@ public function refund_amount($order, $amount, $paymentObject, $reason)
],
'description' => $reason,
]);
/* translators: Placeholder 1: Currency. Placeholder 2: Refund amount. Placeholder 3: Reason. Placeholder 4: Refund id.*/
$noteMessage = sprintf(
__('Amount refund of %1$s%2$s refunded in WooCommerce and at Mollie.%3$s Refund ID: %4$s.', 'mollie-payments-for-woocommerce'),
/* translators: Placeholder 1: Currency. Placeholder 2: Refund amount. Placeholder 3: Reason. Placeholder 4: Refund id.*/
__('Amount refund of %1$s%2$s refunded in WooCommerce and at Mollie.%3$s Refund ID: %4$s.', 'mollie-payments-for-woocommerce'),
$this->dataHelper->getOrderCurrency($order),
$amount,
( ! empty($reason) ? ' Reason: ' . $reason . '.' : '' ),
Expand Down Expand Up @@ -934,9 +934,9 @@ protected function processOrderItemsRefund(
);

if ($refund === null) {
/* translators: Placeholder 1: Number of items. Placeholder 2: Name of item. Placeholder 3: Currency. Placeholder 4: Amount.*/
$noteMessage = sprintf(
__(
/* translators: Placeholder 1: Number of items. Placeholder 2: Name of item. Placeholder 3: Currency. Placeholder 4: Amount.*/
__(
'%1$sx %2$s cancelled for %3$s%4$s in WooCommerce and at Mollie.',
'mollie-payments-for-woocommerce'
),
Expand All @@ -958,9 +958,9 @@ protected function processOrderItemsRefund(
$order
) . wc_format_decimal($itemRefundAmount) . (!empty($reason) ? ', reason: ' . $reason : '')
);
/* translators: Placeholder 1: Number of items. Placeholder 2: Name of item. Placeholder 3: Currency. Placeholder 4: Amount. Placeholder 5: Reason. Placeholder 6: Refund Id. */
$noteMessage = sprintf(
__(
/* translators: Placeholder 1: Number of items. Placeholder 2: Name of item. Placeholder 3: Currency. Placeholder 4: Amount. Placeholder 5: Reason. Placeholder 6: Refund Id. */
__(
'%1$sx %2$s refunded for %3$s%4$s in WooCommerce and at Mollie.%5$s Refund ID: %6$s.',
'mollie-payments-for-woocommerce'
),
Expand Down
8 changes: 4 additions & 4 deletions src/Payment/MollieOrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ protected function processChargebacks(WC_Order $order, $payment)
__METHOD__
. " New chargeback {$chargebackToProcess} for {$logId}. Order note and order status updated."
);
/* translators: Placeholder 1: Chargeback to process id. */
$order->add_order_note(
sprintf(
__(
/* translators: Placeholder 1: Chargeback to process id. */
__(
'New chargeback %s processed! Order note and order status updated.',
'mollie-payments-for-woocommerce'
),
Expand Down Expand Up @@ -816,10 +816,10 @@ protected function notifyProcessedRefunds(array $refundsToProcess, string $logId
__METHOD__
. " New refund {$refundToProcess} processed in Mollie Dashboard for {$logId} Order note added, but order not updated."
);
/* translators: Placeholder 1: Refund to process id. */
$order->add_order_note(
sprintf(
__(
/* translators: Placeholder 1: Refund to process id. */
__(
'New refund %s processed in Mollie Dashboard! Order note added, but order not updated.',
'mollie-payments-for-woocommerce'
),
Expand Down
1 change: 1 addition & 0 deletions src/Payment/OrderItemsRefunder.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private function normalizedRemoteItems(array $remoteItems)
if (!$orderItemId) {
throw new UnexpectedValueException(
sprintf(
/* translators: Placeholder 1: item id. */
esc_html__(
'Impossible to retrieve the order item ID related to the remote item: %1$s. Try to do a refund by amount.',
'mollie-payments-for-woocommerce'
Expand Down
7 changes: 4 additions & 3 deletions src/Payment/PaymentModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ public function addOrderNoteForRefundCreated(
WC_Order $order,
array $data
) {

$orderNote = sprintf(
__(
/* translators: Placeholder 1: number of items. */
__(
'%1$s items refunded in WooCommerce and at Mollie.',
'mollie-payments-for-woocommerce'
),
Expand All @@ -235,7 +235,8 @@ public function addOrderNoteForRefundCreated(
public function addOrderNoteForCancelledLineItems(array $data, WC_Order $order)
{
$orderNote = sprintf(
__(
/* translators: Placeholder 1: number of items. */
__(
'%1$s items cancelled in WooCommerce and at Mollie.',
'mollie-payments-for-woocommerce'
),
Expand Down
3 changes: 2 additions & 1 deletion src/Payment/RefundLineItemsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function buildLineItems(
if ($toRefundRemoteItem === null) {
throw new UnexpectedValueException(
sprintf(
esc_html__(
/* translators: Placeholder 1: item id. */
esc_html__(
'Cannot refund %s item because it was not found in Mollie order. Aborting refund process. Try to do a refund by amount.',
'mollie-payments-for-woocommerce'
),
Expand Down
Loading

0 comments on commit 7fa4eb8

Please sign in to comment.