Browse Source

Updated the settings for translation

1Mike21 1 year ago
parent
commit
675a07cf4c
4 changed files with 32 additions and 9 deletions
  1. 13 0
      core/settings.py
  2. 16 9
      core/urls.py
  3. 1 0
      design_template
  4. 2 0
      install_win.bat

+ 13 - 0
core/settings.py

@@ -5,6 +5,8 @@ from core.api_settings import *
 from core.tickets_mail_settings import *
 from core.tickets_mail_settings import *
 from core.jazzmin_settings import *
 from core.jazzmin_settings import *
 import core.config as conf
 import core.config as conf
+from django.utils.translation import gettext_lazy as _
+
 # Build paths inside the project like this: BASE_DIR / 'subdir'.
 # Build paths inside the project like this: BASE_DIR / 'subdir'.
 BASE_DIR = Path(__file__).resolve().parent.parent
 BASE_DIR = Path(__file__).resolve().parent.parent
 # SECURITY WARNING: keep the secret key used in production secret!
 # SECURITY WARNING: keep the secret key used in production secret!
@@ -18,6 +20,7 @@ CSRF_TRUSTED_ORIGINS = conf.CSRF_TRUSTED_ORIGINS
 
 
 # Application definition
 # Application definition
 INSTALLED_APPS = [
 INSTALLED_APPS = [
+    'design_template',
     'jazzmin',
     'jazzmin',
     'django.contrib.admin',
     'django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.auth',
@@ -45,6 +48,7 @@ INSTALLED_APPS = [
 MIDDLEWARE = [
 MIDDLEWARE = [
     'django.middleware.security.SecurityMiddleware',
     'django.middleware.security.SecurityMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.locale.LocaleMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -122,6 +126,15 @@ USE_TZ = True
 
 
 SITE_ID = 1
 SITE_ID = 1
 
 
+LANGUAGES = [
+    ('ru', _('Russian')),
+    ('en', _('English')),
+]
+
+LOCALE_PATHS = [
+    BASE_DIR / 'locale',
+]
+
 # Static files (CSS, JavaScript, Images)
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/4.1/howto/static-files/
 # https://docs.djangoproject.com/en/4.1/howto/static-files/
 
 

+ 16 - 9
core/urls.py

@@ -2,6 +2,7 @@ from django.contrib import admin
 from django.conf import settings
 from django.conf import settings
 from django.urls import path, include
 from django.urls import path, include
 from django.conf.urls.static import static
 from django.conf.urls.static import static
+from django.conf.urls.i18n import i18n_patterns
 
 
 
 
 
 
@@ -9,17 +10,23 @@ urlpatterns = (
     [
     [
     path('admin/doc/', include('django.contrib.admindocs.urls')),
     path('admin/doc/', include('django.contrib.admindocs.urls')),
     path('admin/', admin.site.urls),
     path('admin/', admin.site.urls),
-    path('', include('SharixAdmin.urls')),
-    path('tickets/', include("tickets.urls"), name='tickets'),
-    #metaservice
-    path('metaservicesynced/', include("metaservicesynced.urls"), name="metaservicesynced"),
-    path('openlocal/', include("openlocal.urls"), name="openlocal"),
+
+    ] + i18n_patterns(
+        path('i18n/', include('django.conf.urls.i18n')),
+        path('', include('SharixAdmin.urls')),
+        path('tickets/', include("tickets.urls"), name='tickets'),
+        path('design/', include("design_template.urls"), name='design'),
+        #metaservice
+        path('metaservicesynced/', include("metaservicesynced.urls"), name="metaservicesynced"),
+        path('openlocal/', include("openlocal.urls"), name="openlocal"),
+        prefix_default_language=False,
+    )
+
     
     
 
 
-] 
-+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
-+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
-)
+    + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
+    + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+  )
 
 
 if settings.DEBUG:
 if settings.DEBUG:
     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

+ 1 - 0
design_template

@@ -0,0 +1 @@
+Subproject commit 8b2ce8edc6d922467cdd43eb585c5b7955478ad7

+ 2 - 0
install_win.bat

@@ -1,7 +1,9 @@
 @echo off
 @echo off
+git clone -b unstable https://git.sharix-app.org/ShariX_Open/sharix-open-webapp-design-template.git design_template 
 git clone -b unstable http://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git tickets
 git clone -b unstable http://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git tickets
 git clone -b metasynced_module http://git.sharix-app.org/ShariX_Open/sharix-open-backend.git metaservicesynced
 git clone -b metasynced_module http://git.sharix-app.org/ShariX_Open/sharix-open-backend.git metaservicesynced
 git clone -b webinterface https://git.sharix-app.org/ShariX_Open/sharix-open-webadmin.git SharixAdmin/templates/SharixAdmin
 git clone -b webinterface https://git.sharix-app.org/ShariX_Open/sharix-open-webadmin.git SharixAdmin/templates/SharixAdmin
 git clone -b master https://git.sharix-app.org/ShariX_Open/sharix-open-local.git openlocal
 git clone -b master https://git.sharix-app.org/ShariX_Open/sharix-open-local.git openlocal
+
 python -m venv env
 python -m venv env
 .\env\Scripts\activate && pip install -r requirements.txt && python manage.py makemigrations && python manage.py migrate && python manage.py createsuperuser && python manage.py runserver
 .\env\Scripts\activate && pip install -r requirements.txt && python manage.py makemigrations && python manage.py migrate && python manage.py createsuperuser && python manage.py runserver