Skip to content
This repository was archived by the owner on Mar 17, 2022. It is now read-only.

Commit 244aacf

Browse files
committed
implements #339 by translating store notice
store notice is added to Strings translations under the WooCommerce Privacy section
1 parent d959282 commit 244aacf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Hyyan/WPI/Privacy.php

+13
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function __construct()
2222
{
2323
$this->registerPrivacyStrings();
2424
add_filter('woocommerce_get_privacy_policy_text', array($this, 'translatePrivacyPolicyText'), 10, 2);
25+
add_filter( 'woocommerce_demo_store', array( $this, 'translateDemoStoreNotice' ), 10, 2 );
2526
}
2627

2728
/**
@@ -32,6 +33,7 @@ public function registerPrivacyStrings()
3233
{
3334
$this->registerString('woocommerce_checkout_privacy_policy_text', get_option('woocommerce_checkout_privacy_policy_text', sprintf(__('Your personal data will be used to process your order, support your experience throughout this website, and for other purposes described in our %s.', 'woocommerce'), '[privacy_policy]')));
3435
$this->registerString('woocommerce_registration_privacy_policy_text', get_option('woocommerce_registration_privacy_policy_text', sprintf(__('Your personal data will be used to support your experience throughout this website, to manage access to your account, and for other purposes described in our %s.', 'woocommerce'), '[privacy_policy]')));
36+
$this->registerString( 'woocommerce_store_notice', get_option( 'woocommerce_demo_store_notice' ) );
3537
}
3638

3739

@@ -61,4 +63,15 @@ public function translatePrivacyPolicyText($text, $type)
6163
return ($trans) ? $trans : $text;
6264
}
6365
}
66+
67+
public function translateDemoStoreNotice( $html, $notice ) {
68+
$trans = '';
69+
if ( function_exists( 'pll_register_string' ) ) {
70+
$trans = pll__( $notice );
71+
return '<p class="woocommerce-store-notice demo_store">' . wp_kses_post( $trans ) . ' <a href="#" class="woocommerce-store-notice__dismiss-link">' . esc_html__( 'Dismiss', 'woocommerce' ) . '</a></p>';
72+
} else {
73+
return $html;
74+
}
75+
}
76+
6477
}

0 commit comments

Comments
 (0)