Permalink
Browse files

No translation call if source lang and dest lang are the same.

  • Loading branch information...
1 parent 07b943e commit c971b1cf067eaa024826c30d8450bf00b3685b95 @yoshiokatsuneo committed Nov 24, 2011
Showing with 6 additions and 2 deletions.
  1. +2 −2 CamLingual/CamLingualViewController.m
  2. +4 −0 CamLingual/GoogleTranslateAPI.m
@@ -366,13 +366,13 @@ -(void)startTranslate:(NSString*)ocrText
fNeedConsumeTicket = NO;
}
- [aGoogleTranslateAPI translate:ocrText sourceLang:sourceLang destLang:self.destLang delegate:self];
- // [self showGoogleTranslatePage:ocrText];
destStartLang = self.destLang;
[activityIndicatorView startAnimating];
notificationLabel.text = @"Connecting for translation...";
notificationLabel.hidden = NO;
progressView.hidden = YES;
+ [aGoogleTranslateAPI translate:ocrText sourceLang:sourceLang destLang:self.destLang delegate:self];
+ // [self showGoogleTranslatePage:ocrText];
NSLog(@"%s: end", __FUNCTION__);
}
@@ -112,6 +112,10 @@ -(BOOL)translate:(NSString *)string sourceLang:(NSString*)sourceLang destLang:(N
[self.connection cancel];
self.connection = nil;
}
+ if([sourceLang isEqual:destLang]){
+ [delegate translateDidFinished:self text:string];
+ return YES;
+ }
NSString *apiSourceLang = [langdic objectForKey:sourceLang];
NSString *apiDestLang = [langdic objectForKey:destLang];

0 comments on commit c971b1c

Please sign in to comment.