Skip to content

summerblue/baidu-translate-ios-sdk

Repository files navigation

说明

非官方 百度翻译 API iOS SDK.

Credits

截图

使用

使用 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

License

Under the MIT license. See the LICENSE file for more info.

About

百度翻译 iOS SDK (非官方)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published