Merge pull request #57 from aceisace/localisation-support
Localisation support
This commit is contained in:
commit
75cf68296a
@ -14,6 +14,7 @@ fontsize = 14
|
||||
show_events = True
|
||||
print_events = False
|
||||
style = 'D MMM YY HH:mm'
|
||||
all_day_str = 'All day'
|
||||
|
||||
"""Add a border to increase readability"""
|
||||
border_top = int(middle_section_height * 0.02)
|
||||
@ -79,12 +80,12 @@ def main():
|
||||
'type':'timed_event'})
|
||||
else:
|
||||
if events.duration.days == 1:
|
||||
agenda_events.append({'date': events.begin,'time':'All day',
|
||||
agenda_events.append({'date': events.begin,'time': all_day_str,
|
||||
'name': events.name,'type':'full_day_event'})
|
||||
else:
|
||||
for day in range(events.duration.days):
|
||||
agenda_events.append({'date': events.begin.replace(days=+day),
|
||||
'time':'All day','name':events.name, 'type':'full_day_event'})
|
||||
'time': all_day_str,'name':events.name, 'type':'full_day_event'})
|
||||
|
||||
"""Sort events and dates in chronological order"""
|
||||
agenda_events = sorted(agenda_events, key = lambda event: event['date'])
|
||||
|
@ -13,12 +13,15 @@ from PIL import Image, ImageDraw
|
||||
|
||||
print_events = False
|
||||
show_events = True
|
||||
fontsize = 16
|
||||
today_in_your_language = 'today'
|
||||
tomorrow_in_your_language = 'tomorrow'
|
||||
at_in_your_language = 'at'
|
||||
event_icon = 'square' # dot #square
|
||||
style = "DD MMM"
|
||||
|
||||
fontsize = 16
|
||||
font = ImageFont.truetype(NotoSans+'.ttf', fontsize)
|
||||
space_between_lines = 1
|
||||
space_between_lines = 0
|
||||
|
||||
if show_events == True:
|
||||
from inkycal_icalendar import fetch_events
|
||||
@ -156,15 +159,25 @@ def main():
|
||||
|
||||
|
||||
"""Add a small section showing events of today and tomorrow"""
|
||||
event_list = ['{0} at {1} : {2}'.format('today', event.begin.format(
|
||||
'HH:mm' if hours == 24 else 'hh:mm'), event.name)
|
||||
for event in calendar_events if event.begin.day == now.day]
|
||||
|
||||
event_list += ['{0} at {1} : {2}'.format('tomorrow', event.begin.format(
|
||||
'HH:mm' if hours == 24 else 'hh:mm'), event.name)
|
||||
for event in calendar_events if event.begin.day == now.replace(days=+1).day]
|
||||
event_list = ['{0} {1} {2} : {3}'.format(today_in_your_language,
|
||||
at_in_your_language, event.begin.format('HH:mm' if hours == 24 else
|
||||
'hh:mm'), event.name) for event in calendar_events if event.begin.day
|
||||
== now.day and now < event.end]
|
||||
|
||||
del event_list[max_lines:]
|
||||
|
||||
event_list += ['{0} {1} {2} : {3}'.format(tomorrow_in_your_language,
|
||||
at_in_your_language, event.begin.format('HH:mm' if hours == 24 else
|
||||
'hh:mm'), event.name) for event in calendar_events if event.begin.day
|
||||
== now.replace(day=1).day]
|
||||
|
||||
after_two_days = now.replace(days=2).floor('day')
|
||||
|
||||
event_list += ['{0} {1} {2} : {3}'.format(event.begin.format('D MMM'),
|
||||
at_in_your_language, event.begin.format('HH:mm' if hours == 24 else
|
||||
'hh:mm'), event.name) for event in upcoming_events if event.end >
|
||||
after_two_days]
|
||||
|
||||
del event_list[max_event_lines:]
|
||||
|
||||
if event_list:
|
||||
for lines in event_list:
|
||||
@ -173,7 +186,7 @@ def main():
|
||||
fill_height = 0.7)
|
||||
else:
|
||||
write_text(main_area_width, int(events_height/max_event_lines),
|
||||
'No events today or tomorrow', event_lines[0], alignment='left',
|
||||
'No upcoming events', event_lines[0], alignment='left',
|
||||
fill_height = 0.7)
|
||||
|
||||
"""Set print_events_to True to print all events in this month"""
|
||||
|
@ -24,6 +24,7 @@ round_windspeed = True
|
||||
use_beaufort = True
|
||||
show_wind_direction = False
|
||||
use_wind_direction_icon = False
|
||||
now_str = 'now'
|
||||
|
||||
|
||||
"""Set the optional parameters"""
|
||||
@ -243,7 +244,7 @@ def main():
|
||||
moonphase = get_moon_phase()
|
||||
|
||||
"""Add weather details in column 1"""
|
||||
write_text(coloumn_width, row_height, 'now', text_now_pos, font = font)
|
||||
write_text(coloumn_width, row_height, now_str, text_now_pos, font = font)
|
||||
write_text(icon_medium, icon_medium, weathericons[weather_icon_now],
|
||||
weather_icon_now_pos, font = w_font, fill_width = 0.9)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user