Exemple #1
0
        /// <remarks>
        /// http://blogs.msdn.com/b/translation/p/gettingstarted2.aspx
        /// </remarks>
        private static void TestTranslating(AuthenticationContext authenticationContext)
        {
            Console.WriteLine("Enter Text to translate:");
            string txtToTranslate = "안녕 세상아";

            txtToTranslate = Console.ReadLine();

            var languageDetector = new DetectorCommand(authenticationContext, txtToTranslate);

            languageDetector.Execute();
            var detectedLanguage = languageDetector.Result;

            var translator = new Microsoft.Commands.TranslatorCommand(authenticationContext, new LanguageTranslatorArg(txtToTranslate, detectedLanguage));

            translator.Execute();
            var translatedText = translator.Result;

            Console.WriteLine("Detected Language : {0} and Translation is: {1}", detectedLanguage, translatedText);
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey(true);
        }
		/// <remarks>
		/// http://blogs.msdn.com/b/translation/p/gettingstarted2.aspx
		/// </remarks>
		private static void TestTranslating(AuthenticationContext authenticationContext)
		{
			Console.WriteLine("Enter Text to translate:");
			string txtToTranslate = "안녕 세상아";
			txtToTranslate = Console.ReadLine();

			var languageDetector = new DetectorCommand(authenticationContext, txtToTranslate);
			languageDetector.Execute();
			var detectedLanguage = languageDetector.Result;

			var translator = new Microsoft.Commands.TranslatorCommand(authenticationContext, new LanguageTranslatorArg(txtToTranslate, detectedLanguage));
			translator.Execute();
			var translatedText = translator.Result;

			Console.WriteLine("Detected Language : {0} and Translation is: {1}", detectedLanguage, translatedText);
			Console.WriteLine("Press any key to continue...");
			Console.ReadKey(true);
		}