Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use the Google Translate api with iOS?

How do I use the google translate API with iOS 6.0? I have tried googling the documentation and tried to research it, but I can't find anything that is updated since google made the api to be no longer free.

The only thing I have been able to find was this, but it didn't really help much because I need to use the api key that I have, but I have no idea how to.

http://www.raywenderlich.com/1448/how-to-translate-text-with-google-translate-and-json-on-the-iphone

like image 508
Rob Smith Avatar asked Dec 06 '12 23:12

Rob Smith


2 Answers

This seems up to date: https://developers.google.com/translate/v2/getting_started

(completely meta: Oops! Your answer couldn't be submitted because: body must be at least 30 characters; you entered 23)

like image 87
Minthos Avatar answered Oct 23 '22 15:10

Minthos


Yes, it is. Once you get your Google key, just plug it into FGTranslator. Note, generate a "server" key, since the Google Translate API does not currently support iOS keys.

It's just a one-line call to the translate function after that.

FGTranslator *translator = [[FGTranslator alloc] initWithGoogleAPIKey:@"your_google_key"];

[translator translateText:@"Bonjour!" 
               completion:^(NSError *error, NSString *translated, NSString *sourceLanguage)
{
    NSLog(@"translated from %@: %@", sourceLanguage, translated);
}]; 
like image 29
George Avatar answered Oct 23 '22 15:10

George