I want to use the google translate API to detect a language being typed and also get the translation but it seems this is not possible according to the docs here.
Does anyone know if this is possible? Or would I have to make two calls? Thanks
I want to use the google translate API to detect a language being typed and also get the translation but it seems this is not possible according to the docs here.
Does anyone know if this is possible? Or would I have to make two calls? Thanks
Definitely you can detect and translate your contents at the same time. To be more specific, it will detect the source language automatically without specifying the source language by simply calling the Translation API method translate().
You can directly call the translate method without specifying the source language and only specify target language. Below is code snippet of code using google-cloud-translate jar. It works perfect
Translate translate = getTranslationServiceClient();
// Translates some text into target language
Translation translation = translate.translate("Hello", TranslateOption.targetLanguage("hi"));