非官方 百度翻译 API iOS SDK.
使用 Cocoapod 安装:
pod 'BaiduTranslate', :git => "https://github.com/summerblue/baidu-translate-ios-sdk.git"
#warning 这里填写百度 API 的 KEY
[BaiduTranslate setupBaiduClientKey:@"REPLACE ME WITH KEY"];
BTResultBlock callback = ^(TranslationEntity *translation, NSError *error) {
if (!error)
{
if (translation)
{
self.textView.text = translation.result;
NSLog(@"Translation Result --> %@", translation);
}
}
else
{
NSLog(@"------------ Translate, Error Occur -----------");
NSLog(@"-- Error %@", error);
}
};
[BaiduTranslate translate:@"今天天气不错." callback:callback];
$ git clone https://github.com/summerblue/baidu-translate-ios-sdk.git
$ cd baidu-translate-ios-sdk/
$ pod install
pod 安装成功后
$ open BaiduTranslateExample.xcworkspace
Under the MIT license. See the LICENSE file for more info.