frnandu/yana

Automatic Translations

Opened this issue · 2 comments

Automatic Translations

Hi,

We would love to be able to use our translation service (https://translate.nostr.wine/) along with any other LibreTranslate compatible API to translate notes either on demand or automatically (determined by a setting) on Yana. We can offer a 200,000 sat bounty for the implementation of this feature.

We would also like to make the onboarding process smoother and could add other api calls so that you can conveniently generate API keys for users and request invoices from within the app. Whatever you need to make it a good experience - please let us know.

The LibreTranslate API syntax is very simple (https://libretranslate.com/docs/#/translate/post_translate) and the main /translate endpoint is a POST with:

q = string to translate
source = source language code
target = target language code
api_key = API Key

Our translation service is pay-as-you-go in bitcoin and powered by DeepL and Google Cloud Translate when the language is not available on DeepL. We built on this API standard so clients could support several options as there are other free and paid LibreTranslate services. This is currently supported elegantly by Damus as an option under "Translation" in Settings with a Translate button on individual notes and a toggle to turn on automatic translations.

We added a new endpoint for account creation. Rate limit: 1 request/20 seconds. Let us know if you need anything else!

POST to https://translate.nostr.wine/api/create with json body including the users pubkey (npub or hex) and initial deposit amount (min 2500 sats).
{"pubkey": "4918eb332a41b71ba9a74b1dc64276cfff592e55107b93baae38af3520e55975", "amount" 2500}

Response:

{
"api_key": "d5599a62-64c4-4d8e-aaf3-0c90060401b3",
"bolt11": "lnbc25u1pjeqwprsp5jghhet3ndm3qs7ry76mu5uk2hm7m8th7m2pukpzm620rg392e03spp53gh969zhl6ddgmqdge0m406wu25qzdfdtysqhazww6mmslk4knysdp5w3exzmnnd3shgefwdehhxarj9emkjmn9ypqkgepqgdex2erfw3esxq9plgllcqpjrzjqgpwwun7u3kegwjyc7lsmns5yg9g893smmn86q6yd0un29ut2ksd7rrs6vqqa3sqqyqqqqqqqqqqpvsq2q9qxpqysgq34fu827vhgz4y5tyyhder7vw34a56egfgn3r382lamqzhrnmcz5hjk7y904xk9j6a7rtcfnla3zp9xeluvwkhfxmzxq73lm0afxskdqqv8rw3a"
}

You can then use the api_key to make translation requests for this user. The user will receive a DM from our bot when their remaining translation credits drop below 5000 characters.