Google Translate Clone using NextJS and Reactstrap

Stacks

Getting Started

First, run the development server: npm run dev

Web

Open http://localhost:3000 with your browser to see the frontend page.

API

Use HTTP Client Extension such as Postman and Thunder Client to test it.

  • URL http://localhost:3000/api/translate
  • Method POST
  • Body

{
  "sl":"id",
  "tl":"en",
  "q":"Hore"
}

sl and tl are language codes, you can find them on here.
q is the text you want to be translated.

  • Response

{
  "sentences": [
    {
      "trans": "Hurray",
      "orig": "Hore",
      "backend": 3,
      "model_specification": [{}],
      "translation_engine_debug_info": [
        {
          "model_tracking": {
            "checkpoint_md5": "d906f146e9fec4c46f9b531e2fa31c2a",
            "launch_doc": "id_en_2021q1.md"
          }
        }
      ]
    }
  ],
  "dict": [
    {
      "pos": "interjection",
      "terms": ["Hurray!", "Hurrah!"],
      "entry": [
        {
          "word": "Hurray!",
          "reverse_translation": ["Hore!", "Hura!", "Sabas!"],
          "score": 0.16842748
        },
        {
          "word": "Hurrah!",
          "reverse_translation": ["Hore!", "Hura!", "Sabas!"],
          "score": 0.10539922
        }
      ],
      "base_form": "Hore!",
      "pos_enum": 9
    }
  ],
  "src": "id",
  "confidence": 0.3984375,
  "spell": {},
  "ld_result": {
    "srclangs": ["sk", "so", "ja"],
    "srclangs_confidences": [0.3984375, 0.3984375, 0.16015625],
    "extended_srclangs": ["sk", "so", "ja-Latn"]
  }
}

GitHub

View Github