Fixed bug 2395 - OSX: App name in the menu bar is not localized.
authorSam Lantinga <slouken@libsdl.org>
Sat, 22 Feb 2014 17:32:18 -0800
changeset 8237 6cc44a5d9eef
parent 8236 751605725282
child 8238 9e09e1561e00
Fixed bug 2395 - OSX: App name in the menu bar is not localized. Tim McDaniel On OSX, the app name in the menu bar is not localized. This can be fixed using the following implementation for GetApplicationName in SDL_cocoaevents.m: static NSString * GetApplicationName(void) { NSDictionary *dict; NSString *appName = 0; appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; if (!appName) appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]; if (![appName length]) appName = [[NSProcessInfo processInfo] processName]; return appName; }
src/video/cocoa/SDL_cocoaevents.m
--- a/src/video/cocoa/SDL_cocoaevents.m	Sat Feb 22 15:34:31 2014 -0800
+++ b/src/video/cocoa/SDL_cocoaevents.m	Sat Feb 22 17:32:18 2014 -0800
@@ -125,13 +125,12 @@
 static NSString *
 GetApplicationName(void)
 {
-    NSDictionary *dict;
-    NSString *appName = 0;
+    NSString *appName;
 
     /* Determine the application name */
-    dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
-    if (dict)
-        appName = [dict objectForKey: @"CFBundleName"];
+    appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
+    if (!appName)
+        appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
 
     if (![appName length])
         appName = [[NSProcessInfo processInfo] processName];