瀏覽代碼

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;
}
Sam Lantinga 11 年之前
父節點
當前提交
a5f52ac5a8
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      src/video/cocoa/SDL_cocoaevents.m

+ 4 - 5
src/video/cocoa/SDL_cocoaevents.m

@@ -125,13 +125,12 @@ static SDLAppDelegate *appDelegate = nil;
 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];