diff options
author | Sergi Almacellas Abellana <sergi@koolpi.com> | 2012-12-07 20:34:17 +0100 |
---|---|---|
committer | Sergi Almacellas Abellana <sergi@koolpi.com> | 2012-12-07 20:34:17 +0100 |
commit | b810e42cc70beb817de466835dcdc9de9d092bdc (patch) | |
tree | b377211721ba7692c5d9c12bc9a4359cd8dbe906 | |
parent | 75367f91e0c3691ebc1a143c99f73ca5532dba45 (diff) | |
download | nextcloud-server-b810e42cc70beb817de466835dcdc9de9d092bdc.tar.gz nextcloud-server-b810e42cc70beb817de466835dcdc9de9d092bdc.zip |
Improve autodetection of language.
Fixes #730.
-rw-r--r-- | lib/l10n.php | 10 |
1 files changed, 8 insertions, 2 deletions
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; } } } |