diff --git a/lib/pleroma/translators/deepl.ex b/lib/pleroma/translators/deepl.ex index d63742208..830ad1555 100644 --- a/lib/pleroma/translators/deepl.ex +++ b/lib/pleroma/translators/deepl.ex @@ -26,7 +26,9 @@ defp tier 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} diff --git a/lib/pleroma/translators/libre_translate.ex b/lib/pleroma/translators/libre_translate.ex index 34956f26a..e8b741741 100644 --- a/lib/pleroma/translators/libre_translate.ex +++ b/lib/pleroma/translators/libre_translate.ex @@ -17,7 +17,9 @@ defp url 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} diff --git a/lib/pleroma/web/api_spec/operations/status_operation.ex b/lib/pleroma/web/api_spec/operations/status_operation.ex index e27207683..04a7bf5db 100644 --- a/lib/pleroma/web/api_spec/operations/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/status_operation.ex @@ -593,7 +593,6 @@ defp context do } } end - end defp translation do %Schema{ @@ -602,7 +601,10 @@ defp translation 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"} } }