From fcfb5a4967621be57006fdc62e30957ca381d846 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Thu, 3 Mar 2022 09:40:18 -0500 Subject: [PATCH] Lint --- lib/pleroma/web/gettext.ex | 5 +++-- test/pleroma/web/plugs/set_locale_plug_test.exs | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/gettext.ex b/lib/pleroma/web/gettext.ex index cd795008d..89feb0bb3 100644 --- a/lib/pleroma/web/gettext.ex +++ b/lib/pleroma/web/gettext.ex @@ -58,7 +58,8 @@ defmodule Pleroma.Web.Gettext do def ensure_fallbacks(locales) do locales |> Enum.flat_map(fn locale -> - others = other_supported_variants_of_locale(locale) + others = + other_supported_variants_of_locale(locale) |> Enum.filter(fn l -> not Enum.member?(locales, l) end) [locale] ++ others @@ -80,7 +81,7 @@ defmodule Pleroma.Web.Gettext do end end - def get_locales() do + def get_locales do Process.get({Pleroma.Web.Gettext, :locales}, []) end diff --git a/test/pleroma/web/plugs/set_locale_plug_test.exs b/test/pleroma/web/plugs/set_locale_plug_test.exs index ff04a859e..f9d34bbe4 100644 --- a/test/pleroma/web/plugs/set_locale_plug_test.exs +++ b/test/pleroma/web/plugs/set_locale_plug_test.exs @@ -87,7 +87,9 @@ defmodule Pleroma.Web.Plugs.SetLocalePlugTest do |> SetLocalePlug.call([]) assert "zh_Hans" == Gettext.get_locale() - assert %{locale: "zh_Hans", locales: ["zh_Hans", "uk", "zh_Hant", "ru", "fr", "en"]} = conn.assigns + + assert %{locale: "zh_Hans", locales: ["zh_Hans", "uk", "zh_Hant", "ru", "fr", "en"]} = + conn.assigns end test "fallback to some variant of the language if the unqualified language is not supported" do