Skip to content

Commit

Permalink
Merge pull request #27 from amakarudze/I18n
Browse files Browse the repository at this point in the history
Add support for internationalisation and localisation and French as a language
  • Loading branch information
amakarudze authored Dec 29, 2024
2 parents 1a69fed + f8b8cec commit 0b62158
Show file tree
Hide file tree
Showing 10 changed files with 2,045 additions and 40 deletions.
13 changes: 13 additions & 0 deletions core/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
import os
from pathlib import Path


# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

SITE_ID = 1

# Application definition

INSTALLED_APPS = [
Expand Down Expand Up @@ -46,6 +49,7 @@
"django.contrib.messages.middleware.MessageMiddleware",
"allauth.account.middleware.AccountMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.locale.LocaleMiddleware",
]

ROOT_URLCONF = "core.urls"
Expand Down Expand Up @@ -106,8 +110,17 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True

LANGUAGES = [
('en', 'English'),
('fr', 'French'),
]

LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')]


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
Expand Down
2 changes: 2 additions & 0 deletions core/settings_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

SECRET_KEY = "not really a secret"
DEBUG = True
BASE_URL = "localhost"
ALLOWED_HOSTS = []

MIDDLEWARE += [ # noqa: F405
"django_browser_reload.middleware.BrowserReloadMiddleware",
Expand Down
4 changes: 2 additions & 2 deletions core/settings_prod.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .settings_base import * # noqa: F403
import dj_database_url

ALLOWED_HOSTS = ["localhost", "127.0.0.1", "2025.djangocon.africa"]

ALLOWED_HOSTS = ["2025.djangocon.africa"]
BASE_URL = "https://2025.djangocon.africa"

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ["DJANGO_SECRET"] # noqa: F405
Expand Down
9 changes: 9 additions & 0 deletions core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.urls import path, include

Expand All @@ -24,4 +25,12 @@
path("proposals/", include("proposals.urls")),
path("admin/", admin.site.urls),
path("__reload__/", include("django_browser_reload.urls")),
path('i18n/', include('django.conf.urls.i18n')),
]

urlpatterns += i18n_patterns(
path("", include("website.urls")),
path("accounts/", include("allauth.urls")),
path("proposals/", include("proposals.urls")),
path("admin/", admin.site.urls),
)
Loading

0 comments on commit 0b62158

Please sign in to comment.