Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed missing translation key. #573

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/service/podcast_episode_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
16 changes: 15 additions & 1 deletion ui/src/components/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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}
<NotificationFormatter {...notification} />

<span className="material-symbols-outlined cursor-pointer text-[--modal-close-color] hover:text-[--modal-close-color-hover]" onClick={()=>{dismissNotification(notification)}}>close</span>
</motion.div>
Expand Down
3 changes: 2 additions & 1 deletion ui/src/language/json/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion ui/src/language/json/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion ui/src/language/json/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion ui/src/language/json/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion ui/src/language/json/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion ui/src/models/Notification.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface Notification {
id: number,
message: string,
typeOfMessage: "success"|"error"|"info"|"warning",
typeOfMessage: "Download",
createdAt: string,
status: string
}
Loading