diff --git a/doc/source/configuration/settings.rst b/doc/source/configuration/settings.rst index cd60672c0e..d8906e738f 100644 --- a/doc/source/configuration/settings.rst +++ b/doc/source/configuration/settings.rst @@ -2504,3 +2504,20 @@ After the whole settings process has gone through, TEMPLATE_LOADERS will be: TEMPLATE_LOADERS += ( ('django.template.loaders.cached.Loader', CACHED_TEMPLATE_LOADERS), ) + tuple(ADD_TEMPLATE_LOADERS) + +LOCALE_PATHS +------------ + +.. versionadded:: 16.0.0(Train) + +.. seealso:: + + `Django's LOCALE_PATHS documentation + `_ + +Default: Absolute paths for `horizon/locale`, `openstack_auth/locale` and +`openstack_dashboard/locale` directories. + +Django uses relative paths by default so it causes localization issues +depending on your runtime settings. To avoid this we recommend to use absolute +paths for directories with locales. diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 5af70cffee..9d963ea7de 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -25,8 +25,12 @@ import warnings from django.utils.translation import pgettext_lazy from django.utils.translation import ugettext_lazy as _ +import openstack_auth + +import horizon from horizon.utils.escape import monkeypatch_escape +import openstack_dashboard from openstack_dashboard import enabled from openstack_dashboard import exceptions from openstack_dashboard.local import enabled as local_enabled @@ -523,7 +527,15 @@ HORIZON_COMPRESS_OFFLINE_CONTEXT_BASE = { if DEBUG: logging.basicConfig(level=logging.DEBUG) - +# NOTE(e0ne): Set absolute paths for directories with localization. +# Django doesn't work well for Taiwanese locale with relative paths +# wich are used by default and I can't figure out at the moment why it +# works in this way. We don't use default Django templates, so it should +# be safe to have such defaults +LOCALE_PATHS = [ + os.path.join(os.path.dirname(os.path.abspath(m.__file__)), 'locale') + for m in (horizon, openstack_dashboard, openstack_auth) +] # Here comes the Django settings deprecation section. Being at the very end # of settings.py allows it to catch the settings defined in local_settings.py # or inside one of local_settings.d/ snippets.