woocommerce-multilingual
/
compatibility
/
TmExtraProductOptions
/
class-wcml-extra-product-options.php
class-wcml-extra-product-options.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | class WCML_Extra_Product_Options implements \IWPML_Action { |
| 4 | |
| 5 | const TRANSLATION_DOMAIN = 'wc_extra_product_options'; |
| 6 | |
| 7 | public function add_hooks() { |
| 8 | add_action( 'tm_before_extra_product_options', [ $this, 'inf_translate_product_page_strings' ] ); |
| 9 | add_action( 'tm_before_price_rules', [ $this, 'inf_translate_strings' ] ); |
| 10 | } |
| 11 | |
| 12 | public function inf_translate_strings() { |
| 13 | if ( isset( $_GET['page'] ) && 'tm-global-epo' === sanitize_text_field( $_GET['page'] ) ) { |
| 14 | $this->inf_message( 'Options Form' ); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | public function inf_translate_product_page_strings() { |
| 19 | $this->inf_message( 'Product' ); |
| 20 | } |
| 21 | |
| 22 | public function inf_message( $text ) { |
| 23 | $dashboardUrl = \WCML\Utilities\AdminUrl::getWPMLTMDashboardStringDomain( self::TRANSLATION_DOMAIN ); |
| 24 | $message = '<div><p class="icl_cyan_box">'; |
| 25 | $message .= sprintf( |
| 26 | /* translators: %1$s and %2$s are opening and closing HTML link tags */ |
| 27 | esc_html__( 'To translate custom product fields, save your changes here first, then go to the %2$sTranslation Dashboard%3$s.', 'woocommerce-multilingual' ), |
| 28 | '<a href="' . esc_url( $dashboardUrl ) . '">', |
| 29 | '</a>' |
| 30 | ); |
| 31 | $message .= '</p></div>'; |
| 32 | |
| 33 | echo $message; |
| 34 | } |
| 35 | } |
| 36 |