I was experimenting with running the wasm version of bergamot-translator (the translation engine used by the addon) in node [2].
However, if you want more performance, using the Python library [3] or the native C++ interface [4] gets you further because the wasm build is limited to a single thread and thus a blocking interface, and can't use all the processor specific optimisations that are in the native builds.
EDIT: Another option is using translateLocally [5], which is a Qt desktop app based on bergamot-translator. It has a native messaging API that is designed as a much faster alternative to the wasm build for browser extensions, but it can also be used from Python [6].
I was experimenting with running the wasm version of bergamot-translator (the translation engine used by the addon) in node [2].
However, if you want more performance, using the Python library [3] or the native C++ interface [4] gets you further because the wasm build is limited to a single thread and thus a blocking interface, and can't use all the processor specific optimisations that are in the native builds.
EDIT: Another option is using translateLocally [5], which is a Qt desktop app based on bergamot-translator. It has a native messaging API that is designed as a much faster alternative to the wasm build for browser extensions, but it can also be used from Python [6].
[1] https://github.com/mozilla/firefox-translations-training
[2] https://gist.github.com/jelmervdl/a4c8b6b92ad88a885e1cbd51c6...
[3] https://colab.research.google.com/drive/1AHpgewVJBFaupwAbZq0...
[4] https://github.com/browsermt/bergamot-translator/blob/main/a...
[5] https://github.com/XapaJIaMnu/translateLocally
[6] https://github.com/XapaJIaMnu/translateLocally/blob/master/s...