Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\FrontModule\Presenters;
- use App\Model\Locale\LocaleDetectService;;
- use Kdyby\Translation\Translator;
- use Nette\Application\UI\Presenter;
- abstract class BaseFrontPresenter extends Presenter
- {
- /**
- * @var string
- * @persistent
- */
- public $locale;
- /**
- * @var Translator
- * @inject
- */
- public $translator;
- /**
- * @var LocaleDetectService
- * @inject
- */
- public $localeDetectService;
- public function startup()
- {
- $this->translator->setLocale($this->locale ? $this->locale : $this->localeDetectService->getLocaleCode());
- $this->locale = $this->locale ? $this->locale : $this->localeDetectService->getLocaleCode();
- }
- }
Add Comment
Please, Sign In to add comment