Skip to content

Commit

Permalink
fix(kirjastot): use finnish translations for holidays
Browse files Browse the repository at this point in the history
  • Loading branch information
danipran committed May 14, 2024
1 parent defaae4 commit 18a96c9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hours/importer/kirjastot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from .sync import ModelSyncher

KIRKANTA_STATUS_MAP = {0: State.CLOSED, 1: State.OPEN, 2: State.SELF_SERVICE}
fi_holidays = holidays.Finland()
finnish_holiday_names = holidays.Finland(language="fi")

# List of periods that are known not to be a rotation of x weeks, but need to be
# handled day-by-day.
Expand Down Expand Up @@ -449,7 +449,12 @@ def separate_exceptional_periods(self, resource: Resource, period: dict) -> list

periods = []
for day in period["days"]:
name = day.get("info") if day.get("info") else fi_holidays.get(day["date"])
# Use the provided name if it exists, otherwise use the holiday name
name = (
day.get("info")
if day.get("info")
else finnish_holiday_names.get(day["date"])
)
sub_period = {
"resource": resource,
"name": {"fi": name},
Expand Down

0 comments on commit 18a96c9

Please sign in to comment.