From d8c6f4bfe2da15ebb57e3da53768c9fc0797e0da Mon Sep 17 00:00:00 2001
From: SamTV12345 <40429738+SamTV12345@users.noreply.github.com>
Date: Fri, 26 Jan 2024 22:11:23 +0100
Subject: [PATCH] Fixed missing translation key. (#573)
* Fixed missing translation key.
* Fixed linter
---
src/service/podcast_episode_service.rs | 2 +-
ui/src/components/Notifications.tsx | 16 +++++++++++++++-
ui/src/language/json/de.json | 3 ++-
ui/src/language/json/en.json | 3 ++-
ui/src/language/json/es.json | 3 ++-
ui/src/language/json/fr.json | 3 ++-
ui/src/language/json/pl.json | 3 ++-
ui/src/models/Notification.ts | 2 +-
8 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/service/podcast_episode_service.rs b/src/service/podcast_episode_service.rs
index c3a9394a..9a495de9 100644
--- a/src/service/podcast_episode_service.rs
+++ b/src/service/podcast_episode_service.rs
@@ -87,7 +87,7 @@ impl PodcastEpisodeService {
PodcastEpisode::update_podcast_episode_status(&podcast_episode.url, "D", conn).unwrap();
let notification = Notification {
id: 0,
- message: format!("Episode {} is now available offline", podcast_episode.name),
+ message: podcast_episode.name.to_string(),
created_at: chrono::Utc::now().naive_utc().to_string(),
type_of_message: "Download".to_string(),
status: "unread".to_string(),
diff --git a/ui/src/components/Notifications.tsx b/ui/src/components/Notifications.tsx
index 5edc88d9..238daa86 100644
--- a/ui/src/components/Notifications.tsx
+++ b/ui/src/components/Notifications.tsx
@@ -8,6 +8,20 @@ import useCommon from '../store/CommonSlice'
import { Notification } from '../models/Notification'
import 'material-symbols/outlined.css'
+
+const NotificationFormatter = (notification: Notification) => {
+ const {t} = useTranslation()
+
+ const decideMessage = ()=>{
+ switch(notification.typeOfMessage) {
+ case "Download":
+ return t('notification.episode-now-available', {episode: notification.message})
+ }
+ }
+
+ return decideMessage()
+}
+
export const Notifications: FC = () => {
const notifications = useCommon(state => state.notifications)
const { t } = useTranslation()
@@ -52,7 +66,7 @@ export const Notifications: FC = () => {
paddingBottom: { delay: 0.15, ease: 'easeOut', duration: 0.1 },
paddingTop: { delay: 0.15, ease: 'easeOut', duration: 0.1 }
}}>
- {notification.message}
+
{dismissNotification(notification)}}>close
diff --git a/ui/src/language/json/de.json b/ui/src/language/json/de.json
index 381215a6..79e517c6 100644
--- a/ui/src/language/json/de.json
+++ b/ui/src/language/json/de.json
@@ -180,5 +180,6 @@
"original-rss-feed": "Original RSS Feed",
"profile": "Profil",
"api-key": "API-Key",
- "user-settings-updated": "Benutzereinstellungen aktualisiert"
+ "user-settings-updated": "Benutzereinstellungen aktualisiert",
+ "notification.episode-now-available": "Episode {{episode}} ist jetzt verfügbar"
}
diff --git a/ui/src/language/json/en.json b/ui/src/language/json/en.json
index f13ed8bd..96c8e75d 100644
--- a/ui/src/language/json/en.json
+++ b/ui/src/language/json/en.json
@@ -180,5 +180,6 @@
"original-rss-feed": "Original RSS feed",
"profile": "Profile",
"api-key": "API key",
- "user-settings-updated": "User settings updated"
+ "user-settings-updated": "User settings updated",
+ "notification.episode-now-available": "Episode {{episode}} now available"
}
diff --git a/ui/src/language/json/es.json b/ui/src/language/json/es.json
index 102d64e2..221a241a 100644
--- a/ui/src/language/json/es.json
+++ b/ui/src/language/json/es.json
@@ -178,5 +178,6 @@
"original-rss-feed": "Fuente RSS original",
"profile": "Perfil",
"api-key": "Clave API",
- "user-settings-updated": "Configuración de usuario actualizada"
+ "user-settings-updated": "Configuración de usuario actualizada",
+ "notification.episode-now-available": "Episodio {{episode}} ahora disponible"
}
diff --git a/ui/src/language/json/fr.json b/ui/src/language/json/fr.json
index 4887bccc..6b5d57f2 100644
--- a/ui/src/language/json/fr.json
+++ b/ui/src/language/json/fr.json
@@ -179,5 +179,6 @@
"original-rss-feed": "Flux RSS original",
"profile": "Profil",
"api-key": "Clé API",
- "user-settings-updated": "Paramètres utilisateur mis à jour"
+ "user-settings-updated": "Paramètres utilisateur mis à jour",
+ "notification.episode-now-available": "L'épisode {{episode}} maintenant disponible hors-ligne"
}
diff --git a/ui/src/language/json/pl.json b/ui/src/language/json/pl.json
index eabfd75f..0cccb29d 100644
--- a/ui/src/language/json/pl.json
+++ b/ui/src/language/json/pl.json
@@ -179,5 +179,6 @@
"original-rss-feed": "Oryginalny kanał RSS",
"profile": "Profil",
"api-key": "Klucz API",
- "user-settings-updated": "Ustawienia użytkownika zostały zaktualizowane"
+ "user-settings-updated": "Ustawienia użytkownika zostały zaktualizowane",
+ "notification.episode-now-available": "Odcinek {{episode}} jest już dostępny"
}
diff --git a/ui/src/models/Notification.ts b/ui/src/models/Notification.ts
index b9da6821..91f16366 100644
--- a/ui/src/models/Notification.ts
+++ b/ui/src/models/Notification.ts
@@ -1,7 +1,7 @@
export interface Notification {
id: number,
message: string,
- typeOfMessage: "success"|"error"|"info"|"warning",
+ typeOfMessage: "Download",
createdAt: string,
status: string
}