1 | <?php |
||
2 | |||
3 | namespace Jaxon\App\I18n; |
||
4 | |||
5 | /** |
||
6 | * Translator.php |
||
7 | * |
||
8 | * A translator coupled with a config event listener. |
||
9 | * |
||
10 | * @package jaxon-core |
||
11 | * @author Thierry Feuzeu <[email protected]> |
||
12 | * @copyright 2022 Thierry Feuzeu <[email protected]> |
||
13 | * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License |
||
14 | * @link https://github.com/jaxon-php/jaxon-core |
||
15 | */ |
||
16 | |||
17 | use Jaxon\App\Config\ConfigListenerInterface; |
||
18 | use Jaxon\Utils\Config\Config; |
||
19 | use Jaxon\Utils\Translation\Translator as BaseTranslator; |
||
20 | |||
21 | class Translator extends BaseTranslator implements ConfigListenerInterface |
||
22 | { |
||
23 | /** |
||
24 | * @inheritDoc |
||
25 | */ |
||
26 | public function onChange(Config $xConfig, string $sName) |
||
27 | { |
||
28 | // Set the library language any time the config is changed. |
||
29 | if($sName === '' || $sName === 'core.language') |
||
30 | { |
||
31 | $this->setLocale($xConfig->getOption('core.language')); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
32 | } |
||
33 | } |
||
34 | } |
||
35 |