Use sprintf for texts with links

This commit is contained in:
inpsyde-maticluznar 2024-11-14 08:29:03 +01:00
parent b23a9a0fab
commit f6e214650e
No known key found for this signature in database
GPG key ID: D005973F231309F6
3 changed files with 31 additions and 14 deletions

View file

@ -51,9 +51,12 @@ export const PayPalRdbWithContent = ( props ) => {
<div className="ppcp-r__radio-content">
<label htmlFor={ props?.id }>{ props.label }</label>
{ props.description && (
<p className="ppcp-r__radio-description">
{ props.description }
</p>
<p
className="ppcp-r__radio-description"
dangerouslySetInnerHTML={ {
__html: props.description,
} }
/>
) }
</div>
</div>

View file

@ -1,4 +1,4 @@
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import SettingsBlock, {
SETTINGS_BLOCK_STYLING_TYPE_PRIMARY,
SETTINGS_BLOCK_STYLING_TYPE_SECONDARY,
@ -158,9 +158,13 @@ const Sandbox = ( { settings, updateFormValue } ) => {
'Manual Connect',
'woocommerce-paypal-payments'
) }
description={ __(
'For advanced users: Connect a custom PayPal REST app for full control over your integration. For more information on creating a PayPal REST application, click here.',
'woocommerce-paypal-payments'
description={ sprintf(
// translators: %s: Link to creating PayPal REST application
__(
'For advanced users: Connect a custom PayPal REST app for full control over your integration. For more information on creating a PayPal REST application, <a target="_blank" href="%s">click here</a>.',
'woocommerce-paypal-payments'
),
'#'
) }
>
<TextControl

View file

@ -4,7 +4,7 @@ import SettingsBlock, {
SETTINGS_BLOCK_TYPE_EMPTY,
SETTINGS_BLOCK_TYPE_TOGGLE,
} from '../../../../ReusableComponents/SettingsBlock';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
const SavePaymentMethods = ( { updateFormValue, settings } ) => {
return (
@ -14,9 +14,14 @@ const SavePaymentMethods = ( { updateFormValue, settings } ) => {
'Save Payment Methods',
'woocommerce-paypal-payments'
) }
description={ __(
'Securely store customers payment methods for <a target="_blank" href="#">future payments[LINK]</a> and <a target="_blank" href="#">subscriptions[LINK]</a>, simplifying checkout and enabling recurring transactions.',
'woocommerce-paypal-payments'
description={ sprintf(
// translators: first %s: Link to Future payments, second %s: Link to subscriptions
__(
'Securely store customers payment methods for <a target="_blank" href="%1$s">future payments[MISSING_LINK]</a> and <a target="_blank" href="%2$s">subscriptions[MISSING_LINK]</a>, simplifying checkout and enabling recurring transactions.',
'woocommerce-paypal-payments'
),
'#',
'#'
) }
type={ SETTINGS_BLOCK_STYLING_TYPE_PRIMARY }
style={ SETTINGS_BLOCK_STYLING_TYPE_PRIMARY }
@ -29,9 +34,14 @@ const SavePaymentMethods = ( { updateFormValue, settings } ) => {
'Save PayPal and Venmo',
'woocommerce-paypal-payments'
) }
description={ __(
'Securely store your customers PayPal accounts for a seamless checkout experience. <br />This will disable all Pay Later features and Alternative Payment Methods on your site.',
'woocommerce-paypal-payments'
description={ sprintf(
// translators: first %s: Link to Pay Later, second %s: Link to Alternative Payment Methods
__(
'Securely store your customers PayPal accounts for a seamless checkout experience. <br />This will disable all <a target="_blank" href="%1$s">Pay Later</a> features and <a target="_blank" href="%2$s">Alternative Payment Methods</a> on your site.',
'woocommerce-paypal-payments'
),
'https://woocommerce.com/document/woocommerce-paypal-payments/#pay-later',
'https://woocommerce.com/document/woocommerce-paypal-payments/#alternative-payment-methods'
) }
style={ SETTINGS_BLOCK_STYLING_TYPE_SECONDARY }
value={ settings.savePaypalAndVenmo }