Translation support and minor login view changes #35
|
@ -65,6 +65,9 @@ ENABLE_EMAIL = config("ENABLE_EMAIL", default=True, cast=bool)
|
|||
|
||||
EVIDENCES_DIR = config("EVIDENCES_DIR", default=os.path.join(BASE_DIR, "db"))
|
||||
|
||||
LOCALE_PATHS = [
|
||||
os.path.join(BASE_DIR, 'locale'),
|
||||
]
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
|
@ -116,7 +119,13 @@ TEMPLATES = [
|
|||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"django.template.context_processors.i18n",
|
||||
],
|
||||
|
||||
'libraries':{
|
||||
'get_language_code': 'dashboard.templatetags.language_code',
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
]
|
||||
|
@ -169,8 +178,9 @@ if TIME_ZONE == "UTC":
|
|||
|
||||
USE_L10N = True
|
||||
LANGUAGES = [
|
||||
('es', 'Spanish'),
|
||||
('en', 'English'),
|
||||
('es', 'spanish'),
|
||||
('en', 'english'),
|
||||
('ca', 'català'),
|
||||
]
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
|
|
12
dhub/urls.py
12
dhub/urls.py
|
@ -16,6 +16,10 @@ Including another URLconf
|
|||
"""
|
||||
|
||||
from django.urls import path, include
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.views.i18n import set_language
|
||||
|
||||
urlpatterns = [
|
||||
# path('api/', include('snapshot.urls')),
|
||||
|
@ -28,3 +32,11 @@ urlpatterns = [
|
|||
path("lot/", include("lot.urls")),
|
||||
path('api/', include('api.urls')),
|
||||
]
|
||||
|
||||
urlpatterns += i18n_patterns(
|
||||
path("language/", set_language, name='set_language'),
|
||||
)
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
|
Loading…
Reference in a new issue