em = $em; $this->locale = $locale; $this->localeDefault = $locale; $this->rs = $rs; $this->getUserLocale(); } /** * todo implement this function */ protected function getUserLocale(){ //check in session if user use custom locale (other than "en") //then replace $this->locale } /** * @return string */ public function getLocale(): string { return $this->locale; } /** * @param string $locale * * todo save it in cookie if anonymous or in session or user settings if logged * @idea use this function in user service */ public function setLocale(string $locale) { $this->locale = $locale; } /** * @return string */ public function getLocaleDefault(): string { return $this->localeDefault; } }