Add localized formatting for multi-day event durations
This commit introduces a feature to format the names of multi-day events using Arrow's localization. Event titles now include the event duration in days.
This commit is contained in:
		| @@ -355,6 +355,12 @@ class Calendar(inkycal_module): | ||||
|                 cursor = 0 | ||||
|                 for event in upcoming_events: | ||||
|                     if cursor < len(event_lines): | ||||
|                         event_duration = (event['end'] - event['begin']).days | ||||
|                         if event_duration > 1: | ||||
|                             # Format the duration using Arrow's localization | ||||
|                             days_translation = arrow.get().shift(days=event_duration).humanize(only_distance=True, locale=lang) | ||||
|                             the_name = f"{event['title']} ({days_translation})" | ||||
|                         else: | ||||
|                             the_name = event['title'] | ||||
|                         the_date = event['begin'].format(self.date_format, locale=lang) | ||||
|                         the_time = event['begin'].format(self.time_format, locale=lang) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user