Update NotificationSettings.vue
This commit is contained in:
@@ -97,10 +97,23 @@ const getChannelTypeName = (type: NotificationChannelType): string => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Helper function to translate a single event name
|
||||||
|
const getSingleEventDisplayName = (event: NotificationEvent): string => {
|
||||||
|
const i18nKey = `settings.notifications.events.${event}`;
|
||||||
|
const translated = t(i18nKey);
|
||||||
|
// Fallback if translation is missing
|
||||||
|
if (translated === i18nKey) {
|
||||||
|
console.warn(`Missing translation for notification event: ${i18nKey}`);
|
||||||
|
return event.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, l => l.toUpperCase());
|
||||||
|
}
|
||||||
|
return translated;
|
||||||
|
};
|
||||||
|
|
||||||
const getEventNames = (events: NotificationEvent[]): string => {
|
const getEventNames = (events: NotificationEvent[]): string => {
|
||||||
if (!events || events.length === 0) return t('settings.notifications.noEventsEnabled');
|
if (!events || events.length === 0) return t('settings.notifications.noEventsEnabled');
|
||||||
// TODO: Translate event names if needed
|
// Translate each event name
|
||||||
return t('settings.notifications.triggers') + ': ' + events.join(', ');
|
const translatedNames = events.map(event => getSingleEventDisplayName(event));
|
||||||
|
return t('settings.notifications.triggers') + ': ' + translatedNames.join(', ');
|
||||||
};
|
};
|
||||||
|
|
||||||
const editSetting = (setting: NotificationSetting) => {
|
const editSetting = (setting: NotificationSetting) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user