fix locales with more than 2 parts

This commit is contained in:
Alex
2024-08-22 17:52:43 +02:00
parent 1d751249be
commit 5546fedba1

View File

@@ -117,10 +117,9 @@ defmodule ClaperWeb.Plugs.Locale do
end
defp fallback_tags(tag, tags) do
case String.split(tag, "-") do
case String.split(tag, "-", parts: 2) do
[language, _country_variant] ->
if Enum.member?(tags, language), do: [tag], else: [tag, language]
[_language] ->
[tag]
end