Add a subtext to the greeting

This commit is contained in:
2021-12-24 06:57:31 +00:00
parent 4f0d4e0313
commit 17dadcc39e
2 changed files with 5 additions and 5 deletions

View File

@@ -77,7 +77,7 @@ def get_bookmarks() -> list:
return bookmarks return bookmarks
def get_greeting(): def get_greeting() -> tuple:
"""Generate the greeting string based on the defined timezone.""" """Generate the greeting string based on the defined timezone."""
try: try:
tz = zoneinfo.ZoneInfo(os.environ.get('TZ', 'UTC')) tz = zoneinfo.ZoneInfo(os.environ.get('TZ', 'UTC'))
@@ -88,10 +88,10 @@ def get_greeting():
current_time = datetime.datetime.now(tz) current_time = datetime.datetime.now(tz)
if 0 < current_time.hour < 12: if 0 < current_time.hour < 12:
return 'おはようございます!' return 'おはようございます!', "Thats 'Good morning' in Japanese"
elif current_time.hour >= 19: elif current_time.hour >= 19:
return 'こんばんは' return 'こんばんは', "Thats 'Good evening' in Japanese"
return 'こんにちは' return 'こんにちは', "Thats 'Good day' in Japanese"
@base.app_template_filter() @base.app_template_filter()

View File

@@ -52,7 +52,7 @@
</section> </section>
<section id="header"> <section id="header">
<h1>{{ greeting | default("Welcome")}}</h1> <h1><span title="{{ greeting[1] }}">{{ greeting[0] | default("Welcome")}}</span></h1>
<h2>{{ now | format_datetime }}</h2> <h2>{{ now | format_datetime }}</h2>
</section> </section>