class_docstr: A language translator and detector.
  
  Usage:
  ::
      >>> from textblob.translate import Translator
      >>> t = Translator()
      >>> t.translate('hello', from_lang='en', to_lang='fr')
      u'bonjour'
      >>> t.detect("hola")
      u'es'
class_docstr_tok: ["A","language","translator","and","detector",".","Usage",":",":",":",">",">",">","from","textblob.translate","import","Translator",">",">",">","t","=","Translator","(",")",">",">",">","t.translate","(","'hello","'",",","from_lang='en","'",",","to_lang='fr","'",")","u'bonjour'",">",">",">","t.detect","(","``","hola","''",")","u'es","'"]
docstr: Translate the source text from one language to another.
docstr_tok: ["Translate","the","source","text","from","one","language","to","another","."]
code: def translate(
      self,
      source,
      from_lang="auto",
      to_lang="en",
      host=None,
      type_=None,
  ):
      """Translate the source text from one language to another."""
      if PY2:
          source = source.encode("utf-8")
      data = {"q": source}
      url = "{url}&sl={from_lang}&tl={to_lang}&hl={to_lang}&tk={tk}&client={client}".format(
          url=self.url,
          from_lang=from_lang,
          to_lang=to_lang,
          tk=_calculate_tk(source),
          client="te",
      )
      response = self._request(url, host=host, type_=type_, data=data)
      result = json.loads(response)
      if isinstance(result, list):
          try:
              result = result[0]  # ignore detected language
          except IndexError:
              pass
      self._validate_translation(source, result)
      return result
  
file_path: TextBlob/textblob/translate.py
imports: from __future__ import absolute_import
  import codecs
  import json
  import re
  from textblob.compat import PY2, request, urlencode
  from textblob.exceptions import TranslatorError, NotTranslated
label_desc: Use image node_id 1 for calling the Translator obj's underlying member method code with example usage: obj.translate(source, from_lang, to_lang, host, type_) and returns: result