diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2012-12-12 03:43:17 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2012-12-12 03:43:17 -0800 |
commit | 72fe339c102975ee693e1ced005ca6d3f865389d (patch) | |
tree | 7ec0685585785d41131551685a2da157b9faefe4 | |
parent | bac4e011dc6b0fd890da6ac260afe0fd173da443 (diff) | |
parent | 7b0e2b348b3ad5b4351c37cc91531718773c3864 (diff) | |
download | nextcloud-server-72fe339c102975ee693e1ced005ca6d3f865389d.tar.gz nextcloud-server-72fe339c102975ee693e1ced005ca6d3f865389d.zip |
Merge pull request #766 from btactic/language_autodetect
Improve autodetection of language.
-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..b83d8ff86db 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; + } } } } |