make language name translatable and fallback to language code if we dont have the language name
This commit is contained in:
parent
7cd809b286
commit
37c0b97b3c
|
@ -28,10 +28,18 @@ $languageCodes=OC_L10N::findAvailableLanguages();
|
|||
//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
|
||||
|
|
Loading…
Reference in New Issue