Add Internationalization & localization
This commit is contained in:
parent
e37c412fd9
commit
f68db77e82
18 changed files with 488 additions and 257 deletions
|
@ -1,5 +1,7 @@
|
|||
from pathlib import Path
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
@ -13,6 +15,24 @@ ALLOWED_HOSTS = []
|
|||
|
||||
INTERNAL_IPS = ['localhost', '127.0.0.1',]
|
||||
|
||||
#
|
||||
|
||||
LANGUAGES = [
|
||||
('en', _('English')),
|
||||
('fi', _('Finnish')),
|
||||
]
|
||||
|
||||
LANGUAGE_CODE = 'en'
|
||||
|
||||
USE_I18N = True
|
||||
USE_L10N = True
|
||||
USE_TZ = True
|
||||
|
||||
LOCALE_PATHS = [
|
||||
BASE_DIR / 'locale',
|
||||
]
|
||||
|
||||
|
||||
# Application definition
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
|
@ -30,6 +50,7 @@ INSTALLED_APPS = [
|
|||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware', # Locale
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue