Skip to content

Commit

Permalink
Translations
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed May 21, 2024
1 parent 70f0ed9 commit 2e6cef3
Show file tree
Hide file tree
Showing 8 changed files with 567 additions and 308 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ def __init__(self, message_adapter, booking, request) -> None:
self.request = request

def send(self) -> bool:
import pdb

pdb.set_trace()
from .. import write_message_to_object_history

supervisor = getUtility(IBookingNotificatorSupervisorUtility)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ def send(self, force=False):
If True, the message will be sent even if the email is not allowed
(ie. for operator notifications)
"""
import pdb

pdb.set_trace()
message = self.message_adapter.message

if force or getUtility(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ def __init__(self, message_adapter, booking, request) -> None:
self.request = request

def send(self):
import pdb

pdb.set_trace()
if self.is_notification_allowed():
# dont foget to write the history log about sending
# self.write_message_to_booking_history(self.booking, self.message_adapter.message_history)
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

272 changes: 179 additions & 93 deletions src/redturtle/prenotazioni/locales/redturtle.prenotazioni.pot

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<dc-workflow description="Workflow for Prenotazione content type"
<dc-workflow
i18n:domain="redturtle.prenotazioni"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
description="Workflow for Prenotazione content type"
initial_state="private"
manager_bypass="False"
state_variable="review_state"
Expand All @@ -11,9 +14,8 @@
<permission>View</permission>
<permission>Review portal content</permission>
<permission>redturtle.prenotazioni: Manage Prenotazioni</permission>
<state state_id="pending"
title="In attesa"
>
<state state_id="pending">
<title i18n:translate="">Pending</title>
<description>Waiting to be reviewed, not editable by the owner and not visible</description>
<exit-transition transition_id="confirm" />
<exit-transition transition_id="refuse" />
Expand Down Expand Up @@ -53,9 +55,8 @@
<permission-role>Bookings Manager</permission-role>
</permission-map>
</state>
<state state_id="private"
title="Private"
>
<state state_id="private">
<title i18n:translate="">Private</title>
<description>Fake initial state, immediately changed</description>
<exit-transition transition_id="submit" />
<permission-map acquired="False"
Expand Down Expand Up @@ -95,9 +96,8 @@
<permission-role>Bookings Manager</permission-role>
</permission-map>
</state>
<state state_id="confirmed"
title="Confermato"
>
<state state_id="confirmed">
<title i18n:translate="">Confirmed</title>
<exit-transition transition_id="refuse" />
<exit-transition transition_id="cancel" />
<permission-map acquired="False"
Expand Down Expand Up @@ -135,9 +135,8 @@
<permission-role>Bookings Manager</permission-role>
</permission-map>
</state>
<state state_id="refused"
title="Rifiutato"
>
<state state_id="refused">
<title i18n:translate="">Refused</title>
<exit-transition transition_id="restore" />
<permission-map acquired="False"
name="Access contents information"
Expand Down Expand Up @@ -174,9 +173,8 @@
<permission-role>Bookings Manager</permission-role>
</permission-map>
</state>
<state state_id="canceled"
title="Annullato"
>
<state state_id="canceled">
<title i18n:translate="">Canceled</title>
<exit-transition transition_id="restore" />
<permission-map acquired="False"
name="Access contents information"
Expand Down Expand Up @@ -212,7 +210,7 @@
<permission-role>Reviewer</permission-role>
<permission-role>Bookings Manager</permission-role>
</permission-map>
</state>
</state>
<transition after_script=""
before_script=""
new_state="confirmed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from plone.restapi.interfaces import IFieldSerializer
from plone.restapi.interfaces import ISerializeToJson
from plone.restapi.serializer.converters import json_compatible
from Products.CMFCore.utils import getToolByName
from zope.component import adapter
from zope.component import getMultiAdapter
from zope.i18n import translate
from zope.interface import implementer
from zope.interface.interfaces import ComponentLookupError
from zope.publisher.interfaces import IRequest
Expand All @@ -19,6 +19,15 @@
from redturtle.prenotazioni.interfaces import ISerializeToPrenotazioneSearchableItem


def get_state_title(context, review_state):
portal_workflow = getToolByName(context, "portal_workflow")

return (
portal_workflow.getTitleForStateOnType(review_state, context.portal_type)
or "Unknows state"
)


@implementer(ISerializeToJson)
@adapter(IPrenotazione, IRequest)
class PrenotazioneSerializer:
Expand Down Expand Up @@ -59,6 +68,7 @@ def __call__(self, *args, **kwargs):
booking_expiration_date = booking_expiration_date.replace(
booking_date.year, booking_date.month, booking_date.day
)

return {
"@id": self.prenotazione.absolute_url(),
"UID": self.prenotazione.UID(),
Expand All @@ -75,8 +85,8 @@ def __call__(self, *args, **kwargs):
"booking_date": json_compatible(booking_date),
"booking_expiration_date": json_compatible(booking_expiration_date),
"booking_status": status["review_state"],
"booking_status_label": translate(
status["review_state"], context=self.request
"booking_status_label": get_state_title(
self.prenotazione, status["review_state"]
),
"booking_type": self.prenotazione.booking_type,
"booking_folder_uid": booking_folder.UID(),
Expand Down Expand Up @@ -115,8 +125,8 @@ def __call__(self, *args, **kwargs):
# "booking_room": None,
"booking_gate": self.prenotazione.gate,
"booking_status": status["review_state"],
"booking_status_label": translate(
status["review_state"], context=self.request
"booking_status_label": get_state_title(
self.prenotazione, status["review_state"]
),
"booking_status_date": json_compatible(status["time"]),
"booking_status_notes": status["comments"],
Expand Down

0 comments on commit 2e6cef3

Please sign in to comment.