summaryrefslogtreecommitdiffstats
path: root/settings/personal.php
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-04-18 14:17:37 +0200
committerkondou <kondou@ts.unde.re>2013-04-18 15:14:42 +0200
commit79218be1d2214095eae1272eac7559a67a55a786 (patch)
tree55d031aea9abf5e987f159222a4dfc72716223c9 /settings/personal.php
parentcbd8b792d9505f2020aa4a0f54c031f26cb5fe02 (diff)
downloadnextcloud-server-79218be1d2214095eae1272eac7559a67a55a786.tar.gz
nextcloud-server-79218be1d2214095eae1272eac7559a67a55a786.zip
Priorize common languages.
Diffstat (limited to 'settings/personal.php')
-rw-r--r--settings/personal.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/settings/personal.php b/settings/personal.php
index 9bbc66c9b7f..57a7e4ee9cd 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -22,8 +22,14 @@ $email=OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
$userLang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
$languageCodes=OC_L10N::findAvailableLanguages();
+// array of common languages
+$commonlangcodes = array(
+ 'en', 'es', 'fr', 'de', 'de_DE', 'ja_JP', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'zh_CN', 'ko'
+);
+
$languageNames=include 'languageCodes.php';
$languages=array();
+$commonlanguages = array();
foreach($languageCodes as $lang) {
$l=OC_L10N::get('settings', $lang);
if(substr($l->t('__language_name__'), 0, 1)!='_') {//first check if the language name is in the translation file
@@ -34,8 +40,12 @@ foreach($languageCodes as $lang) {
$ln=array('code'=>$lang, 'name'=>$lang);
}
+ // put apropriate languages into apropriate arrays, to print them sorted
+ // used language -> common languages -> divider -> other languages
if ($lang === $userLang) {
$userLang = $ln;
+ } elseif (in_array($lang, $commonlangcodes)) {
+ $commonlanguages[]=$ln;
} else {
$languages[]=$ln;
}
@@ -46,9 +56,6 @@ usort( $languages, function ($a, $b) {
return strcmp($a['name'], $b['name']);
});
-//put the current language in the front
-array_unshift($languages, $userLang);
-
//links to clients
$clients = array(
'desktop' => OC_Config::getValue('customclient_desktop', 'http://owncloud.org/sync-clients/'),
@@ -64,6 +71,8 @@ $tmpl->assign('usage_relative', $storageInfo['relative']);
$tmpl->assign('clients', $clients);
$tmpl->assign('email', $email);
$tmpl->assign('languages', $languages);
+$tmpl->assign('commonlanguages', $commonlanguages);
+$tmpl->assign('activelanguage', $userLang);
$tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser()));
$tmpl->assign('displayNameChangeSupported', OC_User::canUserChangeDisplayName(OC_User::getUser()));
$tmpl->assign('displayName', OC_User::getDisplayName());