nicolium: improve service worker notification handling

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-03-09 11:06:18 +01:00
parent ce120faa23
commit 7192fda058
3 changed files with 15 additions and 2 deletions

View File

@ -91,6 +91,15 @@ const icons: Partial<Record<NotificationType | 'reply', string>> = {
quoted_update: require('@phosphor-icons/core/regular/pencil-simple-line.svg'),
};
// For use by the service worker
defineMessages({
group: {
id: 'notifications.group',
defaultMessage: '{count, plural, one {# notification} other {# notifications}}',
},
showMore: { id: 'status.show_more', defaultMessage: 'Show more' },
});
const messages: Record<NotificationType | 'reply', MessageDescriptor> = defineMessages({
follow: {
id: 'notification.follow',

View File

@ -1530,6 +1530,7 @@
"notifications.filter.mentions": "Mentions",
"notifications.filter.polls": "Poll results",
"notifications.filter.statuses": "Updates from people you follow",
"notifications.group": "{count, plural, one {# notification} other {# notifications}}",
"notifications.queue_label": "Click to see {count} new {count, plural, one {notification} other {notifications}}",
"notifications.queue_label.live_region": "{count} new {count, plural, one {notification} other {notifications}}.",
"oauth_consumer.tooltip": "Sign in with {provider}",
@ -1900,6 +1901,7 @@
"status.share": "Share",
"status.show_filter_reason": "Show anyway",
"status.show_less_all": "Show less for all",
"status.show_more": "Show more",
"status.show_more_all": "Show more for all",
"status.show_original": "Show original",
"status.skip_pinned": "Skip pinned posts",

View File

@ -147,8 +147,10 @@ const cloneNotification = (notification: Notification): ClonedNotification => {
};
/** Get translated message for the user's locale. */
const formatMessage = (messageId: string, locale: string, values = {}): string =>
new IntlMessageFormat(locales[locale][messageId], locale).format(values) as string;
const formatMessage = (messageId: string, locale: string, values = {}): string => {
const message = locales[locale]?.[messageId] ?? locales['en'][messageId];
return new IntlMessageFormat(message, locale).format(values) as string;
};
/** Strip HTML for display in a native notification. */
const htmlToPlainText = (html: string): string =>