[Adium-devl] [Adium-svn] rev 23077 - trunk/Source

Evan Schoenberg evan.s at dreskin.net
Sun Apr 6 19:01:10 UTC 2008


On Apr 5, 2008, at 11:59 PM, Peter Hosey wrote:

> On Apr 05, 2008, at 19:48:04, evands at adiumx.com wrote:
>> +	preferredLanguage = [[[NSUserDefaults standardUserDefaults]
>> objectForKey:@"AppleLanguages"] objectAtIndex:0];
>
> Wouldn't it make more sense to keep the entire array, and try each
> language in turn? The system may not have a spelling-checker
> dictionary for the user's #1 language.

How about this, which should accomplish the same idea but only require  
trying each language in turn once?

//Find the first language the user prefers which the spellchecker  
knows about, then keep it around for future reference
NSEnumerator *enumerator = [[[NSUserDefaults standardUserDefaults]  
objectForKey:@"AppleLanguages"] objectEnumerator];
NSString	 *language;
while ((language = [enumerator nextObject])) {
	if ([[NSSpellChecker sharedSpellChecker] setLanguage:language]) {
		preferredLanguage = [language retain];
		break;
	}
}


>> +			[[NSSpellChecker sharedSpellChecker]  
>> setLanguage:newChatLanguage];
>
> Statements like this should be conditional (-setLanguage:,
> uncharacteristically for a setter, returns BOOL). Taking care of the
> above would take care of this, too.

What do you mean by making this statement conditional?

Cheers,
Evan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20080406/fa5c7688/attachment-0001.html>


More information about the devel mailing list