| 1 |
<?php |
| 2 |
|
| 3 |
namespace Allex; |
| 4 |
|
| 5 |
class TextDomain extends Abstract_Service |
| 6 |
{ |
| 7 |
/** |
| 8 |
* @var string |
| 9 |
*/ |
| 10 |
protected $locale; |
| 11 |
|
| 12 |
/** |
| 13 |
* TextDomain constructor. |
| 14 |
* |
| 15 |
* @param Container $container |
| 16 |
*/ |
| 17 |
public function __construct(Container $container) |
| 18 |
{ |
| 19 |
parent::__construct($container); |
| 20 |
|
| 21 |
$this->locale = $this->get_locale(); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* @return mixed |
| 26 |
*/ |
| 27 |
protected function get_locale() |
| 28 |
{ |
| 29 |
return get_locale(); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Load the framework's text domain. |
| 34 |
*/ |
| 35 |
public function load() |
| 36 |
{ |
| 37 |
$mo_file = __DIR__ . 'languages/allex-' . $this->locale . '.mo'; |
| 38 |
|
| 39 |
if (file_exists($mo_file)) { |
| 40 |
load_textdomain('allex', $mo_file); |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
|