]> source.dussan.org Git - nextcloud-server.git/commitdiff
make language name translatable and fallback to language code if we dont have the...
authorRobin Appelman <icewind@owncloud.com>
Sun, 15 Jan 2012 14:25:58 +0000 (15:25 +0100)
committerRobin Appelman <icewind@owncloud.com>
Sun, 15 Jan 2012 14:25:58 +0000 (15:25 +0100)
settings/personal.php

index 7035f1b07d42c7a89035130d7f7468dc1b137637..8d05b14a353124e6346f96f7f38af606087407a8 100755 (executable)
@@ -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