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,
locales: [
"ar",
"be",
"ca",
"cs",
"de",
"en",
"es",
"fi",
"fr",
"gl",
"hu",
"it",
"ja",
"nl",
"nn",
"oc",
"pl",
"pt",
"ru",
"sv"
"en"
]
config :mobilizon, :activitypub,

View File

@ -92,13 +92,6 @@ config :mobilizon, :instance,
# 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,
reports: [
allowed: true

View File

@ -13,6 +13,31 @@ config :mobilizon, Mobilizon.Web.Endpoint,
# Do not print debug messages in production
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
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,
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]
end