Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Plugin.php
Go to the documentation of this file.
1 <?php
7 
11 class Plugin
12 {
16  protected $_translate;
17 
21  public function __construct(\Magento\Framework\TranslateInterface $translate)
22  {
23  $this->_translate = $translate;
24  }
25 
32  public function afterEmulate(\Magento\Framework\Locale\ResolverInterface $subject, $localeCode)
33  {
34  $this->_init($localeCode);
35  }
36 
43  public function afterRevert(\Magento\Framework\Locale\ResolverInterface $subject, $localeCode)
44  {
45  $this->_init($localeCode);
46  }
47 
52  protected function _init($localeCode)
53  {
54  if ($localeCode !== null) {
55  $this->_translate->setLocale($localeCode)
56  ->loadData();
57  }
58  }
59 }
__construct(\Magento\Framework\TranslateInterface $translate)
Definition: Plugin.php:21
afterEmulate(\Magento\Framework\Locale\ResolverInterface $subject, $localeCode)
Definition: Plugin.php:32
afterRevert(\Magento\Framework\Locale\ResolverInterface $subject, $localeCode)
Definition: Plugin.php:43