@ -326,16 +326,23 @@ public class Translator {
* @return list of language - codes of available / active translations
* /
public static List < String > activeTranslations ( ) {
Switchboard sb = Switchboard . getSwitchboard ( ) ;
File localePath ;
if ( sb ! = null )
final Switchboard sb = Switchboard . getSwitchboard ( ) ;
final File localePath ;
if ( sb ! = null ) {
localePath = sb . getDataPath ( "locale.translated_html" , "DATA/LOCALE/htroot" ) ;
else
} else {
localePath = new File ( "DATA/LOCALE/htroot" ) ;
List < String > dirlist = new ArrayList < String > ( ) ; // get list of language subdirectories
File [ ] list = localePath . listFiles ( ) ;
for ( File f : list ) {
if ( f . isDirectory ( ) ) dirlist . add ( f . getName ( ) ) ; // filter directories to add to result
}
final List < String > dirlist = new ArrayList < String > ( ) ; // get list of language subdirectories
if ( localePath . isDirectory ( ) ) {
final File [ ] list = localePath . listFiles ( ) ;
if ( list ! = null ) { // the list may be null on IO error
for ( final File f : list ) {
if ( f . isDirectory ( ) ) {
dirlist . add ( f . getName ( ) ) ; // filter directories to add to result
}
}
}
}
return dirlist ;
}