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.
Clone the project
git clone https://link-to-project
Go to the project directory
cd translate_language
Install dependencies
npm install
Documentation Redis Installation
Start the server
npm run start
# Run in development mode
npm run devStart
# Run in production mode
npm start
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
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.
- for the