C# Class Westwind.Globalization.TranslationServices

Provides basic translation features via several Web interfaces NOTE: These services may change their format or otherwise fail.
Afficher le fichier Open project: RickStrahl/Westwind.Globalization Class Usage Examples

Méthodes publiques

Méthode Description
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

Method Details

GetBingAuthToken() public méthode

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
Résultat string

TranslateBing() public méthode

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
Résultat string

TranslateGoogle() public méthode

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
Résultat string

TranslateGoogleApi() public méthode

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
Résultat string