translate-python
translate-python copied to clipboard
Translation to English
When I try to translate something to English it always responds with the original text and not the translated one.
Example:
In [1]: from translate import Translator In [2]: translator= Translator(to_lang="en") In [3]: translation = translator.translate("Waar bevindt zich het dichtbijzijnste treinstation?") Out [3]: Waar bevindt zich het dichtbijzijnste treinstation?
Ran into the same problem and by reading the code I realized that the default from_lang
is english (check here), which will not trigger a translation. Just change the parameter while instantiating your Translator will do the trick.
>>> translator= Translator(to_lang="en", from_lang='autodetect')
>>> translator.translate("Waar bevindt zich het dichtbijzijnste treinstation?")
'Where is the nearest train station?'
@pichatelli
when i tried to run your lines it gives me this msg
Ran into the same problem and by reading the code I realized that the default
from_lang
is english (check here), which will not trigger a translation. Just change the parameter while instantiating your Translator will do the trick.>>> translator= Translator(to_lang="en", from_lang='autodetect') >>> translator.translate("Waar bevindt zich het dichtbijzijnste treinstation?") 'Where is the nearest train station?'
I have same problem and I get "'' IS AN INVALID SOURCE LANGUAGE . EXAMPLE: LANGPAIR=EN|IT USING 2 LETTER ISO OR RFC3066 LIKE ZH-CN. ALMOST ALL LANGUAGES SUPPORTED BUT SOME MAY HAVE NO CONTENT"
Exactly