private function initLocale()
    {
        $this->locale = $this->detectLocale();

        // datetime format
        if (!setlocale(LC_TIME, $this->locales[$this->locale])) {
            throw new \Exception(sprintf("Unable to set locale to '%s'", $this->locales[$this->locale]));
        }

        // punic default value
        Data::setDefaultLocale($this->getIETF());

        if ('cli' !== PHP_SAPI) {
            if (!self::request()->getCookie(self::COOKIE_LANGUAGE)) {
                self::response()->addCookie(new Cookie(self::COOKIE_LANGUAGE, $this->locale, 60 * 60 * 24 * 365));
            }
        }
    }