diff --git a/appointment/services.py b/appointment/services.py index e6fa932..0b2bf07 100644 --- a/appointment/services.py +++ b/appointment/services.py @@ -63,9 +63,9 @@ def prepare_appointment_display_data(user, appointment_id): return None, None, _("You are not authorized to view this appointment."), 403 # Prepare the data for display - page_title = _("Appointment Details for {client_name}").format(client_name=appointment.get_client_name()) + page_title = _("Appointment details: {client_name}").format(client_name=appointment.get_client_name()) if user.is_superuser: - page_title += f' ({appointment.get_staff_member_name()})' + page_title += f' (by: {appointment.get_staff_member_name()})' return appointment, page_title, None, 200 diff --git a/appointment/templates/administration/manage_working_hours.html b/appointment/templates/administration/manage_working_hours.html index c242627..32cafec 100644 --- a/appointment/templates/administration/manage_working_hours.html +++ b/appointment/templates/administration/manage_working_hours.html @@ -36,7 +36,7 @@

{% trans "Manage Working Hours" %}

- +
{% trans "Manage Working Hours" %}
- +
{% trans 'Personal Information' %}
-

{% trans 'First Name' %}: {{ user.first_name }}

-

{% trans 'Last Name' %}: {{ user.last_name }}

+

{% trans 'First name' %}: {{ user.first_name }}

+

{% trans 'Last name' %}: {{ user.last_name }}

{% trans 'Email' %}: {{ user.email }}

{% trans 'Days Off' %} - - + + @@ -161,8 +161,8 @@

{% trans 'Working Hours' %}

- - + + @@ -229,7 +229,7 @@

{% trans 'Service Offered' %}

- + diff --git a/appointment/templates/appointment/appointment_client_information.html b/appointment/templates/appointment/appointment_client_information.html index b5b5f63..18b584b 100644 --- a/appointment/templates/appointment/appointment_client_information.html +++ b/appointment/templates/appointment/appointment_client_information.html @@ -64,7 +64,7 @@

{% trans "Tell us a bit about yourself" %}

{{ form.phone }} diff --git a/appointment/utils/date_time.py b/appointment/utils/date_time.py index 1b50e31..2743c5a 100644 --- a/appointment/utils/date_time.py +++ b/appointment/utils/date_time.py @@ -9,7 +9,7 @@ import datetime from django.utils import timezone -from django.utils.translation import gettext_lazy as _ +from django.utils.translation import gettext_lazy as _, ngettext from appointment.settings import APP_TIME_ZONE @@ -43,23 +43,26 @@ def convert_minutes_in_human_readable_format(minutes: float) -> str: return _("Not set.") if minutes < 0: raise ValueError("Minutes cannot be negative.") - days, minutes = divmod(int(minutes), 1440) - hours, minutes = divmod(int(minutes), 60) - - def format_unit(value, single_name, plural_name): - return _("{value} {name}").format(value=value, name=single_name if value <= 1 else plural_name) + days, remaining_minutes = divmod(int(minutes), 1440) + hours, minutes = divmod(int(remaining_minutes), 60) parts = [] if days: - parts.append(format_unit(days, "day", "days")) + days_display = ngettext("%(count)d day", "%(count)d days", days) % {'count': days} + parts.append(days_display) + if hours: - parts.append(format_unit(hours, "hour", "hours")) + hours_display = ngettext("%(count)d hour", "%(count)d hours", hours) % {'count': hours} + parts.append(hours_display) + if minutes: - parts.append(format_unit(minutes, "minute", "minutes")) + minutes_display = ngettext("%(count)d minute", "%(count)d minutes", minutes) % {'count': minutes} + parts.append(minutes_display) + if len(parts) == 1: return parts[0] elif len(parts) == 2: - return _(" and ").join(parts) + return _("{first_part} and {second_part}").format(first_part=parts[0], second_part=parts[1]) elif len(parts) == 3: return _("{days}, {hours} and {minutes}").format(days=parts[0], hours=parts[1], minutes=parts[2]) else: @@ -70,8 +73,8 @@ def convert_str_to_date(date_str: str) -> datetime.date: """Convert a date string to a datetime date object. :param date_str: The date string. - Supported formats include '%Y-%m-%d' (like "2023-12-31") and '%Y/%m/%d' (like "2023/12/31"). - :return: datetime.date, the converted date + Supported formats include `%Y-%m-%d` (like "2023-12-31") and `%Y/%m/%d` (like "2023/12/31"). + :return: The converted `datetime.date`'s object. """ date_formats = ['%Y-%m-%d', '%Y/%m/%d', '%Y.%m.%d']
{% trans 'Start Date' %}{% trans 'End Date' %}{% trans 'Start date' %}{% trans 'End date' %} {% trans 'Description' %} {% trans 'Action' %}
{% trans 'Day' %}{% trans 'Start Time' %}{% trans 'End Time' %}{% trans 'Start time' %}{% trans 'End time' %} {% trans 'Action' %}
{% trans 'Description' %} {% trans 'Duration' %} {% trans 'Price' %}{% trans 'Down Payment' %}{% trans 'Down payment' %}