translate-python icon indicating copy to clipboard operation
translate-python copied to clipboard

Translation to English

Open Wallvon opened this issue 5 years ago • 4 comments

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?

Wallvon avatar Aug 01 '19 14:08 Wallvon

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-zz avatar Aug 16 '19 09:08 pichatelli-zz

@pichatelli
when i tried to run your lines it gives me this msg rrr

mennatallah644 avatar Jun 20 '21 16:06 mennatallah644

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"

liliana3186 avatar Aug 02 '21 21:08 liliana3186

Exactly

arsenikov avatar Sep 02 '21 06:09 arsenikov