summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-09-24 09:21:27 +0200
committerAleksander Machniak <alec@alec.pl>2013-09-24 09:21:27 +0200
commit2c6a233a9981d8f2cc56b6e166d971f63359c519 (patch)
treec94d24da3bf4f925de64371166c8e157025ff830 /program
parent19884ec5d2adabb9e0ccb0b27ebdd50cb0b933d9 (diff)
Make sure language code extracted from HTTP_ACCEPT_LANGUAGE is in xx_YY format
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index d9c3dd8b9..e43f53526 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -702,7 +702,11 @@ class rcube
// user HTTP_ACCEPT_LANGUAGE if no language is specified
if (empty($lang) || $lang == 'auto') {
$accept_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
- $lang = str_replace('-', '_', $accept_langs[0]);
+ $lang = $accept_langs[0];
+
+ if (preg_match('/^([a-z]+)[_-]([a-z]+)$/i', $lang, $m)) {
+ $lang = $m[1] . '_' . strtoupper($m[2]);
+ }
}
if (empty($rcube_languages)) {