Skip to content

Commit

Permalink
Merge pull request #10 from hotosm/feat/hot-007/setup-localization
Browse files Browse the repository at this point in the history
Feat/hot 007/setup localization
  • Loading branch information
katporks authored Feb 8, 2024
2 parents 6598795 + 7bca15f commit 0a97d47
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 11 deletions.
11 changes: 11 additions & 0 deletions hot_osm/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"compressor",
"wagtail_localize",
"wagtail_localize.locales",
]

MIDDLEWARE = [
Expand All @@ -61,6 +63,7 @@
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.security.SecurityMiddleware",
"django.middleware.locale.LocaleMiddleware",
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
]

Expand Down Expand Up @@ -129,8 +132,16 @@

USE_I18N = True

WAGTAIL_I18N_ENABLED = True

USE_TZ = True

WAGTAIL_CONTENT_LANGUAGES = [
("en", "English"),
("fr", "French"),
("es", "Spanish"),
]


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
Expand Down
23 changes: 13 additions & 10 deletions hot_osm/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.urls import include, path
from wagtail import urls as wagtail_urls
Expand All @@ -11,7 +12,6 @@
path("django-admin/", admin.site.urls),
path("admin/", include(wagtailadmin_urls)),
path("documents/", include(wagtaildocs_urls)),
path("search/", search_views.search, name="search"),
path("__reload__/", include("django_browser_reload.urls")),
]

Expand All @@ -24,12 +24,15 @@
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns = urlpatterns + [
# For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in
# the list:
path("", include(wagtail_urls)),
# Alternatively, if you want Wagtail pages to be served from a subpath
# of your site, rather than the site root:
# path("pages/", include(wagtail_urls)),
]
urlpatterns.extend(
i18n_patterns(
# For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in
# the list:
path("", include(wagtail_urls)),
path("search/", search_views.search, name="search"),
# Alternatively, if you want Wagtail pages to be served from a subpath
# of your site, rather than the site root:
# path("pages/", include(wagtail_urls)),
)
)
35 changes: 34 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ python-dotenv = "^1.0.0"
docker = "^6.1.3"
gunicorn = "^21.2.0"
django-compressor = "^4.4"
wagtail-localize = "^1.7"

[tool.poetry.dev-dependencies]

Expand Down

0 comments on commit 0a97d47

Please sign in to comment.