InstanceView: Move supported languages to pleroma.metadata
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
e675fed7e9
commit
8447fbfba2
1 changed files with 28 additions and 28 deletions
|
@ -204,36 +204,10 @@ def configuration2 do
|
|||
configuration()
|
||||
|> Map.merge(%{
|
||||
urls: %{streaming: Pleroma.Web.Endpoint.websocket_url()},
|
||||
translation: translation_config()
|
||||
translation: %{enabled: Pleroma.Language.Translation.configured?()}
|
||||
})
|
||||
end
|
||||
|
||||
defp translation_config do
|
||||
enabled = Pleroma.Language.Translation.configured?()
|
||||
|
||||
source_languages =
|
||||
with true <- enabled,
|
||||
{:ok, languages} <- Pleroma.Language.Translation.supported_languages(:source) do
|
||||
languages
|
||||
else
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
target_languages =
|
||||
with true <- enabled,
|
||||
{:ok, languages} <- Pleroma.Language.Translation.supported_languages(:target) do
|
||||
languages
|
||||
else
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
%{
|
||||
enabled: enabled,
|
||||
source_languages: source_languages,
|
||||
target_languages: target_languages
|
||||
}
|
||||
end
|
||||
|
||||
defp pleroma_configuration(instance) do
|
||||
%{
|
||||
metadata: %{
|
||||
|
@ -245,7 +219,8 @@ defp pleroma_configuration(instance) do
|
|||
privileged_staff: Config.get([:instance, :privileged_staff]),
|
||||
birthday_required: Config.get([:instance, :birthday_required]),
|
||||
birthday_min_age: Config.get([:instance, :birthday_min_age]),
|
||||
migration_cooldown_period: Config.get([:instance, :migration_cooldown_period])
|
||||
migration_cooldown_period: Config.get([:instance, :migration_cooldown_period]),
|
||||
translation: supported_languages
|
||||
},
|
||||
stats: %{mau: Pleroma.User.active_user_count()},
|
||||
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key),
|
||||
|
@ -274,6 +249,31 @@ defp pleroma_configuration2(instance) do
|
|||
})
|
||||
end
|
||||
|
||||
defp supported_languages do
|
||||
enabled = Pleroma.Language.Translation.configured?()
|
||||
|
||||
source_languages =
|
||||
with true <- enabled,
|
||||
{:ok, languages} <- Pleroma.Language.Translation.supported_languages(:source) do
|
||||
languages
|
||||
else
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
target_languages =
|
||||
with true <- enabled,
|
||||
{:ok, languages} <- Pleroma.Language.Translation.supported_languages(:target) do
|
||||
languages
|
||||
else
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
%{
|
||||
source_languages: source_languages,
|
||||
target_languages: target_languages
|
||||
}
|
||||
end
|
||||
|
||||
defp contact_account(nil), do: nil
|
||||
|
||||
defp contact_account("@" <> username) do
|
||||
|
|
Loading…
Reference in a new issue