From 64a5afb5e0c5741fa4b8e064dc6ec71e3f586cea Mon Sep 17 00:00:00 2001 From: Jeena Paradies Date: Thu, 1 Dec 2011 16:21:13 +0100 Subject: [PATCH] start with last chosen language --- SpeakerAppDelegate.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/SpeakerAppDelegate.m b/SpeakerAppDelegate.m index 381c3b1..c2b5946 100644 --- a/SpeakerAppDelegate.m +++ b/SpeakerAppDelegate.m @@ -50,10 +50,6 @@ for (NSInteger i = 0; i < [voices count]; i++) { NSDictionary *dict = [NSSpeechSynthesizer attributesForVoice:[voices objectAtIndex:i]]; - if (i == 0) { - NSLog(@"%@", dict); - } - NSString *country = [currentLocale displayNameForKey:NSLocaleIdentifier value:[dict objectForKey:@"VoiceLocaleIdentifier"]]; NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@", country, [dict objectForKey:@"VoiceName"]] action:@selector(changeLanguage:) keyEquivalent:@""]; @@ -67,7 +63,7 @@ } } - [self.languageMenuPopupButton selectItemAtIndex:start]; + [self changeLanguage:[self.languageMenu itemAtIndex:start]]; } - (void)changeLanguage:(id)sender @@ -75,8 +71,8 @@ NSInteger index = [(NSMenuItem *)sender tag]; NSString *voice = [[NSSpeechSynthesizer attributesForVoice:[[NSSpeechSynthesizer availableVoices] objectAtIndex:index]] objectForKey:@"VoiceIdentifier"]; [synth setVoice:voice]; - [[NSUserDefaults standardUserDefaults] setInteger:index forKey:@"languageVoiceIndex"]; + [[NSUserDefaults standardUserDefaults] setInteger:index forKey:@"languageVoiceIndex"]; [self.languageMenuPopupButton selectItemAtIndex:index]; }