From: ArthurHoaro Date: Fri, 2 Feb 2018 17:51:53 +0000 (+0100) Subject: Merge pull request #1070 from ArthurHoaro/hotfix/lc-messages-warning X-Git-Tag: v0.9.5~8 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=40e816e3796d7d4fdf4b442c25f4c2b76f5eebc0;hp=499bd43c37a6ee3d13dabe8bdd0bb449ae57122a;p=github%2Fshaarli%2FShaarli.git Merge pull request #1070 from ArthurHoaro/hotfix/lc-messages-warning Use LC_COLLATE instead of LC_MESSAGES if php-intl is not installed --- diff --git a/application/Languages.php b/application/Languages.php index 357c7524..3eb3388f 100644 --- a/application/Languages.php +++ b/application/Languages.php @@ -69,6 +69,8 @@ class Languages { $this->conf = $conf; $confLanguage = $this->conf->get('translation.language', 'auto'); + // Auto mode or invalid parameter, use the detected language. + // If the detected language is invalid, it doesn't matter, it will use English. if ($confLanguage === 'auto' || ! $this->isValidLanguage($confLanguage)) { $this->language = substr($language, 0, 5); } else { diff --git a/index.php b/index.php index d57789e6..2de9be0a 100644 --- a/index.php +++ b/index.php @@ -124,6 +124,11 @@ if (isset($_COOKIE['shaarli']) && !SessionManager::checkId($_COOKIE['shaarli'])) $conf = new ConfigManager(); $sessionManager = new SessionManager($_SESSION, $conf); +// LC_MESSAGES isn't defined without php-intl, in this case use LC_COLLATE locale instead. +if (! defined('LC_MESSAGES')) { + define('LC_MESSAGES', LC_COLLATE); +} + // Sniff browser language and set date format accordingly. if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { autoLocale($_SERVER['HTTP_ACCEPT_LANGUAGE']);