From 79218be1d2214095eae1272eac7559a67a55a786 Mon Sep 17 00:00:00 2001 From: kondou Date: Thu, 18 Apr 2013 14:17:37 +0200 Subject: Priorize common languages. --- settings/personal.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'settings/personal.php') 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()); -- cgit v1.2.3