Only load all locales in prod mode

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-11-17 15:42:03 +01:00
parent 885b61dfd6
commit a115b49b4c
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
4 changed files with 31 additions and 27 deletions

View File

@ -181,26 +181,8 @@ config :http_signatures,
config :mobilizon, :cldr, config :mobilizon, :cldr,
locales: [ locales: [
"ar",
"be",
"ca",
"cs",
"de",
"en",
"es",
"fi",
"fr", "fr",
"gl", "en"
"hu",
"it",
"ja",
"nl",
"nn",
"oc",
"pl",
"pt",
"ru",
"sv"
] ]
config :mobilizon, :activitypub, config :mobilizon, :activitypub,

View File

@ -92,13 +92,6 @@ config :mobilizon, :instance,
# config :mobilizon, :activitypub, sign_object_fetches: false # config :mobilizon, :activitypub, sign_object_fetches: false
# No need to compile every locale in development environment
config :mobilizon, :cldr,
locales: [
"fr",
"en"
]
config :mobilizon, :anonymous, config :mobilizon, :anonymous,
reports: [ reports: [
allowed: true allowed: true

View File

@ -13,6 +13,31 @@ config :mobilizon, Mobilizon.Web.Endpoint,
# Do not print debug messages in production # Do not print debug messages in production
config :logger, level: :info config :logger, level: :info
# Load all locales in production
config :mobilizon, :cldr,
locales: [
"ar",
"be",
"ca",
"cs",
"de",
"en",
"es",
"fi",
"fr",
"gl",
"hu",
"it",
"ja",
"nl",
"nn",
"oc",
"pl",
"pt",
"ru",
"sv"
]
cond do cond do
System.get_env("INSTANCE_CONFIG") && System.get_env("INSTANCE_CONFIG") &&
File.exists?("./config/#{System.get_env("INSTANCE_CONFIG")}") -> File.exists?("./config/#{System.get_env("INSTANCE_CONFIG")}") ->

View File

@ -5,6 +5,10 @@ defmodule Mobilizon.Cldr do
use Cldr, use Cldr,
locales: Application.get_env(:mobilizon, :cldr)[:locales], locales: Application.get_env(:mobilizon, :cldr)[:locales],
gettext: Mobilizon.Web.Gettext, gettext:
if(Application.fetch_env!(:mobilizon, :env) == :prod,
do: Mobilizon.Web.Gettext,
else: nil
),
providers: [Cldr.Number, Cldr.Calendar, Cldr.DateTime, Cldr.Language] providers: [Cldr.Number, Cldr.Calendar, Cldr.DateTime, Cldr.Language]
end end