Update description.exs
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
68c00fa749
commit
9cdce15a42
3 changed files with 34 additions and 6 deletions
|
@ -3558,9 +3558,37 @@
|
||||||
description: "Translation providers",
|
description: "Translation providers",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: Pleroma.Translation,
|
key: :service,
|
||||||
type: :service,
|
type: :module,
|
||||||
suggestions: [Pleroma.Translation.DeepL, Pleroma.Translation.LibreTranslate]
|
suggestions: [Pleroma.Translation.Deepl, Pleroma.Translation.Libretranslate]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
group: {:subgroup, Pleroma.Translation.Deepl},
|
||||||
|
key: :plan,
|
||||||
|
label: "DeepL plan",
|
||||||
|
type: {:dropdown, :atom},
|
||||||
|
suggestions: [:free, :pro]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
group: {:subgroup, Pleroma.Translation.Deepl},
|
||||||
|
key: :api_key,
|
||||||
|
label: "DeepL API Key",
|
||||||
|
type: :string,
|
||||||
|
suggestions: ["YOUR_API_KEY"]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
group: {:subgroup, Pleroma.Translation.Libretranslate},
|
||||||
|
key: :base_url,
|
||||||
|
label: "LibreTranslate plan",
|
||||||
|
type: :string,
|
||||||
|
suggestions: ["https://libretranslate.com"]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
group: {:subgroup, Pleroma.Translation.Libretranslate},
|
||||||
|
key: :api_key,
|
||||||
|
label: "LibreTranslate API Key",
|
||||||
|
type: :string,
|
||||||
|
suggestions: ["YOUR_API_KEY"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Translation.DeepL do
|
defmodule Pleroma.Translation.Deepl do
|
||||||
import Pleroma.Web.Utils.Guards, only: [not_empty_string: 1]
|
import Pleroma.Web.Utils.Guards, only: [not_empty_string: 1]
|
||||||
|
|
||||||
alias Pleroma.Translation.Service
|
alias Pleroma.Translation.Service
|
||||||
|
@ -60,7 +60,7 @@ def translate(content, source_language, target_language) do
|
||||||
|
|
||||||
defp endpoint_url do
|
defp endpoint_url do
|
||||||
case get_plan() do
|
case get_plan() do
|
||||||
"free" -> "https://api-free.deepl.com/v2/translate"
|
:free -> "https://api-free.deepl.com/v2/translate"
|
||||||
_ -> "https://api.deepl.com/v2/translate"
|
_ -> "https://api.deepl.com/v2/translate"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Translation.LibreTranslate do
|
defmodule Pleroma.Translation.Libretranslate do
|
||||||
import Pleroma.Web.Utils.Guards, only: [not_empty_string: 1]
|
import Pleroma.Web.Utils.Guards, only: [not_empty_string: 1]
|
||||||
|
|
||||||
alias Pleroma.Translation.Service
|
alias Pleroma.Translation.Service
|
||||||
|
|
Loading…
Reference in a new issue