Skip to content

Commit

Permalink
feat: Add DeepL Pro (#459)
Browse files Browse the repository at this point in the history
Co-authored-by: fcastell-exfab <[email protected]>
  • Loading branch information
fcastell and fcastell-exfab authored Jan 30, 2025
1 parent a081c7c commit aab1747
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/machine_translations/provider/deepl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,16 @@ defmodule Accent.MachineTranslations.Provider.Deepl do
end

defp client(key) do
base_url = if String.ends_with?(key, ":fx") do
"https://api-free.deepl.com/v2/"
else
"https://api.deepl.com/v2/"
end

middlewares =
List.flatten([
{Middleware.Timeout, [timeout: :infinity]},
{Middleware.BaseUrl, "https://api-free.deepl.com/v2/"},
{Middleware.BaseUrl, base_url},
{Auth, [key: key]},
Middleware.DecodeJson,
Middleware.EncodeJson,
Expand Down

0 comments on commit aab1747

Please sign in to comment.