feat: enable translations
This commit is contained in:
parent
94482f1696
commit
e98db55a16
2 changed files with 21 additions and 1 deletions
|
@ -43,6 +43,7 @@ INSTALLED_APPS = [
|
||||||
"wagtail.images",
|
"wagtail.images",
|
||||||
"wagtail.search",
|
"wagtail.search",
|
||||||
"wagtail.admin",
|
"wagtail.admin",
|
||||||
|
"wagtail.locales",
|
||||||
"wagtail",
|
"wagtail",
|
||||||
"modelcluster",
|
"modelcluster",
|
||||||
"taggit",
|
"taggit",
|
||||||
|
@ -68,6 +69,7 @@ MIDDLEWARE = [
|
||||||
"django.middleware.security.SecurityMiddleware",
|
"django.middleware.security.SecurityMiddleware",
|
||||||
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
|
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
|
||||||
"blog.middleware.BlogRedirectMiddleware",
|
"blog.middleware.BlogRedirectMiddleware",
|
||||||
|
"django.middleware.locale.LocaleMiddleware",
|
||||||
"django_browser_reload.middleware.BrowserReloadMiddleware"
|
"django_browser_reload.middleware.BrowserReloadMiddleware"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -128,7 +130,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/5.0/topics/i18n/
|
# https://docs.djangoproject.com/en/5.0/topics/i18n/
|
||||||
|
|
||||||
LANGUAGE_CODE = "en-us"
|
LANGUAGE_CODE = "en"
|
||||||
|
|
||||||
TIME_ZONE = "UTC"
|
TIME_ZONE = "UTC"
|
||||||
|
|
||||||
|
@ -136,6 +138,16 @@ USE_I18N = True
|
||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
|
WAGTAIL_I18N_ENABLED = True
|
||||||
|
|
||||||
|
USE_L10N = True # allows dates to be shown in the user's locale
|
||||||
|
|
||||||
|
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [
|
||||||
|
('en', "English"),
|
||||||
|
('fr', "French"),
|
||||||
|
('es', "Spanish"),
|
||||||
|
('nl', "Dutch"),
|
||||||
|
]
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.conf.urls.i18n import i18n_patterns
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.views.generic.base import TemplateView
|
from django.views.generic.base import TemplateView
|
||||||
|
@ -25,6 +26,13 @@ urlpatterns = [
|
||||||
path('newsletter/thanks', newsletter_views.thanks, name='thanks')
|
path('newsletter/thanks', newsletter_views.thanks, name='thanks')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Translatable URLs
|
||||||
|
# These will be available under a language code prefix. For example /en/search/
|
||||||
|
urlpatterns += i18n_patterns(
|
||||||
|
path("", include(wagtail_urls)),
|
||||||
|
prefix_default_language=False,
|
||||||
|
)
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue