C# 클래스 Westwind.Globalization.TranslationServices

Provides basic translation features via several Web interfaces NOTE: These services may change their format or otherwise fail.
파일 보기 프로젝트 열기: RickStrahl/Westwind.Globalization 1 사용 예제들

공개 메소드들

메소드 설명
GetBingAuthToken ( string clientId = null, string clientSecret = null ) : string

Retrieves an oAuth authentication token to be used on the translate API request. The result string needs to be passed as a bearer token to the translate API. You can find client ID and Secret (or register a new one) at: https://datamarket.azure.com/developer/applications/

TranslateBing ( string text, string fromCulture, string toCulture, string accessToken = null ) : string

Uses the Bing API service to perform translation Bing can translate up to 1000 characters. Requires that you provide a CLientId and ClientSecret or set the configuration values for these two. More info on setup: http://weblog.west-wind.com/posts/2013/Jun/06/Setting-up-and-using-Bing-Translate-API-Service-for-Machine-Translation

TranslateGoogle ( string text, string fromCulture, string toCulture, string googleApiKey = null ) : string

Translates a string into another language using Google's translate API JSON calls. Class TranslationServices

TranslateGoogleApi ( string text, string fromCulture, string toCulture, string googleApiKey = null ) : string

Translates a string into another language using Google's translate API JSON calls. Class TranslationServices

메소드 상세

GetBingAuthToken() 공개 메소드

Retrieves an oAuth authentication token to be used on the translate API request. The result string needs to be passed as a bearer token to the translate API. You can find client ID and Secret (or register a new one) at: https://datamarket.azure.com/developer/applications/
public GetBingAuthToken ( string clientId = null, string clientSecret = null ) : string
clientId string The client ID of your application
clientSecret string The client secret or password
리턴 string

TranslateBing() 공개 메소드

Uses the Bing API service to perform translation Bing can translate up to 1000 characters. Requires that you provide a CLientId and ClientSecret or set the configuration values for these two. More info on setup: http://weblog.west-wind.com/posts/2013/Jun/06/Setting-up-and-using-Bing-Translate-API-Service-for-Machine-Translation
public TranslateBing ( string text, string fromCulture, string toCulture, string accessToken = null ) : string
text string Text to translate
fromCulture string Two letter culture name
toCulture string Two letter culture name
accessToken string Pass an access token retrieved with GetBingAuthToken. /// If not passed the default keys from .config file are used if any
리턴 string

TranslateGoogle() 공개 메소드

Translates a string into another language using Google's translate API JSON calls. Class TranslationServices
public TranslateGoogle ( string text, string fromCulture, string toCulture, string googleApiKey = null ) : string
text string
fromCulture string
toCulture string
googleApiKey string Google Api key - if not specified it's read from the configuration
리턴 string

TranslateGoogleApi() 공개 메소드

Translates a string into another language using Google's translate API JSON calls. Class TranslationServices
public TranslateGoogleApi ( string text, string fromCulture, string toCulture, string googleApiKey = null ) : string
text string
fromCulture string
toCulture string
googleApiKey string Google Api key - if not specified it's read from the configuration
리턴 string