diff options
author | kondou <kondou@ts.unde.re> | 2013-04-18 14:17:37 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-04-18 15:14:42 +0200 |
commit | 79218be1d2214095eae1272eac7559a67a55a786 (patch) | |
tree | 55d031aea9abf5e987f159222a4dfc72716223c9 /settings | |
parent | cbd8b792d9505f2020aa4a0f54c031f26cb5fe02 (diff) | |
download | nextcloud-server-79218be1d2214095eae1272eac7559a67a55a786.tar.gz nextcloud-server-79218be1d2214095eae1272eac7559a67a55a786.zip |
Priorize common languages.
Diffstat (limited to 'settings')
-rw-r--r-- | settings/js/personal.js | 4 | ||||
-rw-r--r-- | settings/personal.php | 15 | ||||
-rw-r--r-- | settings/templates/personal.php | 7 |
3 files changed, 22 insertions, 4 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js index 7c879bcafe9..271de1599d9 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -88,6 +88,10 @@ $(document).ready(function(){ $("#languageinput").chosen(); $("#languageinput").change( function(){ + // the divider is no language + if ($("#languageinput option").hasClass('divider')) { + return false; + } // Serialize the data var post = $( "#languageinput" ).serialize(); // Ajax foo 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()); diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 03073069ab7..c0fcf5c1bd6 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -78,11 +78,16 @@ if($_['displayNameChangeSupported']) { <fieldset class="personalblock"> <legend><strong><?php p($l->t('Language'));?></strong></legend> <select id="languageinput" class="chzen-select" name="lang" data-placeholder="<?php p($l->t('Language'));?>"> + <option value="<?php p($_['activelanguage']['code']);?>"><?php p($_['activelanguage']['name']);?></option> + <?php foreach($_['commonlanguages'] as $language):?> + <option value="<?php p($language['code']);?>"><?php p($language['name']);?></option> + <?php endforeach;?> + <option class="divider">––––––––––</option> <?php foreach($_['languages'] as $language):?> <option value="<?php p($language['code']);?>"><?php p($language['name']);?></option> <?php endforeach;?> </select> - <a href="https://www.transifex.net/projects/p/owncloud/team/<?php p($_['languages'][0]['code']);?>/" + <a href="https://www.transifex.net/projects/p/owncloud/team/<?php p($_['activelanguage']['code']);?>/" target="_blank"><em><?php p($l->t('Help translate'));?></em></a> </fieldset> </form> |