New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate does not detect from_lang for non-English input #85

Closed
jschnurr opened this Issue Jun 10, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@jschnurr
Collaborator

jschnurr commented Jun 10, 2015

The docs for Translator().translate indicate the following behavior:

from_lang (str) – Language to translate from. If None, will attempt to detect the language.

The translation fails if both 1) the text is not in English and 2) from_lang is not explicitly set to None.

>>>from textblob.translate import Translator
>>>t = Translator()

>>>t.translate('hello', to_lang='fr')
u'Bonjour'    # correct

>>>t.translate('hola', from_lang=None, to_lang='fr')
u'Bonjour'    # correct

>>>t.translate('hola', to_lang='fr')
u'Hola'       # incorrect

@sloria sloria closed this Jun 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment