void TranslateAllToLanguage(string lanName) { if (!GoogleTranslation.CanTranslate()) { ShowError("WebService is not set correctly or needs to be reinstalled"); return; } ClearErrors(); int LanIndex = mLanguageSource.GetLanguageIndex(lanName); string code = mLanguageSource.mLanguages [LanIndex].Code; string googleCode = GoogleLanguages.GetGoogleLanguageCode(code); if (string.IsNullOrEmpty(googleCode)) { ShowError("Language '" + code + "' is not supported by google translate"); return; } googleCode = code; mTranslationTerms.Clear(); mTranslationRequests.Clear(); foreach (var termData in mLanguageSource.mTerms) { if (termData.TermType != eTermType.Text) { continue; } if (!string.IsNullOrEmpty(termData.Languages[LanIndex])) { continue; } string sourceCode, sourceText; FindTranslationSource(LanguageSourceData.GetKeyFromFullTerm(termData.Term), termData, code, null, out sourceText, out sourceCode); mTranslationTerms.Add(termData.Term); GoogleTranslation.CreateQueries(sourceText, sourceCode, googleCode, mTranslationRequests); // can split plurals into several queries } if (mTranslationRequests.Count == 0) { StopConnectionWWW(); return; } mConnection_WWW = null; mConnection_Text = "Translating"; if (mTranslationRequests.Count > 1) { mConnection_Text += " (" + mTranslationRequests.Count + ")"; } mConnection_Callback = null; //EditorApplication.update += CheckForConnection; GoogleTranslation.Translate(mTranslationRequests, OnLanguageTranslated); }