public function getLocale()
    {
        if (!$this->cookiesLoaded) {
            $key = $this->cookiePrefix . 'lang_locale';
            $queuedCookieLocale = \Cookie::queued($key, null);
            $locale = getSupportedLocale($queuedCookieLocale != null ? $queuedCookieLocale->getValue() : \Cookie::get($key, ''));
            parent::setLocale($locale);
            
            // load unpublished translation flag at the same time
            $this->getShowUnpublished();
            $this->cookiesLoaded = true;
        }
        return parent::getLocale();
    }