Open Nutomic opened 1 year ago
I don't know about "in-place" translations, because that could be very complicated to implement. But there might be some services that can take text in its get params, and do something like:
https://translate.com/?to_language=de&text=....
Maybe libretranslate could work? It's self-hostable and there's a docker image for it on dockerhub.
Based on my quick tests the translations arent that good. I noticed that Mastodon integrates deepl.com for translations, so thats also worth considering. Then we can still switch to a different tool later.
DeepL is definitely higher quality. Having used the API for it before, an account can translate up to 500,000 characters per month for free before needing to pay.
In fact we can easily handle translations entirely on the backend and add an endpoint like GET /api/v3/post/translate?id=123&lang=es
. Then instance admins could choose between different translation services, whether selfhosted or commercial. Then lemmy-ui mainly needs to provide an intuitive user interface for that.
As posts and comments have language tags now, it should be relatively easy to translate them into another language which the user can understand. This would require some self-hosted translation tool which can be deployed alongside Lemmy.
There should also be a way for users to choose which languages or posts should be translated. This could be done with a user setting "translate languages", so posts in these languages are shown to the user and automatically translated. Alternatively it could be tied in with #999, so the user gets a button to show all comments for a given post, which can then be translated.
Getting this right will probably require some experimentation. It would be good to know if there are other websites which offer similar functionality, to see how they do it.