mobilizon.chapril.org-mobil.../lib/web/views/utils.ex
Thomas Citharel ee20e03cc2
Migrate to Vue 3 and Vite
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2022-08-11 16:46:31 +02:00

17 lines
459 B
Elixir

defmodule Mobilizon.Web.Views.Utils do
@moduledoc """
Utils for views
"""
@spec get_locale(Plug.Conn.t()) :: String.t()
def get_locale(%Plug.Conn{assigns: assigns}) do
Map.get(assigns, :locale)
end
@ltr_languages ["ar", "ae", "he", "fa", "ku", "ur"]
@spec get_language_direction(String.t()) :: String.t()
def get_language_direction(locale) when locale in @ltr_languages, do: "rtl"
def get_language_direction(_locale), do: "ltr"
end