Esempio n. 1
0
        /// <summary>
        /// Fills dictionary with translation and reading (translit).
        /// </summary>
        private void FillDictionary()
        {
            TranslationRresult translationResult = mTranslationHelper.GetTranslation(mSearchText, mSelectedLanguage);

            this.txtSearchText.Text = translationResult.mSourceText;
            this.txtRomaji.Text     = translationResult.mTranslitText;
            this.txtEnglish.Text    = translationResult.mTranslatedText;
        }
Esempio n. 2
0
        private async void SetExampleToolTip(ListViewItem item)
        {
            TranslationRresult translationResult = null;
            await Task.Run(() =>
            {
                translationResult = mTranslationHelper.GetTranslation(item.Text, mSelectedLanguage);
            });

            if (translationResult != null && translationResult.mTranslitText != "")
            {
                item.ToolTipText = translationResult.mTranslitText;
            }
        }
Esempio n. 3
0
        public TranslationRresult GetTranslation(string inSearchText, Language inLanguage)
        {
            TranslationRresult translationResult = new TranslationRresult();

            MicrosoftTranslationService transService       = new MicrosoftTranslationService();
            TranslationServiceResult    transServiceResult = transService.GetTranslation(inSearchText, inLanguage);

            MicrosoftTransliterationService translitService       = new MicrosoftTransliterationService();
            TransliterationServiceResult    translitServiceResult = translitService.GetTransliteration(inSearchText, inLanguage);

            translationResult.mSourceText     = inSearchText;
            translationResult.mTranslitText   = transServiceResult != null ? transServiceResult.translation : "TRANSLATION FAILED";
            translationResult.mTranslatedText = translitServiceResult != null ? translitServiceResult.transliteration : "";
            return(translationResult);
        }