/// <inheritdoc/>
        public Task InitializeAsync(string subscriptionKey, string language = null)
        {
            _authToken = new AzureAuthToken(subscriptionKey);
            Language   = language ?? CultureInfo.CurrentCulture.Name.ToLower();

            return(InitializeAsync());
        }
        /// <summary>
        /// Initializes the <see cref="TranslatorService"/> class by getting an access token for the service.
        /// </summary>
        /// <param name="subscriptionKey">The subscription key for the Microsoft Translator Service on Azure.</param>
        /// <param name="language">A string representing the supported language code to speak the text in. The code must be present in the list of codes returned from the method <see cref="GetLanguagesAsync"/>.</param>
        /// <returns>A <see cref="Task"/> that represents the initialize operation.</returns>
        /// <exception cref="ArgumentNullException">The <see cref="SubscriptionKey"/> property hasn't been set.</exception>
        /// <exception cref="TranslatorServiceException">The provided <see cref="SubscriptionKey"/> isn't valid or has expired.</exception>
        /// <remarks>
        /// <para>Calling this method isn't mandatory, because the token is get/refreshed everytime is needed. However, it is called at startup, it can speed-up subsequest requests.</para>
        /// <para>You must register Microsoft Translator on https://portal.azure.com to obtain the Subscription key needed to use the service.</para>
        /// </remarks>
        public Task InitializeAsync(string subscriptionKey, string language)
        {
            _authToken = new AzureAuthToken(subscriptionKey);

            Language = language;

            return(InitializeAsync());
        }
 private TranslatorService()
 {
     _authToken = new AzureAuthToken(string.Empty);
 }
 private TranslatorService()
 {
     _authToken = new AzureAuthToken(string.Empty);
     Language   = CultureInfo.CurrentCulture.Name.ToLower();
 }