| 1 |
<?php |
| 2 |
/** |
| 3 |
* I18n Controller |
| 4 |
* |
| 5 |
* @package SeQura/WC |
| 6 |
* @subpackage SeQura/WC/Controllers |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SeQura\WC\Controllers\Hooks\I18n; |
| 10 |
|
| 11 |
use SeQura\WC\Controllers\Controller; |
| 12 |
use SeQura\WC\Services\Log\Interface_Logger_Service; |
| 13 |
|
| 14 |
/** |
| 15 |
* Define the internationalization functionality |
| 16 |
* Loads and defines the internationalization files for this plugin |
| 17 |
* so that it is ready for translation. |
| 18 |
*/ |
| 19 |
class I18n_Controller extends Controller implements Interface_I18n_Controller { |
| 20 |
|
| 21 |
/** |
| 22 |
* The relative path to translation files from wp-content/plugins |
| 23 |
* |
| 24 |
* @var string |
| 25 |
*/ |
| 26 |
private $domain_path; |
| 27 |
|
| 28 |
/** |
| 29 |
* The text domain of the plugin. |
| 30 |
* |
| 31 |
* @var string |
| 32 |
*/ |
| 33 |
private $text_domain; |
| 34 |
|
| 35 |
/** |
| 36 |
* Constructor |
| 37 |
*/ |
| 38 |
public function __construct( |
| 39 |
string $text_domain, |
| 40 |
string $domain_path, |
| 41 |
Interface_Logger_Service $logger, |
| 42 |
string $templates_path |
| 43 |
) { |
| 44 |
parent::__construct( $logger, $templates_path ); |
| 45 |
$this->text_domain = $text_domain; |
| 46 |
$this->domain_path = \trailingslashit( $domain_path ); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Load the plugin text domain for translation. |
| 51 |
* |
| 52 |
* @return void |
| 53 |
*/ |
| 54 |
public function load_text_domain() { |
| 55 |
$this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 56 |
\load_plugin_textdomain( $this->text_domain, false, $this->domain_path ); |
| 57 |
} |
| 58 |
} |
| 59 |
|