mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-25 03:40:31 +02:00
Translate messages from websockets
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -6,6 +6,7 @@ from random import randint
|
||||
from asgiref.sync import sync_to_async
|
||||
from channels.generic.websocket import AsyncJsonWebsocketConsumer
|
||||
from django.conf import settings
|
||||
from django.utils import translation
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from draw.models import Draw, Round, Pool, TeamDraw
|
||||
@ -70,6 +71,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
||||
.prefetch_related('draw__current_round__current_pool__current_team').aget()
|
||||
|
||||
match content['type']:
|
||||
case 'set_language':
|
||||
translation.activate(content['language'])
|
||||
case 'start_draw':
|
||||
await self.start_draw(**content)
|
||||
case 'abort':
|
||||
|
Reference in New Issue
Block a user