Getting Google translate API for iPhone
Asked Answered
C

5

5

I want to use Google translate API from the iPhone.

What I found is : http://code.google.com/p/gdata-objectivec-client/

but in the list I cannot see the translate API.

Where can I find the library?

Covering answered 8/12, 2009 at 15:39 Comment(0)
A
4

The Google Language API is provided as a web service. For non-javascript environments, you should be using JSON to communicate with Google's servers.

There doesn't seem to be an Objective-C wrapper to this functionality (like the ones you posted), so you'll have to roll your own. Thankfully, JSON is pretty easy to use on the iPhone.

Aghast answered 8/12, 2009 at 16:3 Comment(0)
S
10

I writed an objective-c wrapper for Google Translator service named PLTranslator. check it out at http://github.com/xhan/PLTranslator

Slovak answered 12/10, 2010 at 9:11 Comment(0)
A
4

The Google Language API is provided as a web service. For non-javascript environments, you should be using JSON to communicate with Google's servers.

There doesn't seem to be an Objective-C wrapper to this functionality (like the ones you posted), so you'll have to roll your own. Thankfully, JSON is pretty easy to use on the iPhone.

Aghast answered 8/12, 2009 at 16:3 Comment(0)
C
0

You can use Stig Brautaset’s JSON library (version 2.2), which provides functionality for parsing and generating JSON. The JSON response from Google Translate is well formatted with no line breaks, so you can use NSScanner too.

Candelabrum answered 19/3, 2010 at 16:38 Comment(0)
N
0

Once you get your Google keys just plug it into FGTranslator.

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

[translator translateText:@"Bonjour!" 
               completion:^(NSError *error, NSString *translated, NSString *sourceLanguage)
{
    if (error)
        NSLog(@"translation failed with error: %@", error);
    else
        NSLog(@"translated from %@: %@", sourceLanguage, translated);
}];
Nakia answered 3/9, 2014 at 19:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.