Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 34 additions & 9 deletions src/onegov/org/forms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ class HolidaySettingsForm(Form):

other_holidays = TextAreaField(
label=_('Other holidays'),
description=('31.10 - Halloween'),
description=('31.10 - Halloween / 31.10.2025 - Halloween'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep the old description intact, since this it was displayed as a placeholder and you can't have two entries on the same line.

If you want a more explanatory/verbose description, you're better off doing something like organisation_hierarchy where you give an example with a markdown code block. Long descriptions are rendered as markdown.

render_kw={'rows': 10})

preview = PreviewField(
Expand All @@ -1050,16 +1050,29 @@ def validate_other_holidays(self, field: TextAreaField) -> None:
continue

if line.count('-') < 1:
raise ValidationError(_('Format: Day.Month - Description'))
raise ValidationError(
_(
'Format: Day.Month[.Year] - Description '
'(year is optional)'
)
)
if line.count('-') > 1:
raise ValidationError(_('Please enter one date per line'))

date, _description = line.split('-', 1)

if date.count('.') < 1:
raise ValidationError(_('Format: Day.Month - Description'))
if date.count('.') > 1:
raise ValidationError(_('Please enter only day and month'))
if date.count('.') == 1:
continue
if date.count('.') == 2:
self.parse_date(date.strip())
continue

raise ValidationError(
_(
'Format: Day.Month[.Year] - Description '
'(year is optional)'
)
)

def parse_date(self, date: str) -> datetime.date:
day, month, year = date.split('.', 2)
Expand Down Expand Up @@ -1108,10 +1121,18 @@ def validate_school_holidays(self, field: TextAreaField) -> None:
@property
def holiday_settings(self) -> dict[str, Any]:

def parse_other_holidays_line(line: str) -> tuple[int, int, str]:
def parse_other_holidays_line(
line: str,
) -> tuple[int, int, str] | tuple[int, int, str, int]:

date, desc = line.strip().split('-', 1)
day, month = date.split('.')
parts = date.strip().split('.')

if len(parts) == 3:
day, month, year = parts
return int(month), int(day), desc.strip(), int(year)

day, month = parts
return int(month), int(day), desc.strip()

def parse_school_holidays_line(
Expand Down Expand Up @@ -1145,7 +1166,11 @@ def parse_school_holidays_line(
def holiday_settings(self, data: dict[str, Any]) -> None:
data = data or {}

def format_other(d: tuple[int, int, str]) -> str:
def format_other(
d: tuple[int, int, str] | tuple[int, int, str, int],
) -> str:
if len(d) == 4:
return f'{d[1]:02d}.{d[0]:02d}.{d[3]:04d} - {d[2]}'
return f'{d[1]:02d}.{d[0]:02d} - {d[2]}'

def format_school(d: tuple[int, int, int, int, int, int]) -> str:
Expand Down
49 changes: 33 additions & 16 deletions src/onegov/org/locale/de_CH/LC_MESSAGES/onegov.org.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2026-07-16 15:23+0200\n"
"POT-Creation-Date: 2026-07-20 15:43+0200\n"
"PO-Revision-Date: 2022-03-15 10:21+0100\n"
"Last-Translator: Marc Sommerhalder <marc.sommerhalder@seantis.ch>\n"
"Language-Team: German\n"
Expand Down Expand Up @@ -950,43 +950,50 @@ msgid "Elderly"
msgstr "Senioren"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Mo"
msgstr "Mo"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Tu"
msgstr "Di"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "We"
msgstr "Mi"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Th"
msgstr "Do"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Fr"
msgstr "Fr"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Sa"
msgstr "Sa"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Su"
msgstr "So"
Expand Down Expand Up @@ -2339,6 +2346,9 @@ msgstr "Dateien in separatem Fenster öffnen"
msgid "Short links"
msgstr "Kurzlinks"

msgid "Preview"
msgstr "Vorschau"

#, python-format
msgid ""
"Malformed short link on line ${number}. Each line needs to be a pair of "
Expand Down Expand Up @@ -2596,21 +2606,16 @@ msgstr "Zürich"
msgid "Other holidays"
msgstr "Andere Feiertage"

msgid "Preview"
msgstr "Vorschau"

msgid "School holidays"
msgstr "Schulferien"

msgid "Format: Day.Month - Description"
msgstr "Format: Tag.Monat - Beschreibung"
msgid "Format: Day.Month[.Year] - Description (year is optional)"
msgstr ""
"Format: Tag.Monat[.Jahr] - Beschreibung (Jahr ist optional)"

msgid "Please enter one date per line"
msgstr "Bitte geben Sie ein Datum pro Zeile ein"

msgid "Please enter only day and month"
msgstr "Bitte geben Sie nur Tag und Monat ein"

#, python-format
msgid "${date} is not a valid date"
msgstr "${date} ist kein gültiges Datum"
Expand Down Expand Up @@ -8001,6 +8006,9 @@ msgstr "Feiertage / Schulferien"
msgid "No holidays defined"
msgstr "Keine Feiertage definiert"

msgid "No short links defined"
msgstr "Keine Short Links definiert"

msgid "Link Migration"
msgstr "Migration Links"

Expand Down Expand Up @@ -8386,6 +8394,15 @@ msgstr "Der Benutzer wurde erfolgreich erstellt"
msgid "Please enter your e-mail address in order to continue"
msgstr "Bitte geben Sie ihre E-Mail Adresse ein um fortzufahren"

#~ msgid "Format: Day.Month - Description or Day.Month.Year - Description"
#~ msgstr "Format: Tag.Monat - Beschreibung oder Tag.Monat.Jahr - Beschreibung"

#~ msgid "Format: Day.Month - Description"
#~ msgstr "Format: Tag.Monat - Beschreibung"

#~ msgid "Please enter only day and month"
#~ msgstr "Bitte geben Sie nur Tag und Monat ein"

#~ msgid ""
#~ "This entry is published and this directory has an admin notification "
#~ "address set, so it cannot be deleted. To delete it, wait until its "
Expand Down
49 changes: 33 additions & 16 deletions src/onegov/org/locale/fr_CH/LC_MESSAGES/onegov.org.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2026-07-16 15:23+0200\n"
"POT-Creation-Date: 2026-07-20 15:43+0200\n"
"PO-Revision-Date: 2022-03-15 10:50+0100\n"
"Last-Translator: Marc Sommerhalder <marc.sommerhalder@seantis.ch>\n"
"Language-Team: French\n"
Expand Down Expand Up @@ -951,43 +951,50 @@ msgid "Elderly"
msgstr "Âgées"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Mo"
msgstr "Lu"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Tu"
msgstr "Ma"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "We"
msgstr "Me"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Th"
msgstr "Je"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Fr"
msgstr "Ve"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Sa"
msgstr "Sa"

#. FIXME: We define a very similar constant in our forms, we should move this
#. to onegov.org.constants and use it for both. noqa: N806
#. to onegov.org.constants and use it for both. ruff:ignore[non-lowercase-
#. variable-in-function]
#.
msgid "Su"
msgstr "Di"
Expand Down Expand Up @@ -2340,6 +2347,9 @@ msgstr "Ouvrir les fichiers dans une fenêtre de navigateur séparée"
msgid "Short links"
msgstr "Lien court"

msgid "Preview"
msgstr "Preview"

#, python-format
msgid ""
"Malformed short link on line ${number}. Each line needs to be a pair of "
Expand Down Expand Up @@ -2599,21 +2609,16 @@ msgstr "Zurich"
msgid "Other holidays"
msgstr "Autres jours fériés"

msgid "Preview"
msgstr "Preview"

msgid "School holidays"
msgstr "Vacances scolaires"

msgid "Format: Day.Month - Description"
msgstr "Format : Jour.Mois - Description"
msgid "Format: Day.Month[.Year] - Description (year is optional)"
msgstr ""
"Format : Jour.Mois[.Année] - Description (l'année est facultative)"

msgid "Please enter one date per line"
msgstr "Veuillez renseigner une date par ligne"

msgid "Please enter only day and month"
msgstr "Veuillez ne renseigner que des jours et des mois"

#, python-format
msgid "${date} is not a valid date"
msgstr "${date} n'est pas une date valide"
Expand Down Expand Up @@ -8009,6 +8014,9 @@ msgstr "Jours fériés / Vacances scolaires"
msgid "No holidays defined"
msgstr "Aucun jour férié défini"

msgid "No short links defined"
msgstr "Aucun lien court défini"

msgid "Link Migration"
msgstr "Migration des liens"

Expand Down Expand Up @@ -8394,6 +8402,15 @@ msgstr "L'utilisateur a bien été créé"
msgid "Please enter your e-mail address in order to continue"
msgstr "Veuillez saisir votre adresse e-mail pour continuer"

#~ msgid "Format: Day.Month - Description or Day.Month.Year - Description"
#~ msgstr "Format : Jour.Mois - Description ou Jour.Mois.Année - Description"

#~ msgid "Format: Day.Month - Description"
#~ msgstr "Format : Jour.Mois - Description"

#~ msgid "Please enter only day and month"
#~ msgstr "Veuillez ne renseigner que des jours et des mois"

#~ msgid ""
#~ "This entry is published and this directory has an admin notification "
#~ "address set, so it cannot be deleted. To delete it, wait until its "
Expand Down
Loading