diff --git a/netbox/netbox/configuration_example.py b/netbox/netbox/configuration_example.py index f298b35fe..9d9651462 100644 --- a/netbox/netbox/configuration_example.py +++ b/netbox/netbox/configuration_example.py @@ -222,6 +222,9 @@ SESSION_COOKIE_NAME = 'sessionid' # database access.) Note that the user as which NetBox runs must have read and write permissions to this path. SESSION_FILE_PATH = None +# Localization +ENABLE_LOCALIZATION = False + # Time zone (default: UTC) TIME_ZONE = 'UTC' diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index cc0a3c016..f140b74cf 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -137,6 +137,7 @@ STORAGE_BACKEND = getattr(configuration, 'STORAGE_BACKEND', None) STORAGE_CONFIG = getattr(configuration, 'STORAGE_CONFIG', {}) TIME_FORMAT = getattr(configuration, 'TIME_FORMAT', 'g:i a') TIME_ZONE = getattr(configuration, 'TIME_ZONE', 'UTC') +ENABLE_LOCALIZATION = getattr(configuration, 'ENABLE_LOCALIZATION', False) # Check for hard-coded dynamic config parameters for param in PARAMS: @@ -340,7 +341,14 @@ MIDDLEWARE = [ 'django_prometheus.middleware.PrometheusBeforeMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.locale.LocaleMiddleware', +] + +if ENABLE_LOCALIZATION: + MIDDLEWARE.extend([ + 'django.middleware.locale.LocaleMiddleware', + ]) + +MIDDLEWARE.extend([ 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', @@ -354,7 +362,7 @@ MIDDLEWARE = [ 'netbox.middleware.APIVersionMiddleware', 'netbox.middleware.ObjectChangeMiddleware', 'django_prometheus.middleware.PrometheusAfterMiddleware', -] +]) ROOT_URLCONF = 'netbox.urls' @@ -651,6 +659,13 @@ RQ_QUEUES.update({ queue: RQ_PARAMS for queue in set(QUEUE_MAPPINGS.values()) if queue not in RQ_QUEUES }) +# +# Localization +# + +if not ENABLE_LOCALIZATION: + USE_I18N = False + USE_L10N = False # # Plugins