Skip to content

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

Closed
@jschnurr

Description

@jschnurr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions