@ -1217,18 +1217,20 @@ void InitializeLanguagePacks(void)
int n ;
int n ;
int m ;
int m ;
int def ;
int def ;
int def2 ;
int fallback ;
int fallback ;
LanguagePack hdr ;
LanguagePack hdr ;
FILE * in ;
FILE * in ;
char * files [ 32 ] ;
char * files [ 32 ] ;
const char * lang ;
char lang [ ] = " en " ;
lang = GetCurrentLocale ( " LC_MESSAGES " ) ;
const char * env = GetCurrentLocale ( " LC_MESSAGES " ) ;
if ( lang = = NULL ) lang = " en_GB " ;
if ( env ! = NULL ) snprintf ( lang , lengthof ( lang ) , " %.2s " , env ) ;
n = GetLanguageList ( files , lengthof ( files ) ) ;
n = GetLanguageList ( files , lengthof ( files ) ) ;
def = - 1 ;
def = - 1 ;
def2 = - 1 ;
fallback = 0 ;
fallback = 0 ;
// go through the language files and make sure that they are valid.
// go through the language files and make sure that they are valid.
@ -1249,12 +1251,13 @@ void InitializeLanguagePacks(void)
dl - > ent [ m ] . file = files [ i ] ;
dl - > ent [ m ] . file = files [ i ] ;
dl - > ent [ m ] . name = strdup ( hdr . name ) ;
dl - > ent [ m ] . name = strdup ( hdr . name ) ;
if ( strcmp ( hdr . name , " English " ) = = 0 ) fallback = m ;
if ( strcmp ( hdr . isocode , " en_GB " ) = = 0 ) fallback = m ;
if ( strncmp ( hdr . isocode , lang , 2 ) = = 0 ) def = m ;
if ( strncmp ( hdr . isocode , lang , 2 ) = = 0 ) def2 = m ;
if ( strncmp ( hdr . isocode , lang , 5 ) = = 0 ) def = m ;
m + + ;
m + + ;
}
}
if ( def = = - 1 ) def = fallback ;
if ( def = = - 1 ) def = ( def2 ! = - 1 ? def2 : fallback ) ;
if ( m = = 0 )
if ( m = = 0 )
error ( n = = 0 ? " No available language packs " : " Invalid version of language packs " ) ;
error ( n = = 0 ? " No available language packs " : " Invalid version of language packs " ) ;