2022-10-30 13:06:31 -07:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule TranslationMock do
|
2022-10-31 13:58:10 -07:00
|
|
|
alias Pleroma.Language.Translation.Provider
|
2022-10-30 13:06:31 -07:00
|
|
|
|
2024-02-13 11:08:17 -08:00
|
|
|
use Provider
|
|
|
|
|
2022-10-31 13:58:10 -07:00
|
|
|
@behaviour Provider
|
2022-10-30 13:06:31 -07:00
|
|
|
|
2022-11-08 14:09:42 -08:00
|
|
|
@name "TranslationMock"
|
|
|
|
|
2022-10-31 13:58:10 -07:00
|
|
|
@impl Provider
|
2022-10-30 13:06:31 -07:00
|
|
|
def configured?, do: true
|
|
|
|
|
2022-10-31 13:58:10 -07:00
|
|
|
@impl Provider
|
2022-10-30 13:06:31 -07:00
|
|
|
def translate(content, source_language, _target_language) do
|
|
|
|
{:ok,
|
|
|
|
%{
|
|
|
|
content: content |> String.reverse(),
|
|
|
|
detected_source_language: source_language,
|
2022-11-08 14:09:42 -08:00
|
|
|
provider: @name
|
2022-10-30 13:06:31 -07:00
|
|
|
}}
|
|
|
|
end
|
2022-11-08 14:09:42 -08:00
|
|
|
|
|
|
|
@impl Provider
|
|
|
|
def supported_languages(_) do
|
2023-05-13 04:22:04 -07:00
|
|
|
{:ok, ["en", "pl"]}
|
|
|
|
end
|
|
|
|
|
|
|
|
@impl Provider
|
|
|
|
def languages_matrix do
|
|
|
|
{:ok,
|
|
|
|
%{
|
|
|
|
"en" => ["pl"],
|
|
|
|
"pl" => ["en"]
|
|
|
|
}}
|
2022-11-08 14:09:42 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
@impl Provider
|
|
|
|
def name, do: @name
|
2022-10-30 13:06:31 -07:00
|
|
|
end
|