| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Merchant - WPML Support |
| 9 |
* |
| 10 |
* This class is not meant to be used directly. It will be used by the Merchant_Translator class. |
| 11 |
*/ |
| 12 |
if ( ! class_exists( 'Merchant_WPML_Support' ) ) { |
| 13 |
class Merchant_WPML_Support implements Merchant_Language_Strategy { |
| 14 |
|
| 15 |
/** |
| 16 |
* Register a string for translation. |
| 17 |
* |
| 18 |
* @param string $string_to_register The string to translate. |
| 19 |
* @param string $context The context of the string. |
| 20 |
* @param bool $multiline Not used!. |
| 21 |
*/ |
| 22 |
public function register_string( $string_to_register, $context, $multiline = false ) { |
| 23 |
/** |
| 24 |
* @see https://wpml.org/wpml-hook/wpml_register_single_string/ |
| 25 |
* |
| 26 |
* @param string $context The context of the string. |
| 27 |
* @param string $string_to_register The string to translate. |
| 28 |
* |
| 29 |
* @since 1.8.0 |
| 30 |
*/ |
| 31 |
do_action( 'wpml_register_single_string', 'Merchant', $context, $string_to_register ); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Translate a string. |
| 36 |
* |
| 37 |
* @param string $string_to_translate The string to translate. |
| 38 |
* |
| 39 |
* @return string |
| 40 |
*/ |
| 41 |
public function translate_string( $string_to_translate ) { |
| 42 |
/** |
| 43 |
* @see https://wpml.org/wpml-hook/wpml_translate_single_string/ |
| 44 |
* |
| 45 |
* @param string $string_to_translate The string to translate. |
| 46 |
* |
| 47 |
* @since 1.8.0 |
| 48 |
*/ |
| 49 |
return apply_filters( 'wpml_translate_single_string', $string_to_translate, 'Merchant', $string_to_translate ); |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Get Current language code |
| 54 |
* |
| 55 |
* @return string |
| 56 |
*/ |
| 57 |
public function get_current_lang() { |
| 58 |
/** |
| 59 |
* @see https://wpml.org/wpml-hook/wpml_current_language/ |
| 60 |
* |
| 61 |
* @since 1.9.0 |
| 62 |
*/ |
| 63 |
return apply_filters( 'wpml_current_language', null ); |
| 64 |
} |
| 65 |
} |
| 66 |
} |