在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):VictorZhang2014/free-google-translate开源软件地址(OpenSource Url):https://github.com/VictorZhang2014/free-google-translate开源编程语言(OpenSource Language):Python 38.2%开源软件介绍(OpenSource Introduction):Free Google TranslatorFree Google Translate is a tool for google free translation API, the main idea of the repo is coming from the web The Do's and Don'ts
For Python Exampletext = "Hello world"
GoogleTrans().query(text, lang_to='zh-CN') You pass a string of plain text with target language code, then you will get the translated text after requested. the request api will recognize the source language of the text automatically for you. The output will be:
For Objective-C Example on iOSNSString *content = @"Hello world";
NSString *targetLanguage = @"zh-CN";
YLGoogleTranslate *googleTrans = [[YLGoogleTranslate alloc] init];
[googleTrans translateWithText:content targetLanguageCode:targetLanguage completion:^(NSString * _Nullable originalText, NSString * _Nullable originalLanguageCode, NSString * _Nullable translatedText, NSString * _Nullable targetLanguageCode, NSString * _Nullable error) {
if ([error length] > 0) {
NSLog(@"The Request returned error! Error Message: %@", error);
} else {
NSLog(@"The Request returned success!!!!!!");
}
}]; The response data is as same as aforementioned python code. free-google-translateFree Google Translator API 免费的Google翻译,其中的破解思路主要来源于将 https://translate.google.cn 的web访问方式模拟成全部代码的形式来控制api的访问 注意事项
Python使用text = "Hello world"
GoogleTrans().query(text, lang_to='zh-CN') 传入一段待翻译的文本,和目标翻译语言code,然后你就会得到翻译结果,该接口会自动识别输入的语言code 输出结果是:
iOS Objective-C使用NSString *content = @"Hello world";
NSString *targetLanguage = @"zh-CN";
YLGoogleTranslate *googleTrans = [[YLGoogleTranslate alloc] init];
[googleTrans translateWithText:content targetLanguageCode:targetLanguage completion:^(NSString * _Nullable originalText, NSString * _Nullable originalLanguageCode, NSString * _Nullable translatedText, NSString * _Nullable targetLanguageCode, NSString * _Nullable error) {
if ([error length] > 0) {
NSLog(@"调用Google翻译接口返回错误:%@ ", error);
} else {
NSLog(@"调用Google翻译接口返回成功!");
}
}]; 传入一段待翻译的文本,和目标翻译语言code,然后你就会得到翻译结果,该接口会自动识别输入的语言code |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论