diff --git a/packages/nicolium/src/features/notifications/components/notification.tsx b/packages/nicolium/src/features/notifications/components/notification.tsx index 44e067d3f..ed727f9b8 100644 --- a/packages/nicolium/src/features/notifications/components/notification.tsx +++ b/packages/nicolium/src/features/notifications/components/notification.tsx @@ -91,6 +91,15 @@ const icons: Partial> = { 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 = defineMessages({ follow: { id: 'notification.follow', diff --git a/packages/nicolium/src/locales/en.json b/packages/nicolium/src/locales/en.json index 891386b6b..89fe4b297 100644 --- a/packages/nicolium/src/locales/en.json +++ b/packages/nicolium/src/locales/en.json @@ -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", diff --git a/packages/nicolium/src/service-worker/sw.ts b/packages/nicolium/src/service-worker/sw.ts index 38878370e..25aa1402e 100644 --- a/packages/nicolium/src/service-worker/sw.ts +++ b/packages/nicolium/src/service-worker/sw.ts @@ -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 =>