Add language selection feature and internationalization support

This commit is contained in:
Eduardo Silva 2025-04-14 15:42:12 -03:00
parent 701f957642
commit e430580aba
18 changed files with 261 additions and 107 deletions

View file

@ -10,6 +10,7 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/ref/settings/
"""
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -38,6 +39,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'crispy_forms',
'crispy_bootstrap4',
'intl_tools',
'wireguard',
'user_manager',
'wireguard_tools',
@ -49,6 +51,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
@ -113,17 +116,22 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LANGUAGES = [
('pt-br', 'Português'),
('en', 'English'),
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/
LOCALE_PATHS = [
os.path.join(BASE_DIR, 'locale'),
]
STATIC_URL = 'static/'
STATIC_ROOT = '/app_static_files/'