right to left text on calendar events

main
Bob Mottram 2022-12-17 13:49:01 +00:00
parent 3ecd534568
commit 3df5e6c0a8
3 changed files with 57 additions and 5 deletions

View File

@ -18296,6 +18296,13 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.key_shortcuts.get(nickname):
access_keys = self.server.key_shortcuts[nickname]
languages_understood = \
get_understood_languages(self.server.base_dir,
self.server.http_prefix,
nickname,
self.server.domain_full,
self.server.person_cache)
# show the calendar screen
msg = html_calendar(self.server.person_cache,
self.server.translate,
@ -18306,7 +18313,8 @@ class PubServer(BaseHTTPRequestHandler):
access_keys,
False, self.server.system_language,
self.server.default_timeline,
self.server.theme_name)
self.server.theme_name,
languages_understood)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -18338,6 +18346,13 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.key_shortcuts.get(nickname):
access_keys = self.server.key_shortcuts[nickname]
languages_understood = \
get_understood_languages(self.server.base_dir,
self.server.http_prefix,
nickname,
self.server.domain_full,
self.server.person_cache)
# show the calendar screen
msg = html_calendar(self.server.person_cache,
self.server.translate,
@ -18349,7 +18364,8 @@ class PubServer(BaseHTTPRequestHandler):
True,
self.server.system_language,
self.server.default_timeline,
self.server.theme_name)
self.server.theme_name,
languages_understood)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)

View File

@ -172,13 +172,34 @@ a:focus {
font-size: 28px;
position: relative;
padding: 20px;
direction: ltr;
}
.calendar__day__event__rtl {
color: var(--event-color);
background-color: var(--event-background-private);
float: left;
font-size: 28px;
position: relative;
padding: 20px;
direction: rtl;
}
.calendar__day__event__public {
color: var(--event-public-color);
float: left;
font-size: 28px;
position: relative;
padding: 20px;
direction: ltr;
}
.calendar__day__event__public__rtl {
color: var(--event-public-color);
float: left;
font-size: 28px;
position: relative;
padding: 20px;
direction: rtl;
}
.place {
color: var(--place-color);

View File

@ -22,10 +22,12 @@ from utils import remove_domain_port
from utils import acct_dir
from utils import local_actor_url
from utils import replace_users_with_at
from utils import get_language_from_post
from happening import get_todays_events
from happening import get_calendar_events
from happening import get_todays_events_icalendar
from happening import get_month_events_icalendar
from webapp_utils import language_right_to_left
from webapp_utils import get_banner_file
from webapp_utils import set_custom_background
from webapp_utils import html_header_with_external_style
@ -108,7 +110,9 @@ def _html_calendar_day(person_cache: {}, translate: {},
year: int, month_number: int, day_number: int,
nickname: str, domain: str, day_events: [],
month_name: str, actor: str,
theme: str, access_keys: {}) -> str:
theme: str, access_keys: {},
system_language: str,
languages_understood: []) -> str:
"""Show a day within the calendar
"""
account_dir = acct_dir(base_dir, nickname, domain)
@ -250,10 +254,19 @@ def _html_calendar_day(person_cache: {}, translate: {},
translate['Delete this event'] + '" src="/' + \
'icons/delete.png" /></a></td>\n'
content_language = \
get_language_from_post(event_post, system_language,
languages_understood)
is_rtl = language_right_to_left(content_language)
event_class = 'calendar__day__event'
if is_rtl:
event_class = 'calendar__day__event__rtl'
cal_item_class = 'calItem'
if event_is_public:
event_class = 'calendar__day__event__public'
if is_rtl:
event_class = 'calendar__day__event__public__trl'
cal_item_class = 'calItemPublic'
if event_time:
if event_end_time:
@ -322,7 +335,8 @@ def html_calendar(person_cache: {}, translate: {},
http_prefix: str, domain_full: str,
text_mode_banner: str, access_keys: {},
icalendar: bool, system_language: str,
default_timeline: str, theme: str) -> str:
default_timeline: str, theme: str,
languages_understood: []) -> str:
"""Show the calendar for a person
"""
domain = remove_domain_port(domain_full)
@ -401,7 +415,8 @@ def html_calendar(person_cache: {}, translate: {},
year, month_number, day_number,
nickname, domain, day_events,
month_name, actor,
theme, access_keys)
theme, access_keys,
system_language, languages_understood)
if icalendar:
return get_month_events_icalendar(base_dir, nickname, domain,