https://github.com/solvro/backend-translator
https://github.com/solvro/backend-translator
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/solvro/backend-translator
- Owner: Solvro
- Created: 2025-02-22T12:38:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-07T20:46:42.000Z (about 1 year ago)
- Last Synced: 2025-05-07T21:33:57.481Z (about 1 year ago)
- Language: TypeScript
- Size: 508 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# backend-translator


# Translation API Documentation
## Base URL
```
/api/v1
```
## Endpoints
### Languages
#### Get All Languages
```
GET /languages
```
**Response:** List of all available languages.
#### Create a Language
```
POST /languages
```
**Body:**
```json
{
"isoCode": "en"
}
```
**Response:** Created language object.
#### Get Language by ISO Code
```
GET /languages/:isoCode
```
**Response:** Language object.
#### Update Language
```
PUT /languages/:isoCode
```
**Body:**
```json
{
"name": "Updated Name"
}
```
**Response:** Updated language object.
#### Delete Language
```
DELETE /languages/:isoCode
```
**Response:** No content.
---
### Translations
#### Get All Translations
```
GET /translations
```
**Response:** List of all translations.
#### Create a Translation
```
POST /translations
```
**Body:**
```json
{
"originalText": "Hello",
"originalLanguageCode": "en",
"translatedLanguageCode": "fr",
"translatedText": "Bonjour"
}
```
**Response:** Created translation object.
#### Get Translations for a Specific Text
```
GET /translations/:hash
```
**Response:** List of translations for the given text hash.
#### Get Translations for a Specific Language
```
GET /translations/:isoCode
```
**Response:** List of translations in the given language.
#### Get Specific Translation
```
GET /translations/:hash/:isoCode
```
**Response:** Translation object.
#### Update Translation
```
PUT /translations/:hash/:isoCode
```
**Body:**
```json
{
"originalText": "Hello",
"translatedText": "Salut"
}
```
**Response:** Updated translation object.
#### Delete Translation
```
DELETE /translations/:hash/:isoCode
```
**Response:** No content.
#### Approve Translation
```
POST /translations/:hash/:isoCode/approve
```
**Response:** Approved translation object.
#### Request Translation via OpenAI
```
POST /translations/openAI
```
**Body:**
```json
{
"originalText": "Hello",
"originalLanguageCode": "en",
"translatedLanguageCode": "es"
}
```
**Response:** Translation object created using OpenAI.
---
## Notes
- The `hash` parameter is generated using SHA-256 from `originalText`.
- The OpenAI translation request utilizes `gpt-4o-mini`.
- All responses follow JSON format.
- Errors return appropriate HTTP status codes with messages.
- **The API is generated by ChatGPT - watch out for inconsistencies**
## Links
[](https://docs.solvro.pl)