//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){
- $languages[]=array('code'=>$lang,'name'=>@$languageNames[$lang]);
+ $l=new OC_L10N('core',$lang);
+ if($l->t('__language_name__')!='__language_name__'){//first check if the language name is in the translation file
+ $languages[]=array('code'=>$lang,'name'=>$l->t('__language_name__'));
+ }elseif(isset($languageNames[$lang])){
+ $languages[]=array('code'=>$lang,'name'=>$languageNames[$lang]);
+ }else{//fallback to language code
+ $languages[]=array('code'=>$lang,'name'=>$lang);
+ }
}
// Return template