Open yyy33 opened 2 years ago
so that the other language can benefit from the project,
Other languages can already use translatepy from the command line interface though
I mean we could use something like Nuitka which seems to work pretty well (just tested it on translatepy)
I mean we could use something like Nuitka which seems to work pretty well (just tested it on translatepy)
Yes, but the pythong module is a bit difficult to manage for those of us who have not studied python
Yes, but the pythong module is a bit difficult to manage for those of us who have not studied python
Oh you mean like installing stuff and all...
Yeah I guess I could release some kind of binaries 👌
I tried to package the binary using the Nuitka package you recommended, and it worked for me. Then I called it in golang, but it was a bit slow, because I needed to start translate
once for each translation
Then I called it in golang, but it was a bit slow, because I needed to start
translate
once for each translation
Ok I guess I could make some kind of HTTP server then
Then I called it in golang, but it was a bit slow, because I needed to start
translate
once for each translationOk I guess I could make some kind of HTTP server then
great!
great!
I now have something like this:
GET /translate?text=Hello%20world&dest=japanese
{
"success": true,
"error": null,
"message": null,
"data": {
"service": "Google",
"source": "Hello world",
"sourceLang": "eng",
"destLang": "jpn",
"result": "こんにちは世界"
}
}
Which also handles the errors and where you can specify the translators and all.
The documentation is available under the translatepy/server/docs folder.
I'll add more endpoints in the near future to cover the other functions.
Also, you need to install Nasse
to be able to run the server, which is for now only available on Unix systems (macOS, Linux, etc.).
Also, I seem to have a problem with threading
+ fork()
when running the server on my mac so I'm currently using Linux on GitHub Codespaces where it works perfectly.
@yyy33 The HTTP server seems to work fine now, with lots of new endpoints added covering somewhat everything that can be done with translatepy
translatepy/server/docs/Getting Started.md
You can use the new server
action of the CLI to easily run the HTTP server.
$ translatepy server
Here is more details for this command
🧃❯ translatepy server -h usage: translatepy server [-h] [--port PORT] [--host HOST]
optional arguments: -h, --help show this help message and exit --port PORT, -p PORT port to run the server on --host HOST host to run the server on
Now I just need to create the binaries for each release and it should be good 👍
现在我只需要为每个版本创建二进制文件,它应该很好 👍
I haven't tested it yet, and I will give the results feedback here after using it ❤
I haven't tested it yet, and I will give the results feedback here after using it
You should test the one on the website
branch (I'm currently making a website for translatepy, which I should finish right after my exams). I modified some stuff for the HTTP server to be easier for developers on it, as I was making use of the HTTP server myself.
Make sure to download the dependencies from requirements.txt
instead of setup.py
I suggest that the author can package the project into a binary file and provide a network interface, like http, so that the other language can benefit from the project,