dialect-app / dialect

A translation app for GNOME.
https://dialectapp.org/
GNU General Public License v3.0
597 stars 69 forks source link

Deepl API provider #369

Closed rafaelmardojai closed 5 months ago

rafaelmardojai commented 8 months ago

A correct initial implementation needed dome tweaks on other parts of Dialect's code.

There are some open questions:

TODO:

mufeedali commented 7 months ago

Do we want to support pro users?

No tbh. I don't think that's needed. 500,000 characters per month should be enough for most users. That's over 16500 characters per day. Should be enough. If not... I don't think Dialect is really meant for that anyway...

Do we know the char limit?

Free API has a limit of 500,000 characters per month. Regarding the character limit per query, I think it's better if we enforce a limit from our end of maybe 2000 characters. 2000 characters would mean that it takes a user at least 8 queries to exceed their daily API limit (not really a limit, but the 16500 characters I mentioned earlier) and will definitely be under 128KBs as well.

DeepL has two separated lists with some divergences.

Between Pro and Free? I'd say skip pro. I feel like DeepL is being generous enough for most users.

Extend providers API to allow providers report API usage and limits.

Yes, we definitely need to add both UI and API support for that.

rafaelmardojai commented 7 months ago

No tbh. I don't think that's needed. 500,000 characters per month should be enough for most users. That's over 16500 characters per day. Should be enough. If not... I don't think Dialect is really meant for that anyway...

I guess someone could "hack" Dialect and change the instance_url on GSettings.

Between Pro and Free? I'd say skip pro. I feel like DeepL is being generous enough for most users.

Nope, they have distinct langs list, for example in src they have English (en) and in dest they have both American (en_US) and British (en_GB), same for Portuguese.

I had some workaround code for that in my webkit-based implementation that I can copy, but probably would be better to rework how we handle langs to support this use case, also checking what would we need for offline providers.

mufeedali commented 7 months ago

I guess someone could "hack" Dialect and change the instance_url on GSettings.

My thought process is just that anyone who needs the Pro probably doesn't need Dialect at all.

Nope, they have distinct langs list

Oh... Thats different from what I imagined. Then yeah, I guess we need a clean implementation for that.

rafaelmardojai commented 7 months ago

My thought process is just that anyone who needs the Pro probably doesn't need Dialect at all.

Yep, agree.

rafaelmardojai commented 5 months ago

API usage implemented: Captura desde 2024-04-08 14-27-49-obfuscated

mufeedali commented 5 months ago

Found some bugs and fixed them. Should be good now :) Merging.