Use wagtail-localize for translations
This commit is contained in:
parent
71c3deba47
commit
ad380f741e
|
|
@ -92,7 +92,9 @@ THIRD_PARTY_APPS = [
|
|||
'wagtail.search',
|
||||
'wagtail.admin',
|
||||
'wagtail',
|
||||
'wagtail.locales',
|
||||
# 'wagtail.locales',
|
||||
"wagtail_localize",
|
||||
"wagtail_localize.locales",
|
||||
'wagtail.api.v2',
|
||||
|
||||
'modelcluster',
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ django==3.2.13
|
|||
# djangorestframework
|
||||
# drf-spectacular
|
||||
# wagtail
|
||||
# wagtail-localize
|
||||
django-click==2.3.0
|
||||
# via -r requirements.in
|
||||
django-cors-headers==3.11.0
|
||||
|
|
@ -262,6 +263,8 @@ platformdirs==2.5.1
|
|||
# virtualenv
|
||||
pluggy==1.0.0
|
||||
# via pytest
|
||||
polib==1.1.1
|
||||
# via wagtail-localize
|
||||
portalocker==2.4.0
|
||||
# via concurrent-log-handler
|
||||
pre-commit==2.17.0
|
||||
|
|
@ -400,6 +403,7 @@ typing-extensions==4.1.1
|
|||
# django-stubs-ext
|
||||
# djangorestframework-stubs
|
||||
# mypy
|
||||
# wagtail-localize
|
||||
uritemplate==4.1.1
|
||||
# via
|
||||
# coreapi
|
||||
|
|
@ -414,12 +418,15 @@ uvloop==0.16.0
|
|||
# via uvicorn
|
||||
virtualenv==20.14.0
|
||||
# via pre-commit
|
||||
wagtail==3.0.0
|
||||
wagtail==3.0.1
|
||||
# via
|
||||
# -r requirements.in
|
||||
# wagtail-factories
|
||||
# wagtail-localize
|
||||
wagtail-factories==2.0.1
|
||||
# via -r requirements.in
|
||||
wagtail-localize==1.2.1
|
||||
# via -r requirements.in
|
||||
watchdog==2.1.7
|
||||
# via werkzeug
|
||||
watchgod==0.8.1
|
||||
|
|
|
|||
|
|
@ -35,3 +35,4 @@ concurrent-log-handler
|
|||
|
||||
wagtail>=3,<4
|
||||
wagtail-factories
|
||||
wagtail-localize
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ django==3.2.13
|
|||
# djangorestframework
|
||||
# drf-spectacular
|
||||
# wagtail
|
||||
# wagtail-localize
|
||||
django-click==2.3.0
|
||||
# via -r requirements.in
|
||||
django-cors-headers==3.11.0
|
||||
|
|
@ -134,6 +135,8 @@ pillow==9.0.1
|
|||
# via
|
||||
# -r requirements.in
|
||||
# wagtail
|
||||
polib==1.1.1
|
||||
# via wagtail-localize
|
||||
portalocker==2.4.0
|
||||
# via concurrent-log-handler
|
||||
psycopg2-binary==2.9.3
|
||||
|
|
@ -192,6 +195,8 @@ telepath==0.2
|
|||
# via wagtail
|
||||
text-unidecode==1.3
|
||||
# via python-slugify
|
||||
typing-extensions==4.2.0
|
||||
# via wagtail-localize
|
||||
uritemplate==4.1.1
|
||||
# via drf-spectacular
|
||||
urllib3==1.26.9
|
||||
|
|
@ -202,12 +207,15 @@ uvicorn[standard]==0.17.6
|
|||
# via -r requirements.in
|
||||
uvloop==0.16.0
|
||||
# via uvicorn
|
||||
wagtail==3.0.0
|
||||
wagtail==3.0.1
|
||||
# via
|
||||
# -r requirements.in
|
||||
# wagtail-factories
|
||||
# wagtail-localize
|
||||
wagtail-factories==2.0.1
|
||||
# via -r requirements.in
|
||||
wagtail-localize==1.2.1
|
||||
# via -r requirements.in
|
||||
watchgod==0.8.1
|
||||
# via uvicorn
|
||||
webencodings==0.5.1
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ def mark_circle_completion(request):
|
|||
page_key = request.data.get('page_key')
|
||||
completed = request.data.get('completed', True)
|
||||
|
||||
page = Page.objects.get(translation_key=page_key)
|
||||
page = Page.objects.get(translation_key=page_key, locale__language_code='de-CH')
|
||||
page_type = get_wagtail_type(page.specific)
|
||||
circle = Circle.objects.ancestor_of(page).first()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import wagtail_factories
|
||||
from django.conf import settings
|
||||
from wagtail.models import Site, Page
|
||||
from django.core.management import call_command
|
||||
from wagtail.models import Site, Page, Locale
|
||||
from wagtail_localize.models import LocaleSynchronization
|
||||
|
||||
from vbv_lernwelt.core.admin import User
|
||||
from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningContent
|
||||
|
|
@ -22,6 +24,7 @@ def create_default_learning_path(user=None):
|
|||
site.port = 8000
|
||||
site.save()
|
||||
|
||||
|
||||
# create_default_competences()
|
||||
|
||||
lp = LearningPathFactory(title="Versicherungsvermittler/in", parent=site.root_page)
|
||||
|
|
@ -404,6 +407,21 @@ Fachspezialisten bei.
|
|||
# tp = TopicFactory.create(title="Prüfung", is_visible=False, learning_path=lp)
|
||||
# circle_7 = CircleFactory.create(title="Prüfungsvorbereitung", parent=lp, topic=tp)
|
||||
|
||||
|
||||
# locales
|
||||
locale_de = Locale.objects.get(language_code='de-CH')
|
||||
locale_fr, _ = Locale.objects.get_or_create(language_code='fr-CH')
|
||||
LocaleSynchronization.objects.get_or_create(
|
||||
locale_id=locale_fr.id,
|
||||
sync_from_id=locale_de.id
|
||||
)
|
||||
locale_it, _ = Locale.objects.get_or_create(language_code='it-CH')
|
||||
LocaleSynchronization.objects.get_or_create(
|
||||
locale_id=locale_it.id,
|
||||
sync_from_id=locale_de.id
|
||||
)
|
||||
call_command('sync_locale_trees')
|
||||
|
||||
# all pages belong to 'admin' by default
|
||||
Page.objects.update(owner=user)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue