when translation fails #76
Closed
Comments
TextBlob will return whatever result is returned by the Google Translator. There really currently no way to detect whether language of the source text is unsupported. |
If the translation is unsuccessful, the original string is returned, with whitespace removed: >>> translator.translate(u' Ꭰ Ꭱ Ꭲ Ꭳ Ꭴ Ꭵ ', to_lang='en')
Ꭰ Ꭱ Ꭲ Ꭳ Ꭴ Ꭵ However, the JSON response from the API includes both the original and translated string. If they match, we could infer that the translation was not successful.
What would be the desired behavior in that case - return None? |
Yes, either return None or raise an exception. Thanks |
sloria
added a commit
that referenced
this issue
Jul 19, 2015
Fix #76 - when translation fails, raise TranslatorError.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would you please test and document the behavior when translation fails, such as when the language is not supported (distinct from an HTTP error)?
Example (Cherokee):
The text was updated successfully, but these errors were encountered: