Does there exit any Rust crate that:
-
can translate text between languages (say the 10 most commonly used)
-
is self contained, does not need some external service / api
?
Thanks.
Does there exit any Rust crate that:
can translate text between languages (say the 10 most commonly used)
is self contained, does not need some external service / api
?
Thanks.
Translate as in for arbitrary text, or for predefined text? If the latter, fluent
is what rustc uses (and I believe Firefox as well).
Good clarification question.
Imagine an IRC like chat room. Everyone specifies their "native" language.
Alice / English
Bob / English
Carol / Chinese
Dan / French
Eugene / Spanish
Alice types in the chat room "Hello"
Bob Sees:
Hello
Hello
Carol sees:
Hello
Ni Hao
Dan sees:
Hello
Bonjour
Eugene sees:
Hello
Hola
The way this works is that the server takes Alice's input string, sees Alice's language is English, then for each language option:
The XY problem is a "multi language chat room"
So you want machine translation? For that you have two options: EIther you use an online service like google translate (allrounder) or deepl (mostly focused on european languages, but also supports chinese, japanese and a couple of other non-european languages) The other option is to have an offline translator like Bergamot (used in the firefox translations addon. Written in C++, but can be compiled to wasm.). The disadvantage of this is that it is less accurate and supports less languages, but it preserves privacy (so no risk of violating the GDPR or CCPA through this) and doesn't require you to pay anyone for translations like you probably need for commercial use of google translate and deepl.
Be aware however that no machine translator captures all nuances of human languages. As such I did recommend to make it very clear when messages are translated to reduce likelihood of mistranslations causing severe issues.
Yes.
I am okay with solutions that only runs on x86_64. I only need the translation be done server side. I currently do not need in-browser-wasm/webgpu translation.
Agreed. The UI for display msgs is:
user_name: orig msg (that user typed)
translated msg (into reader's lang)
So it's always clear what the user said and what is translated.