void OnMultitranslationReady(Dictionary <string, TranslationQuery> dict, string errorMsg) { if (!string.IsNullOrEmpty(errorMsg)) { Debug.LogError(errorMsg); return; } IsTranslating = false; TranslatedText = ""; TranslatedText += GoogleTranslation.GetQueryResult("This is an example", "es", dict) + "\n"; TranslatedText += GoogleTranslation.GetQueryResult("This is an example", "zh", dict) + "\n"; TranslatedText += GoogleTranslation.GetQueryResult("This is an example", "", dict) + "\n"; // This returns ANY translation of that text (in this case, the first one 'en') TranslatedText += dict["Hola"].Results[0]; // example of getting the translation directly from the Results }
public void ExampleMultiTranslations_Blocking() { // This shows how to ask for many translations var dict = new System.Collections.Generic.Dictionary <string, TranslationQuery>(); GoogleTranslation.AddQuery("This is an example", "en", "es", dict); GoogleTranslation.AddQuery("This is an example", "auto", "zh", dict); GoogleTranslation.AddQuery("Hola", "es", "en", dict); if (!GoogleTranslation.ForceTranslate(dict)) { return; } Debug.Log(GoogleTranslation.GetQueryResult("This is an example", "en", dict)); Debug.Log(GoogleTranslation.GetQueryResult("This is an example", "zh", dict)); Debug.Log(GoogleTranslation.GetQueryResult("This is an example", "", dict)); // This returns ANY translation of that text (in this case, the first one 'en') Debug.Log(dict["Hola"].Results[0]); // example of getting the translation directly from the Results }