Added localizability. Gotta delete you prefs for it to work. Some
authorKent Sutherland <ksuther@ithinksw.com>
Tue, 10 Jun 2003 23:56:54 +0000 (23:56 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Tue, 10 Jun 2003 23:56:54 +0000 (23:56 +0000)
problems with hotkeys and drag and dropping the menu arose, I'll fix
those later

English.lproj/InfoPlist.strings
English.lproj/Localizable.strings [new file with mode: 0755]
MainController.m
MenuController.m
PreferencesController.m
TODO.rtf

index 4763eb9..c3185fe 100755 (executable)
Binary files a/English.lproj/InfoPlist.strings and b/English.lproj/InfoPlist.strings differ
diff --git a/English.lproj/Localizable.strings b/English.lproj/Localizable.strings
new file mode 100755 (executable)
index 0000000..98e9781
--- /dev/null
@@ -0,0 +1,30 @@
+playPause = "Play/Pause";
+play = "Play";
+pause = "Pause";
+resume = "Resume";
+nextTrack = "Next Track";
+prevTrack = "Previous Track";
+fastForward = "Fast Forward";
+rewind = "Rewind";
+showPlayer = "Show Player";
+show = "Show";
+preferences = "Preferences...";
+quit = "Quit";
+trackInfo = "Current Track Info";
+nowPlaying = "Now Playing";
+noSong = "No Song";
+track = "Track";
+separator = "<separator>";
+songRating = "Song Rating";
+upcomingSongs = "Upcoming Songs";
+playlists = "Playlists";
+eqPresets = "EQ Presets";
+open = "Open";
+noSongPlaying = "No song is playing.";
+noUpcomingSongs = "No upcoming songs.";
+autolaunch = "Auto-launch MenuTunes";
+autolaunch_msg = "Would you like MenuTunes to automatically launch at login?";
+duplicateCombo = "Duplicate Key Combo";
+duplicateCombo_msg = "The specified key combo is already in use...";
+replace = "Replace";
+cancel = "Cancel";
\ No newline at end of file
index 16738a3..e219f30 100755 (executable)
@@ -251,7 +251,7 @@ static MainController *sharedController;
         [currentRemote showPrimaryInterface];
     } else {
         if (![[NSWorkspace sharedWorkspace] launchApplication:[currentRemote playerFullName]]) {
-            NSLog(@"Error Launching Player");
+            NSLog(@"MenuTunes: Error Launching Player");
         }
     }
 }
@@ -420,7 +420,7 @@ static MainController *sharedController;
                                              trackTotal:trackTotal
                                                  rating:rating];
     } else {
-        title = @"No song is playing.";
+        title = NSLocalizedString(@"noSongPlaying", @"No song is playing.");
         [statusWindowController showSongWindowWithTitle:title
                                                   album:nil
                                                  artist:nil
@@ -451,7 +451,7 @@ static MainController *sharedController;
         [statusWindowController showUpcomingSongsWithTitles:songList];
         
     } else {
-        [statusWindowController showUpcomingSongsWithTitles:[NSArray arrayWithObject:@"No upcoming songs."]];
+        [statusWindowController showUpcomingSongsWithTitles:[NSArray arrayWithObject:NSLocalizedString(@"noUpcomingSongs", @"No upcoming songs.")]];
     }
 }
 
index 801e5ed..96767ab 100755 (executable)
@@ -65,8 +65,8 @@
     //create our menu
     while ( (nextObject = [enumerator nextObject]) ) {
         //Main menu items
-        if ([nextObject isEqualToString:@"Play/Pause"]) {
-            tempItem = [menu addItemWithTitle:@"Play"
+        if ([nextObject isEqualToString:@"playPause"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"play", @"Play")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuPlayPauseItem];
             
             switch ([currentRemote playerPlayingState]) {
                 case ITMTRemotePlayerPlaying:
-                    [tempItem setTitle:@"Pause"];
+                    [tempItem setTitle:NSLocalizedString(@"pause", @"Pause")];
                 break;
                 case ITMTRemotePlayerRewinding:
                 case ITMTRemotePlayerForwarding:
-                    [tempItem setTitle:@"Resume"];
+                    [tempItem setTitle:NSLocalizedString(@"resume", @"Resume")];
                 break;
                 default:
                 break;
             }
-        } else if ([nextObject isEqualToString:@"Next Track"]) {
-            tempItem = [menu addItemWithTitle:@"Next Track"
+        } else if ([nextObject isEqualToString:@"nextTrack"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"nextTrack", @"Next Track")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             
                 [tempItem setTag:MTMenuNextTrackItem];
                 [tempItem setTarget:self];
             }
-        } else if ([nextObject isEqualToString:@"Previous Track"]) {
-            tempItem = [menu addItemWithTitle:@"Previous Track"
+        } else if ([nextObject isEqualToString:@"prevTrack"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"prevTrack", @"Previous Track")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             
                 [tempItem setTag:MTMenuPreviousTrackItem];
                 [tempItem setTarget:self];
             }
-        } else if ([nextObject isEqualToString:@"Fast Forward"]) {
-            tempItem = [menu addItemWithTitle:@"Fast Forward"
+        } else if ([nextObject isEqualToString:@"fastForward"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"fastForward", @"Fast Forward")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             if (_currentPlaylist) {
                 [tempItem setTag:MTMenuFastForwardItem];
                 [tempItem setTarget:self];
             }
-        } else if ([nextObject isEqualToString:@"Rewind"]) {
-            tempItem = [menu addItemWithTitle:@"Rewind"
+        } else if ([nextObject isEqualToString:@"rewind"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"rewind", @"Rewind")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             if (_currentPlaylist) {
                 [tempItem setTag:MTMenuRewindItem];
                 [tempItem setTarget:self];
             }
-        } else if ([nextObject isEqualToString:@"Show Player"]) {
-            tempItem = [menu addItemWithTitle:[NSString stringWithFormat:@"Show %@", [[[MainController sharedController] currentRemote] playerSimpleName]] action:@selector(performMainMenuAction:) keyEquivalent:@""];
+        } else if ([nextObject isEqualToString:@"showPlayer"]) {
+            tempItem = [menu addItemWithTitle:[NSString stringWithFormat:@"%@ %@",
+                            NSLocalizedString(@"show", @"Show"),
+                            [[[MainController sharedController] currentRemote] playerSimpleName]]
+                    action:@selector(performMainMenuAction:)
+                    keyEquivalent:@""];
             
             if ( (keyCombo = [[HotKeyCenter sharedCenter] keyComboForName:@"ShowPlayer"]) ) {
                 [self setKeyEquivalentForCode:[keyCombo keyCode]
             
             [tempItem setTarget:self];
             [tempItem setTag:MTMenuShowPlayerItem];
-        } else if ([nextObject isEqualToString:@"Preferences"]) {
-            tempItem = [menu addItemWithTitle:@"Preferences..."
+        } else if ([nextObject isEqualToString:@"preferences"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"preferences", @"Preferences...")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuPreferencesItem];
             [tempItem setTarget:self];
-        } else if ([nextObject isEqualToString:@"Quit"]) {
-            tempItem = [menu addItemWithTitle:@"Quit"
+        } else if ([nextObject isEqualToString:@"quit"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"quit", @"Quit")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuQuitItem];
             [tempItem setTarget:self];
-        } else if ([nextObject isEqualToString:@"Current Track Info"]) {
+        } else if ([nextObject isEqualToString:@"trackInfo"]) {
             //Handle playing radio too
             if (_currentPlaylist) {
                 NSString *title = [currentRemote currentSongTitle];
                 
-                [menu addItemWithTitle:@"Now Playing" action:NULL keyEquivalent:@""];
+                [menu addItemWithTitle:NSLocalizedString(@"nowPlaying", @"Now Playing") action:NULL keyEquivalent:@""];
                 
                 if ([title length] > 0) {
                     [menu addItemWithTitle:[NSString stringWithFormat:@"        %@", title]
                 if ([defaults boolForKey:@"showTrackNumber"]) {
                     int track = [currentRemote currentSongTrack];
                     if (track) {
-                        [menu addItemWithTitle:[NSString stringWithFormat:@"    Track %i", track]
+                        [menu addItemWithTitle:[NSString stringWithFormat:@"    %@ %i", NSLocalizedString(@"track", @"Track"), track]
                             action:nil
                             keyEquivalent:@""];
                     }
                             keyEquivalent:@""];
                 }
             } else {
-                [menu addItemWithTitle:@"No Song" action:NULL keyEquivalent:@""];
+                [menu addItemWithTitle:NSLocalizedString(@"noSong", @"No Song") action:NULL keyEquivalent:@""];
             }
-        } else if ([nextObject isEqualToString:@"<separator>"]) {
+        } else if ([nextObject isEqualToString:@"separator"]) {
             [menu addItem:[NSMenuItem separatorItem]];
         //Submenu items
-        } else if ([nextObject isEqualToString:@"Song Rating"]) {
-            tempItem = [menu addItemWithTitle:@"Song Rating"
+        } else if ([nextObject isEqualToString:@"songRating"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"songRating", @"Song Rating")
                     action:nil
                     keyEquivalent:@""];
             [tempItem setSubmenu:_ratingMenu];
             }
             
             [[_ratingMenu itemAtIndex:([currentRemote currentSongRating] * 5)] setState:NSOnState];
-        } else if ([nextObject isEqualToString:@"Upcoming Songs"]) {
-            tempItem = [menu addItemWithTitle:@"Upcoming Songs"
+        } else if ([nextObject isEqualToString:@"upcomingSongs"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"upcomingSongs", @"Upcoming Songs")
                     action:nil
                     keyEquivalent:@""];
             [tempItem setSubmenu:_upcomingSongsMenu];
             if (_playingRadio || !_currentPlaylist) {
                 [tempItem setEnabled:NO];
             }
-        } else if ([nextObject isEqualToString:@"Playlists"]) {
-            tempItem = [menu addItemWithTitle:@"Playlists"
+        } else if ([nextObject isEqualToString:@"playlists"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"playlists", @"Playlists")
                     action:nil
                     keyEquivalent:@""];
             [tempItem setSubmenu:_playlistsMenu];
             [tempItem setTag:3];
-        } else if ([nextObject isEqualToString:@"EQ Presets"]) {
-            tempItem = [menu addItemWithTitle:@"EQ Presets"
+        } else if ([nextObject isEqualToString:@"eqPresets"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"eqPresets", @"EQ Presets")
                     action:nil
                     keyEquivalent:@""];
             [tempItem setSubmenu:_eqMenu];
 {
     NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
     NSMenuItem *tempItem;
-    tempItem = [menu addItemWithTitle:[NSString stringWithFormat:@"Open %@", [[[MainController sharedController] currentRemote] playerSimpleName]] action:@selector(performMainMenuAction:) keyEquivalent:@""];
+    tempItem = [menu addItemWithTitle:[NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"open", @"Open"), [[[MainController sharedController] currentRemote] playerSimpleName]] action:@selector(performMainMenuAction:) keyEquivalent:@""];
     [tempItem setTag:MTMenuShowPlayerItem];
     [tempItem setTarget:self];
     [menu addItem:[NSMenuItem separatorItem]];
-    tempItem = [menu addItemWithTitle:@"Preferences" action:@selector(performMainMenuAction:) keyEquivalent:@""];
+    tempItem = [menu addItemWithTitle:NSLocalizedString(@"preferences", @"Preferences...") action:@selector(performMainMenuAction:) keyEquivalent:@""];
     [tempItem setTag:MTMenuPreferencesItem];
     [tempItem setTarget:self];
-    tempItem = [menu addItemWithTitle:@"Quit" action:@selector(performMainMenuAction:) keyEquivalent:@""];
+    tempItem = [menu addItemWithTitle:NSLocalizedString(@"quit", @"Quit") action:@selector(performMainMenuAction:) keyEquivalent:@""];
     [tempItem setTag:MTMenuQuitItem];
     [tempItem setTarget:self];
     return [menu autorelease];
index cc341e9..e1c47d1 100755 (executable)
@@ -207,21 +207,22 @@ static PreferencesController *prefs = nil;
     id anItem;
 
     [df setObject:[NSArray arrayWithObjects:
-        @"Play/Pause",
-        @"Next Track",
-        @"Previous Track",
-        @"Fast Forward",
-        @"Rewind",
-        @"Show Player",
-        @"<separator>",
-        @"Upcoming Songs",
-        @"Playlists",
-        @"Song Rating",
-        @"<separator>",
-        @"Preferences",
-        @"Quit",
-        @"<separator>",
-        @"Current Track Info",
+        @"playPause",
+        @"nextTrack",
+        @"prevTrack",
+        @"fastForward",
+        @"rewind",
+        @"showPlayer",
+        @"separator",
+        @"songRating",
+        @"eqPresets",
+        @"playlists",
+        @"upcomingSongs",
+        @"separator",
+        @"preferences",
+        @"quit",
+        @"separator",
+        @"trackInfo",
         nil] forKey:@"menu"];
 
     [df setInteger:5 forKey:@"SongsInAdvance"];
@@ -247,7 +248,7 @@ static PreferencesController *prefs = nil;
     // This is teh sux
     // We must fix it so it is no longer suxy
     if (!found) {
-        if (NSRunInformationalAlertPanel(@"Auto-launch MenuTunes", @"Would you like MenuTunes to automatically launch at login?", @"Yes", @"No", nil) == NSOKButton) {
+        if (NSRunInformationalAlertPanel(NSLocalizedString(@"autolaunch", @"Auto-launch MenuTunes"), NSLocalizedString(@"autolaunch_msg", @"Would you like MenuTunes to automatically launch at login?"), @"Yes", @"No", nil) == NSOKButton) {
             AEDesc scriptDesc, resultDesc;
             NSString *script = [NSString stringWithFormat:@"tell application \"System Events\"\nmake new login item at end of login items with properties {path:\"%@\", kind:\"APPLICATION\"}\nend tell", [[NSBundle mainBundle] bundlePath]];
             ComponentInstance asComponent = OpenDefaultComponent(kOSAComponentType, kAppleScriptSubtype);
@@ -292,7 +293,7 @@ static PreferencesController *prefs = nil;
             if (![combo isEqual:[KeyCombo clearKeyCombo]] &&
                  [combo isEqual:[hotKeysDictionary objectForKey:enumKey]]) {
                 [window setLevel:NSNormalWindowLevel];
-                if ( NSRunAlertPanel(@"Duplicate Key Combo", @"The specified key combo is already in use...", @"Replace", @"Cancel", nil) ) {
+                if ( NSRunAlertPanel(NSLocalizedString(@"duplicateCombo", @"Duplicate Key Combo") , NSLocalizedString(@"duplicateCombo_msg", @"The specified key combo is already in use..."), NSLocalizedString(@"replace", @"Replace"), NSLocalizedString(@"cancel", @"Cancel"), nil) ) {
                     [hotKeysDictionary setObject:[KeyCombo clearKeyCombo] forKey:currentHotKey];
                     if ([enumKey isEqualToString:@"PlayPause"]) {
                         [playPauseButton setTitle:@""];
@@ -421,8 +422,8 @@ static PreferencesController *prefs = nil;
 
 - (void)setupWindow
 {
-    if ( ! [NSBundle loadNibNamed:@"Preferences" owner:self] ) {
-        NSLog( @"Failed to load Preferences.nib" );
+    if (![NSBundle loadNibNamed:@"Preferences" owner:self]) {
+        NSLog(@"MenuTunes: Failed to load Preferences.nib");
         NSBeep();
         return;
     }
@@ -454,18 +455,18 @@ static PreferencesController *prefs = nil;
     id            anItem;
     // Set the list of items you can have.
     availableItems = [[NSMutableArray alloc] initWithObjects:
-        @"Current Track Info",
-        @"Upcoming Songs",
-        @"Playlists",
-        @"EQ Presets",
-        @"Song Rating",
-        @"Play/Pause",
-        @"Next Track",
-        @"Previous Track",
-        @"Fast Forward",
-        @"Rewind",
-        @"Show Player",
-        @"<separator>",
+        @"trackInfo",
+        @"upcomingSongs",
+        @"playlists",
+        @"eqPresets",
+        @"songRating",
+        @"playPause",
+        @"nextTrack",
+        @"prevTrack",
+        @"fastForward",
+        @"rewind",
+        @"showPlayer",
+        @"separator",
         nil];
     
     // Get our preferred menu
@@ -474,17 +475,17 @@ static PreferencesController *prefs = nil;
     // Delete items in the availableItems array that are already part of the menu
     itemEnum = [myItems objectEnumerator];
     while ( (anItem = [itemEnum nextObject]) ) {
-        if ( ! [anItem isEqualToString:@"<separator>"] ) {
+        if (![anItem isEqualToString:@"separator"]) {
             [availableItems removeObject:anItem];
         }
     }
     
     // Items that show should a submenu image
     submenuItems = [[NSArray alloc] initWithObjects:
-        @"Upcoming Songs",
-        @"Playlists",
-        @"EQ Presets",
-        @"Song Rating",
+        @"upcomingSongs",
+        @"playlists",
+        @"eqPresets",
+        @"songRating",
         nil];
 }
 
@@ -499,7 +500,7 @@ static PreferencesController *prefs = nil;
     [songsInAdvance setIntValue:[df integerForKey:@"SongsInAdvance"]];
     
     // Fill in hot key buttons
-    if ([df objectForKey:@"PlayPause"]){
+    if ([df objectForKey:@"PlayPause"]) {
         anItem = [df keyComboForKey:@"PlayPause"];
         [hotKeysDictionary setObject:anItem forKey:@"PlayPause"];
         [playPauseButton setTitle:[anItem userDisplayRep]];
@@ -709,9 +710,9 @@ static PreferencesController *prefs = nil;
         if ([[aTableColumn identifier] isEqualToString:@"name"]) {
             NSString *object = [myItems objectAtIndex:rowIndex];
             if ([object isEqualToString:@"Show Player"]) {
-                return [NSString stringWithFormat:@"Show %@", [[controller currentRemote] playerSimpleName]];
+                return [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"show", @"Show"), [[controller currentRemote] playerSimpleName]];
             }
-            return object;
+            return NSLocalizedString(object, @"ERROR");
         } else {
             if ([submenuItems containsObject:[myItems objectAtIndex:rowIndex]])
             {
@@ -722,7 +723,7 @@ static PreferencesController *prefs = nil;
         }
     } else {
         if ([[aTableColumn identifier] isEqualToString:@"name"]) {
-            return [availableItems objectAtIndex:rowIndex];
+            return NSLocalizedString([availableItems objectAtIndex:rowIndex], @"ERROR");
         } else {
             if ([submenuItems containsObject:[availableItems objectAtIndex:rowIndex]]) {
                 return [NSImage imageNamed:@"submenu"];
@@ -770,7 +771,7 @@ static PreferencesController *prefs = nil;
                 [myItems insertObject:temp atIndex:row];
             }
         } else {
-            if (![temp isEqualToString:@"<separator>"]) {
+            if (![temp isEqualToString:@"separator"]) {
                 [availableItems addObject:temp];
             }
         }
@@ -779,7 +780,7 @@ static PreferencesController *prefs = nil;
         dragRow = [dragData intValue];
         temp = [availableItems objectAtIndex:dragRow];
         
-        if (![temp isEqualToString:@"<separator>"]) {
+        if (![temp isEqualToString:@"separator"]) {
             [availableItems removeObjectAtIndex:dragRow];
         }
         [myItems insertObject:temp atIndex:row];
index eaac4d1..70fdaca 100755 (executable)
--- a/TODO.rtf
+++ b/TODO.rtf
@@ -9,6 +9,9 @@
 \f1\b0\fs28 In lieu of BugZilla, this file has been added to the MenuTunes project, at its root level, above all groups.  It will be treated like a bug list.  Do not modify without authorization from Matt.
 \f2\fs20 \
 \
+Everywhere:\
+Make localizable (in NewMainController DONE, PreferencesController, MenuController is DONE)\
+\
 MainController:\
 Hot keys need to work with FKeys and no modifier\
 Make status windows work\
@@ -18,6 +21,8 @@ Space key equivalent needs to show up\
 \
 PreferencesController:\
 Do we want that preferences checkbox "Launch iTunes When MenuTunes Launches"? It isn't very pluginesque and I think our menu saying launch player is good enough.\
+May have some hotkey setting problems\
+Crashes when trying to reorder the menu\
 \
 iTunesRemote:\
 -showPrimaryInterface doesn't show the browser window it and unminimize it\