diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-01-31 12:39:17 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-01-31 12:39:17 +0100 |
commit | b7c412d4d0fec7f3f54ecaa09178afa16c779d7e (patch) | |
tree | b2b0dce6c36f4a7f9f4f7e0f5e6811791fb3bccf | |
parent | 2cbf4acddeeed9d6d775566b1dec560b1452d8eb (diff) | |
download | Shaarli-b7c412d4d0fec7f3f54ecaa09178afa16c779d7e.tar.gz Shaarli-b7c412d4d0fec7f3f54ecaa09178afa16c779d7e.tar.zst Shaarli-b7c412d4d0fec7f3f54ecaa09178afa16c779d7e.zip |
Use LC_COLLATE instead of LC_MESSAGES if php-intl is not installed
As stated in the docs:
> LC_MESSAGES for system responses (available if PHP was compiled with libintl)
Fixes #1067
-rw-r--r-- | application/Languages.php | 2 | ||||
-rw-r--r-- | index.php | 5 |
2 files changed, 7 insertions, 0 deletions
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 | |||
69 | { | 69 | { |
70 | $this->conf = $conf; | 70 | $this->conf = $conf; |
71 | $confLanguage = $this->conf->get('translation.language', 'auto'); | 71 | $confLanguage = $this->conf->get('translation.language', 'auto'); |
72 | // Auto mode or invalid parameter, use the detected language. | ||
73 | // If the detected language is invalid, it doesn't matter, it will use English. | ||
72 | if ($confLanguage === 'auto' || ! $this->isValidLanguage($confLanguage)) { | 74 | if ($confLanguage === 'auto' || ! $this->isValidLanguage($confLanguage)) { |
73 | $this->language = substr($language, 0, 5); | 75 | $this->language = substr($language, 0, 5); |
74 | } else { | 76 | } else { |
@@ -124,6 +124,11 @@ if (isset($_COOKIE['shaarli']) && !SessionManager::checkId($_COOKIE['shaarli'])) | |||
124 | $conf = new ConfigManager(); | 124 | $conf = new ConfigManager(); |
125 | $sessionManager = new SessionManager($_SESSION, $conf); | 125 | $sessionManager = new SessionManager($_SESSION, $conf); |
126 | 126 | ||
127 | // LC_MESSAGES isn't defined without php-intl, in this case use LC_COLLATE locale instead. | ||
128 | if (! defined('LC_MESSAGES')) { | ||
129 | define('LC_MESSAGES', LC_COLLATE); | ||
130 | } | ||
131 | |||
127 | // Sniff browser language and set date format accordingly. | 132 | // Sniff browser language and set date format accordingly. |
128 | if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { | 133 | if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
129 | autoLocale($_SERVER['HTTP_ACCEPT_LANGUAGE']); | 134 | autoLocale($_SERVER['HTTP_ACCEPT_LANGUAGE']); |