1

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?

1 Answer 1

4

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.