My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#import <Foundation/NSOrthography.h>
#import <Foundation/NSRaise.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>

@implementation NSOrthography

+orthographyWithDominantScript:(NSString *)script languageMap:(NSDictionary *)languageMap {
return [[[self alloc] initWithDominantScript:script languageMap:languageMap] autorelease];
}

-initWithDominantScript:(NSString *)script languageMap:(NSDictionary *)languageMap {
_dominantScript=[script copy];
_languageMap=[languageMap copy];
return self;
}

-(void)dealloc {
[_dominantScript release];
[_languageMap release];
[super dealloc];
}

-(NSDictionary *)languageMap {
return _languageMap;
}

-(NSArray *)allLanguages {
NSMutableArray *result=[NSMutableArray array];

for(NSArray *entry in [_languageMap allValues])
[result addObjectsFromArray: entry];

return result;
}

-(NSArray *)allScripts {
return [_languageMap allKeys];
}

-(NSString *)dominantLanguage {
NSArray *languages=[_languageMap objectForKey:[self dominantScript]];

return [languages count]?[languages objectAtIndex:0]:nil;
}

-(NSString *)dominantScript {
return _dominantScript;
}

-(NSString *)dominantLanguageForScript:(NSString *)script {
NSArray *languages=[_languageMap objectForKey:[self dominantScript]];

return [languages count]?[languages objectAtIndex:0]:nil;
}

-(NSArray *)languagesForScript:(NSString *)script {
return [_languageMap objectForKey:script];
}

@end

Change log

a742f3612454 by Christopher Lloyd <c...@objc.net> on Sep 6, 2011   Diff
wire spell engine into textview
Go to: 
Project members, sign in to write a code review

Older revisions

dcf86a985be1 by Christopher Lloyd <c...@objc.net> on Aug 21, 2011   Diff
Rough in some spell checker classes
and clean up warnings
All revisions of this file

File info

Size: 1495 bytes, 61 lines
Powered by Google Project Hosting