Add supported languages list to /api/v2/instance
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
f0eb8e0b0c
commit
28f8bb00d8
9 changed files with 155 additions and 25 deletions
|
|
@ -1578,6 +1578,15 @@ defmodule HttpRequestMock do
|
|||
}}
|
||||
end
|
||||
|
||||
def post("https://api-free.deepl.com/v2/languages" <> _, _, _, _) do
|
||||
{:ok,
|
||||
%Tesla.Env{
|
||||
status: 200,
|
||||
body: File.read!("test/fixtures/tesla_mock/deepl-languages-list.json"),
|
||||
headers: [{"content-type", "application/json"}]
|
||||
}}
|
||||
end
|
||||
|
||||
def post(url, query, body, headers) do
|
||||
{:error,
|
||||
"Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ defmodule TranslationMock do
|
|||
|
||||
@behaviour Provider
|
||||
|
||||
@name "TranslationMock"
|
||||
|
||||
@impl Provider
|
||||
def configured?, do: true
|
||||
|
||||
|
|
@ -16,7 +18,15 @@ defmodule TranslationMock do
|
|||
%{
|
||||
content: content |> String.reverse(),
|
||||
detected_source_language: source_language,
|
||||
provider: "TranslationMock"
|
||||
provider: @name
|
||||
}}
|
||||
end
|
||||
|
||||
@impl Provider
|
||||
def supported_languages(_) do
|
||||
["en", "pl"]
|
||||
end
|
||||
|
||||
@impl Provider
|
||||
def name, do: @name
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue