diff --git a/app.py b/app.py index 625731f..5a22c98 100644 --- a/app.py +++ b/app.py @@ -10,6 +10,7 @@ from aztec_code_generator import AztecCode from propic import resetDefaultPropic from io import BytesIO from asyncio import Queue +from messages import LOCALES import sqlite3 from sanic.log import logger @@ -58,6 +59,7 @@ async def main_start(*_): app.ctx.tpl = Environment(loader=FileSystemLoader("tpl"), autoescape=True) app.ctx.tpl.globals.update(time=time) app.ctx.tpl.globals.update(PROPIC_DEADLINE=PROPIC_DEADLINE) + app.ctx.tpl.globals.update(LOCALES=LOCALES) app.ctx.tpl.globals.update(ITEMS_ID_MAP=ITEMS_ID_MAP) app.ctx.tpl.globals.update(ITEM_VARIATIONS_MAP=ITEM_VARIATIONS_MAP) app.ctx.tpl.globals.update(ROOM_TYPE_NAMES=ROOM_TYPE_NAMES) diff --git a/config.example.py b/config.example.py index 9fb4eda..316e9ff 100644 --- a/config.example.py +++ b/config.example.py @@ -33,6 +33,11 @@ DEV_MODE = True ACCESS_LOG = True EXTRA_PRINTS = True +# Additional configured locales. +# If an order has a country that's not listed here, +# Will default to an english preference. +AVAILABLE_LOCALES = ['it',] + # Metadata property for item-id mapping METADATA_NAME = "item_name" # Metadata property for internal category mapping (not related to pretix's category) diff --git a/ext.py b/ext.py index 376606a..5ececfc 100644 --- a/ext.py +++ b/ext.py @@ -131,6 +131,7 @@ class Order: self.actual_room = self.ans('actual_room') self.staff_role = self.ans('staff_role') self.telegram_username = self.ans('telegram_username').strip('@') if self.ans('telegram_username') else None + self.shuttle_bus = self.ans('shuttle_bus') def __getitem__(self, var): return self.data[var] @@ -215,7 +216,7 @@ class Order: if res.status_code != 200: for ans, err in zip(self.answers, res.json()['answers']): if err: - logger.error ('[ANSWERS SENDING] ERROR ON', ans, err) + logger.error ('[ANSWERS SENDING] ERROR ON %s %s', ans, err) raise exceptions.ServerError('There has been an error while updating this answers.') @@ -226,7 +227,9 @@ class Order: self.pending_update = False self.time = -1 self.loadAns() - + + def get_language(self): + return self.country.lower() if self.country.lower() in AVAILABLE_LOCALES else 'en' @dataclass class Quotas: diff --git a/messages.py b/messages.py index 7358600..2a3fa24 100644 --- a/messages.py +++ b/messages.py @@ -10,4 +10,15 @@ ROOM_UNCONFIRM_TITLE = "Your room got unconfirmed" ROOM_UNCONFIRM_TEXT = { 'html': "Hello {0}
We had to unconfirm your room '{1}' due to the following issues:

{2}

Please contact your room's owner or contact our support for further informations at https://furizon.net/contact/.
Thank you.

Manage booking", 'plain': "Hello {0}\nWe had to unconfirm your room '{1}' due to the following issues:\n{2}\nPlease contact your room's owner or contact our support for further informations at https://furizon.net/contact/.\nThank you\n\nTo manage your booking: https://reg.furizon.net/manage/welcome" +} + +LOCALES = { + 'shuttle_link': { + 'en': 'Book now', + 'it': 'Prenota ora' + }, + 'shuttle_link_url': { + 'en': 'https://visitfiemme.regiondo.com/furizon?_ga=2.129644046.307369854.1705325023-235291123.1705325023', + 'it': 'https://experience.visitfiemme.it/furizon' + } } \ No newline at end of file diff --git a/res/icons/bus.svg b/res/icons/bus.svg new file mode 100644 index 0000000..587488a --- /dev/null +++ b/res/icons/bus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tpl/welcome.html b/tpl/welcome.html index fcca3d9..1c06f89 100644 --- a/tpl/welcome.html +++ b/tpl/welcome.html @@ -10,6 +10,7 @@ {% endblock %} {% block main %} +{% set locale = order.get_language() %}

@@ -67,6 +68,15 @@ {% endif %} + {% if order.shuttle_bus %} + + Shuttle + + + {{order.shuttle_bus}} + + + {% endif %}

Manage your booking

@@ -76,6 +86,12 @@ {% endif %} {% include 'blocks/badge.html' %} +
+ Shuttle +

This year we teamed up with VisitFiemme to take our guests to the convention.

+

Book now

+
+
Barcard

This year's badges will be NFC-enabled and serve as a digital barcard, allowing you to load 'drinks' onto your badge and use it to purchase beverages at the bar without the need for physical cash or the risk of losing a paper barcard. The barcard system will be enabled closer to the convention, so you will have the opportunity to load your badge in advance and enjoy a convenient, cashless experience at the event. Keep an eye out for updates on when the system will be live and available for use.

diff --git a/utils.py b/utils.py index f3c3adf..e8da527 100644 --- a/utils.py +++ b/utils.py @@ -170,7 +170,7 @@ async def validate_rooms(request, rooms, om): logger.info('[ROOM VALIDATION] Every room passed the check.') return - logger.warning(f'[ROOM VALIDATION] Room validation failed for orders: ', list(map(lambda rf: rf[0].code, failed_rooms))) + logger.warning(f'[ROOM VALIDATION] Room validation failed for orders: %s', list(map(lambda rf: rf[0].code, failed_rooms))) # Get confirmed rooms that fail validation failed_confirmed_rooms = list(filter(lambda fr: (fr[0].room_confirmed == True), failed_rooms))