From b810e42cc70beb817de466835dcdc9de9d092bdc Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Fri, 7 Dec 2012 20:34:17 +0100 Subject: Improve autodetection of language. Fixes #730. --- lib/l10n.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/l10n.php b/lib/l10n.php index f172710e5d7..4f9c3a0edef 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -294,8 +294,14 @@ class OC_L10N{ } foreach($accepted_languages as $i) { $temp = explode(';', $i); - if(array_search($temp[0], $available) !== false) { - return $temp[0]; + $temp[0] = str_replace('-','_',$temp[0]); + if( ($key = array_search($temp[0], $available)) !== false) { + return $available[$key]; + } + } + foreach($available as $l) { + if ( $temp[0] == substr($l,0,2) ) { + return $l; } } } -- cgit v1.2.3