Set up a local server to provide the translation API.
This API can use Google Translate and DeepL Translator(Configuration is required).
Japanese - README_JP.md
Download release file and unzip.
Edit config.ini
;Change the values of the following variables to set up the DeepL translation.
[Deepl]
;True if the DeepL translation is used, false if it is not.
enable = True
;The URL to call the API.
;If the plan is free "https://api-free.deepl.com/v2/translate"
;If the plan is pro "https://api.deepl.com/v2/translate"
apiUrl = https://api-free.deepl.com/v2/translate
;API key for using the DeepL translation API.
apiKey = yourApiKey
[System]
waitressThreads = 6
host = localhost
port = 50000
Run run.bat
Call it as a REST API, either GET or POST is fine. The return value is JSON.
The following is an example.
> curl "http://localhost:50000/translate" -d "text=Hello world!" -d "target=de"
{"states":200,"text":"Hallo Welt!","translater":"DeepL"}
To test in your browser, go to the following link.
http://localhost:50000/translate?text=Hello+world!&target=de
You will see a JSON text like the following.
{"states":200,"text":"Hallo Welt!","translater":"DeepL"}
Press Ctrl+C or kill task. (You can also close the console window directly.)
http://localhost:50000/translate
Name | Description | Example |
---|---|---|
text |
Text to be translated | Hello World! |
target |
Language code to translate to | de |
Name | Description | Example |
---|---|---|
states |
States code | 200 400 |
text |
Translated text | Hallo Welt! |
massage |
Details of errors, etc. | Bad target was specified. |
translater |
The engine that did the translation (If no translation was done, "Return" will be returned.) |
Google DeepL Return |
This application require the folllowing system to run.
- Windows 10 x64
In addition to the system requirements, the following environment is required:
- Python 3.9(.7)
- Microsoft C++ Build Tools
After cloning the repository, run setup.bat.
If you want to use this on another system, you may have to rewrite the batch files to make it work. (No guarantees!)
This project is licensed under the MIT License - see the LICENSE file for details