Reputation: 299
I'm using Google Translation API to translate individual words in python. Sometimes autodetect is inaccurate. Now the API seems to take no argument to specify the source language.
I've seen some projects on github with functions taking the source as argument but these methods are old and use the url.
How am I supposed to fix this problem?
Upvotes: 1
Views: 2081
Reputation: 8681
You can provide the source language as follows:
from google.cloud import translate
translate_client = translate.Client()
result = translate_client.translate(
text, source_language='en', target_language=target)
Upvotes: 4