translate-server

command module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

README

Translate-Server

translate-server

Description

Support Translate Engine

Usage

Translate API
Request
  • method: POST
  • url: /translate or https://translate-server-five.vercel.app/api/translate
  • params: engine: google or deepl
  • body application/json:
{
    "text": "Hello world",
    "source_lang": "en",
    "target_lang": "zh"
}
Response
{
    "alternatives": ["你好世界", "世界你好"],
    "code": 200,
    "data": "你好世界"
}
Request(JSONP)

You can use JSONP to request the api, just add callback param to the url, like this:

  • method: POST
  • url: /translate or https://translate-server-five.vercel.app/api/translate?callback=tr
  • params:
    • engine: google or deepl
  • body application/json:
{
    "text": "Hello world",
    "source_lang": "en",
    "target_lang": "zh"
}
Response
tr({
    alternatives: ["你好世界", "世界你好"],
    code: 200,
    data: "你好世界",
});
Translate XML

Always used to translate RSS feed:

  1. Add prefix https://translate-server-five.vercel.app/api/rss?url= to the original rss feed url. e.g. http://export.arxiv.org/rss/cs.DC -> https://translate-server-five.vercel.app/api/rss?url=http://export.arxiv.org/rss/cs.DC
  2. Add &engine=deepl or &engine=google to the end of the url. The default engine is google. if you want to specify the engine, you should run your own instance of the server instead of using the vercel one, like this: http://127.0.0.1:1188/rss?url=http://export.arxiv.org/rss/cs.DC&engine=deepl
Run with Docker

// TODO

Author

Shevon Kwan © translate-server Contributors

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL