RMKAzureTranslator 1.0.1

RMKAzureTranslator 1.0.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2017年1月

Rekha Manju Kiran维护。



  • Rekha Manju Kiran

一个简单的 iOS 工具,用于使用微软 Azure 认知服务进行文本翻译

集成步骤

步骤1

在 Azure 认知服务上注册,可遵循此链接中的步骤:Azure 认知服务 并获取 azure 翻译密钥和令牌。

步骤2

Import the "RMKAzureTranslator.h" file into your App Delegate file
Create a pointer for a String containing the obtained azure Key
Call the "initWithAzureKey" method in didFinishLaunchingWithOptions function with the above created pointer.
#import <RMKAzureTranslator/RMKAzureTranslator.h>

static NSString *const RMKAzureTranslatorKey = <Insert-your-azureKey-here>;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    [RMKAzureTranslator initWithAzureKey:RMKAzureTranslatorKey];

    return YES;
}

步骤3

将 "RMKAzureTranslator.h" 文件导入 ViewController,调用 "translateString" 方法,传入要翻译的文本、源字符串的源 ISO 语言代码。– 如果语言未知,请将其设置为 nil,工具将自动检测,以及所需输出的目标 ISO 语言代码。

[[RMKAzureTranslator sharedInstance] translateString:@"Hello, my name is Rekha"
                                            fromLanguage:@"en" toLanguage:@"fr" onCompletion:^(NSString *translatedString, NSError *error)
     {
         if(error)
         {
             NSLog(@"%@",error);
         }
         else
         {
             NSLog(@"%@",translatedString);
         }
     }]

步骤4

运行应用

演示

  1. 进入 RMKAzureTranslatorDemo 目录。
  2. 打开 RMKAzureTranslatorDemo.xcodeproj
  3. 运行应用。

将 RMKAzureTranslator 添加到您的项目中

将以下行添加到您的 Podfile 中

pod 'RMKAzureTranslator' 

贡献

FGTranslator 使用以下项目:

许可证

RMKAzureTranslator 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。