gajanan0707 / translate_language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Language Translate (Cached Translation API with Redis)

Project Overview:

The Cached Translation API with Redis is a service that provides efficient translation capabilities using the Microsoft Translator API while leveraging Redis for caching. This project aims to reduce API calls and improve response times by storing and retrieving translated text data from a Redis cache.

Run Locally

Clone the project

  git clone https://link-to-project

Go to the project directory

  cd translate_language

Install dependencies

  npm install

Setup Redis

Documentation Redis Installation

Start the server

  npm run start

Run the app

# Run in development mode
npm run devStart

# Run in production mode
npm start

Environment Variables

To run this project, you will need to add the following environment variables to your config/config.env file

SUBSCRIPTION_KEY

OCP_APIM_SUBSCRIPTION_REGION

SECRET_API_KEY

API Reference

To get the translation, we can Postman or any web browser and hit this API as follow:

 # URL: (http://localhost:5000) or Deployed link

 POST {URL}/translate?targetLanguage=''

We have to pass one Query Params targetLanguage

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| `targetLanguage`      | `string` | **Required**.              |

We have to pass body with list of text's

[
    "Hello How, are you",
    "Hello, what is your name?"
]
  • targetLanguage: the langauge to be it has to be translated
    NOTE:
    • for the targetLangauge, only ISO Language code should be passed as value.
      For example:
      • "hi" for Hindi
      • "ja" for Japanese
      • "fa" for Persian, etc.
        A list of all ISO Language Codes is attached here.

Screenshots

App Screenshot

Token Screenshot

Badges

MIT License GPLv3 License AGPL License

About

License:Apache License 2.0


Languages

Language:JavaScript 100.0%