Merge pull request #1700 from owncloud/fixing-1680-master

Fixing 1680 master
This commit is contained in:
Jan-Christoph Borchardt 2013-02-15 03:21:49 -08:00
commit 8b09fbc150
3 changed files with 32 additions and 11 deletions

View file

@ -343,7 +343,7 @@ class OC_L10N{
if(is_dir($dir)) {
$files=scandir($dir);
foreach($files as $file) {
if(substr($file, -4, 4) == '.php') {
if(substr($file, -4, 4) === '.php' && substr($file, 0, 4) !== 'l10n') {
$i = substr($file, 0, -4);
$available[] = $i;
}

View file

@ -50,6 +50,17 @@ return array(
'lv'=>'Latviešu',
'mk'=>'македонски',
'uk'=>'Українська',
'vi'=>'tiếng việt',
'vi'=>'Tiếng Việt',
'zh_TW'=>'臺灣話',
'af_ZA'=> 'Afrikaans',
'bn_BD'=>'Bengali',
'ta_LK'=>'தமிழ்',
'zh_HK'=>'Chinese (Hong Kong)',
'oc'=>'Occitan (post 1500)',
'is'=>'Icelandic',
'pl_PL'=>'Polski',
'ka_GE'=>'Georgian for Georgia',
'ku_IQ'=>'Kurdish Iraq',
'ru_RU'=>'Русский язык',
'si_LK'=>'Sinhala'
);

View file

@ -19,26 +19,36 @@ $storageInfo=OC_Helper::getStorageInfo();
$email=OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
$lang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
$userLang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
$languageCodes=OC_L10N::findAvailableLanguages();
sort ($languageCodes);
//put the current language in the front
unset($languageCodes[array_search($lang, $languageCodes)]);
array_unshift($languageCodes, $lang);
$languageNames=include 'languageCodes.php';
$languages=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
$languages[]=array('code'=>$lang, 'name'=>$l->t('__language_name__'));
$ln=array('code'=>$lang, 'name'=> (string)$l->t('__language_name__'));
}elseif(isset($languageNames[$lang])) {
$languages[]=array('code'=>$lang, 'name'=>$languageNames[$lang]);
$ln=array('code'=>$lang, 'name'=>$languageNames[$lang]);
}else{//fallback to language code
$languages[]=array('code'=>$lang, 'name'=>$lang);
$ln=array('code'=>$lang, 'name'=>$lang);
}
if ($lang === $userLang) {
$userLang = $ln;
} else {
$languages[]=$ln;
}
}
// sort now by displayed language not the iso-code
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/'),