class_docstr: Example:
  
  ```py
  from transformers.tools import TranslationTool
  
  translator = TranslationTool()
  translator("This is a super nice API!", src_lang="English", tgt_lang="French")
  ```
code: def encode(self, text, src_lang, tgt_lang):
      if src_lang not in self.lang_to_code:
          raise ValueError(f"{src_lang} is not a supported language.")
      if tgt_lang not in self.lang_to_code:
          raise ValueError(f"{tgt_lang} is not a supported language.")
      src_lang = self.lang_to_code[src_lang]
      tgt_lang = self.lang_to_code[tgt_lang]
      return self.pre_processor._build_translation_inputs(
          text,
          return_tensors="pt",
          src_lang=src_lang,
          tgt_lang=tgt_lang,
      )
  
imports: from ..models.auto import AutoModelForSeq2SeqLM, AutoTokenizer
  from .base import PipelineTool
label_desc: Use image node_id 1 for calling the TranslationTool obj's underlying member method code with example usage: obj.encode(text, src_lang, tgt_lang) and returns: self