mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-11 11:49:15 +00:00
Add test for fallbacking to a general language
This commit is contained in:
parent
ef73f61b07
commit
ff0bb3a3ac
1 changed files with 14 additions and 0 deletions
|
@ -33,6 +33,20 @@ defmodule Pleroma.Web.Plugs.SetLocalePlugTest do
|
||||||
assert %{locale: "ru"} == conn.assigns
|
assert %{locale: "ru"} == conn.assigns
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "fallback to the general language if a variant is not supported" do
|
||||||
|
conn =
|
||||||
|
:get
|
||||||
|
|> conn("/cofe")
|
||||||
|
|> Conn.put_req_header(
|
||||||
|
"accept-language",
|
||||||
|
"ru-CA;q=0.9, en;q=0.8, *;q=0.5"
|
||||||
|
)
|
||||||
|
|> SetLocalePlug.call([])
|
||||||
|
|
||||||
|
assert "ru" == Gettext.get_locale()
|
||||||
|
assert %{locale: "ru"} == conn.assigns
|
||||||
|
end
|
||||||
|
|
||||||
test "use supported locale with specifiers from `accept-language`" do
|
test "use supported locale with specifiers from `accept-language`" do
|
||||||
conn =
|
conn =
|
||||||
:get
|
:get
|
||||||
|
|
Loading…
Reference in a new issue