forked from AkkomaGang/akkoma
Add test for fallbacking to a general language
This commit is contained in:
parent
8de573b047
commit
bc59da96c5
1 changed files with 14 additions and 0 deletions
|
@ -33,6 +33,20 @@ test "use supported locale from `accept-language`" 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