mix format

This commit is contained in:
FloatingGhost 2022-08-28 22:40:07 +01:00
parent 83d881dcb1
commit b3220cc8fc
3 changed files with 10 additions and 4 deletions

View File

@ -26,7 +26,9 @@ defmodule Akkoma.Translators.DeepL do
@impl Akkoma.Translator
def translate(string, to_language) do
with {:ok, response} <- do_request(api_key(), tier(), string, to_language) do
%{"translations" => [%{"text" => translated, "detected_source_language" => detected}]} = response.body
%{"translations" => [%{"text" => translated, "detected_source_language" => detected}]} =
response.body
{:ok, detected, translated}
else
{:error, reason} -> {:error, reason}

View File

@ -17,7 +17,9 @@ defmodule Akkoma.Translators.LibreTranslate do
@impl Akkoma.Translator
def translate(string, to_language) do
with {:ok, response} <- do_request(string, to_language) do
%{"translatedText" => translated, "detectedLanguage" => %{"language" => detected}} = response.body
%{"translatedText" => translated, "detectedLanguage" => %{"language" => detected}} =
response.body
{:ok, detected, translated}
else
{:error, reason} -> {:error, reason}

View File

@ -593,7 +593,6 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
}
}
end
end
defp translation do
%Schema{
@ -602,7 +601,10 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
type: :object,
required: [:detected_language, :text],
properties: %{
detected_language: %Schema{type: :string, description: "The detected language of the text"},
detected_language: %Schema{
type: :string,
description: "The detected language of the text"
},
text: %Schema{type: :string, description: "The translated text"}
}
}