mirror of
https://github.com/netfun2000/hipudding-teslamate.git
synced 2026-02-27 09:44:28 +08:00
Set default LOCALE
This commit is contained in:
@@ -18,4 +18,6 @@ config :logger, :console,
|
||||
|
||||
config :phoenix, :json_library, Jason
|
||||
|
||||
config :gettext, :default_locale, "en"
|
||||
|
||||
import_config "#{Mix.env()}.exs"
|
||||
|
||||
@@ -4,9 +4,15 @@ defmodule Util do
|
||||
def random_encoded_bytes do
|
||||
:crypto.strong_rand_bytes(64) |> Base.encode64()
|
||||
end
|
||||
|
||||
def validate_locale!("en"), do: "en"
|
||||
def validate_locale!("de"), do: "de"
|
||||
def validate_locale!(lang), do: raise("Unsopported locale #{inspect(lang)}")
|
||||
end
|
||||
|
||||
config :gettext, :default_locale, System.get_env("LOCALE")
|
||||
config :gettext,
|
||||
:default_locale,
|
||||
System.get_env("LOCALE", "en") |> Util.validate_locale!()
|
||||
|
||||
config :teslamate, TeslaMate.Repo,
|
||||
username: System.fetch_env!("DATABASE_USER"),
|
||||
|
||||
@@ -43,7 +43,7 @@ defmodule TeslaMate.Locations.Geocoder do
|
||||
end
|
||||
|
||||
defp lang do
|
||||
Application.get_env(:gettext, :default_locale, "en")
|
||||
Application.fetch_env!(:gettext, :default_locale)
|
||||
end
|
||||
|
||||
# Address Formatting
|
||||
|
||||
Reference in New Issue
Block a user