public function getLocale()
    {
        // Use the intl extension if present.
        if (class_exists('\Locale')) {
            $locale = \Locale::acceptFromHttp(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
        }

        // If no locale was obtained, resort to the default one.
        if (empty($locale)) {
            $locale = Application::getSettings()->locale->default;
        }

        return $locale;
    }