C# Class MicrosoftTranslatorManager, SmartLocalization

Mostrar archivo Open project: NiklasBorglund/SmartLocalization Class Usage Examples

Public Methods

Method Description
AcceptAllCertifications ( object sender, System certification, System chain, System sslPolicyErrors ) : bool
GetAccessToken ( string cliendID, string clientSecret ) : void

Gets the access token.(Async) will set the IsInitialized Variable when done

TranslateArray ( List textsToTranslate, string languageFrom, string languageTo, List keys, TranslateCompleteArrayCallback callbackMethod ) : void
TranslateText ( string textToTranslate, string languageFrom, string languageTo, string key, TranslateCompleteCallback callbackMethod ) : void

Translates the text.

Private Methods

Method Description
GetAllTranslationLanguages ( ) : void

Gets a list of all the languages available in the Microsoft Translator API

GetResponseCallback ( IAsyncResult ar ) : void

Gets the response callback for authentication

RequestStreamReady ( IAsyncResult ar ) : void

Makes the request to the server for the authorization.

TranslationReady ( IAsyncResult ar ) : void

Recieves the translation and invokes the callback method sending the translated value

Method Details

AcceptAllCertifications() public method

public AcceptAllCertifications ( object sender, System certification, System chain, System sslPolicyErrors ) : bool
sender object
certification System
chain System
sslPolicyErrors System
return bool

GetAccessToken() public method

Gets the access token.(Async) will set the IsInitialized Variable when done
public GetAccessToken ( string cliendID, string clientSecret ) : void
cliendID string /// Cliend I. ///
clientSecret string /// Client secret. ///
return void

TranslateArray() public method

public TranslateArray ( List textsToTranslate, string languageFrom, string languageTo, List keys, TranslateCompleteArrayCallback callbackMethod ) : void
textsToTranslate List
languageFrom string
languageTo string
keys List
callbackMethod TranslateCompleteArrayCallback
return void

TranslateText() public method

Translates the text.
public TranslateText ( string textToTranslate, string languageFrom, string languageTo, string key, TranslateCompleteCallback callbackMethod ) : void
textToTranslate string /// Text to translate. ///
languageFrom string /// Language from. ///
languageTo string /// Language to. ///
key string /// Key. This value will be returned in the callback ///
callbackMethod TranslateCompleteCallback /// Callback method. ///
return void