Sat, 12 Apr 2014 13:44:53 +0200
fixed locale support on OS X
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resource/locales/de_DE.properties Sat Apr 12 13:44:53 2014 +0200 @@ -0,0 +1,1 @@ +hello = HALLO WELT!
--- a/ui/cocoa/resource.m Fri Apr 11 21:45:24 2014 +0200 +++ b/ui/cocoa/resource.m Sat Apr 12 13:44:53 2014 +0200 @@ -37,16 +37,31 @@ void ui_load_lang_def(char *locale, char *default_locale) { NSString *localeString = nil; - if(locale) { + char tmp[6]; + if(!locale) { + NSString* lang = [[NSLocale currentLocale] localeIdentifier]; + if(lang) { + localeString = lang; + } else { + [[NSString alloc]initWithUTF8String:default_locale]; + } + } else { localeString = [[NSString alloc]initWithUTF8String:locale]; - } else { - localeString = [[NSString alloc]initWithUTF8String:default_locale]; } NSString *path = [[NSBundle mainBundle] pathForResource:localeString ofType:@"properties" inDirectory:@"locales"]; const char *p = [path UTF8String]; - uic_load_language_file((char*)p); + + if(uic_load_language_file((char*)p)) { + if(default_locale) { + ui_load_lang_def(default_locale, NULL); + } else { + // cannot find any language file + fprintf(stderr, "Ui Error: Cannot load language.\n"); + exit(-1); + } + } } void ui_locales_dir(char *path) {