[Feature Request] Hope this package can separate front-end and translating backends
stardiviner opened this issue · 8 comments
As title described, so that other contributors can add other translating backends.
@stardiviner This is what I will do in the next stage. Currently, I have just completed the preliminary formatting work for the front-end.
Thanks for quick respond. Great, wait for in new release.
@stardiviner I have implemented the relevant functionality preliminarily (see 添加新的翻译服务), but I am unsure if
this is appropriate. If you have any ideas, please let me know.
Thanks for quick added feature! I checked out the new release commit.
I know for current translating services status, almost 97% services are online URL API. But I think this Emacs extension should also support offline local translating software which has command-line or other schema support. So I think the core API function immersive-translate-curl-do
should be like immersive-translate-translate
(name it as you like). The immersive-translate-curl-get-translation-alist
also need to be modified to suite for a translating backend interface function as a blackbox instead of unified cURL requesting, cURL requesting functions can be in a common library file immersive-translate-curl-common.el
. For example:
(defcustom immersive-translate-backend-functions-alist
'((chatgpt . immersive-translate-chatgpt-get-translation)
(baidu . immersive-translate-chatgpt-get-translation)
(goldendict . immersive-translate-goldendict-get-translation) ; Here give goldendict as an example
)
.........
(defun immersive-translate-goldendict-get-translation (text)
"Translate input TEXT then return an Elisp data structure like alist etc?"
.....)
Those are my little opinions. WDYT?
But I think this Emacs extension should also support offline local translating software which has command-line or other schema support.
This package is intended to translate long texts, which means paragraphs are considered as the smallest unit. I don't know whether there is local offline translation software that can do this well. If there is, could you submit a PR? Because I am not very familiar with the relevant knowledge.
macOS Bob.app support translating long text through AppleScript command-line invocation.
For example: https://repo.or.cz/external-dict.el.git/blobdiff/e178548b9d88d86881aa870ae743ee4b82089533..68ab3e5f78239774d1710874e8a68e3f8498cee3:/external-dict.el
@stardiviner Thank you for your suggestion! I tried to make some improvements based on your advice (see 1090e1c and sorry for my chaotic commits.). Since I only have Linux devices on hand, I tested it using translate-shell , and the results were good.
Thanks for quick response. Looks great for me. Close now.