simjanos-dev / LinguaCafe

LinguaCafe is a self-hosted software that helps language learners read foreign languages.
https://simjanos-dev.github.io/LinguaCafeHome/
GNU General Public License v3.0
847 stars 26 forks source link

Support for custom translation API? #247

Open rococtz opened 4 months ago

rococtz commented 4 months ago

Hi guys, I was trying out the app and it was really smooth setting up and using it, but now I have 2 questions, please.

1) Do you support custom translation APIs? At the moment, I can see I am able to import dictionary files and I can call DeepL API for translations. But what if I host my own API endpoint? Can I configure LinguaCafe to call http://localhost:5000?query={query} or something along these lines?

2) Is there any way to play audio for the words I am trying to learn (via the dictionary)? Or any kind of audio?

Thanks!

simjanos-dev commented 4 months ago

Hi!

  1. I want to implement this, and other kind of API-s as well, but I'm focusing on other features first that more people use. I will use this github issue for this, not sure when I'll get to it.

  2. In the next update, v0.12 I've added SpeechSynthesis api. I am focusing on reading first, and want to add audio features later on, I've only added this for fun. You can use it to read out selected text, and review cards. It is supposed to be supported by most browsers, but unfortunately I could only get it to work on desktop chrome browser. It is an OS and browser dependent feature. You can test your available voices here.

I want to add two kind of audio support for words:

And I also want to add an option for users to upload audio files for whole books and chapters.

But I want to focus on reading features before that, and I'll need a proper PC for the AI tools as well. I don't think these audio features will come out this year.

rococtz commented 4 months ago

@simjanos-dev Thank you for the reply! The SpeechSynthesis part sounds pretty good for the purpose I have in mind: hear how a word is pronounced.

By the way, I think you are doing a fantastic job. I have used this app for a couple of hours now and it's really high quality!

simjanos-dev commented 4 months ago

By the way, I think you are doing a fantastic job. I have used this app for a couple of hours now and it's really high quality!

Thank you! :)

Honestly I find it a bit buggy, and lacking a few important features still. But it will get there.

simjanos-dev commented 3 months ago

Hi!

I replaced the code for deepl api calls, and I will have to add a host address option. It is hacky, but since I don't have enough time nowadays to implement proper external translation api, you can set deepl host to your own custom api, and replace deepl with your own service if it's important to you in the meantime.

This will be finished today or tomorrow, and will be in v0.13.