diff --git a/frontend/src/components/Channels.tsx b/frontend/src/components/Channels.tsx index a9ffc63..8cd4d94 100644 --- a/frontend/src/components/Channels.tsx +++ b/frontend/src/components/Channels.tsx @@ -1,4 +1,5 @@ import { useState } from "react"; +import { Trans, useTranslation } from "react-i18next"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { ArrowDown, @@ -20,11 +21,11 @@ import Avatar from "./Avatar"; export type ChannelStatusFilter = "all" | "needs_full" | "fully_synced" | "hidden"; -const STATUS_FILTERS: { id: ChannelStatusFilter; label: string }[] = [ - { id: "all", label: "All" }, - { id: "needs_full", label: "Needs full history" }, - { id: "fully_synced", label: "Fully synced" }, - { id: "hidden", label: "Hidden" }, +const STATUS_FILTERS: { id: ChannelStatusFilter; labelKey: string }[] = [ + { id: "all", labelKey: "channels.filters.all" }, + { id: "needs_full", labelKey: "channels.filters.needsFull" }, + { id: "fully_synced", labelKey: "channels.filters.fullySynced" }, + { id: "hidden", labelKey: "channels.filters.hidden" }, ]; export default function Channels({ @@ -38,6 +39,7 @@ export default function Channels({ statusFilter: ChannelStatusFilter; setStatusFilter: (f: ChannelStatusFilter) => void; }) { + const { t } = useTranslation(); const qc = useQueryClient(); const channelsQuery = useQuery({ queryKey: ["channels"], queryFn: api.channels }); const tagsQuery = useQuery({ queryKey: ["tags"], queryFn: api.tags }); @@ -92,9 +94,9 @@ export default function Channels({ mutationFn: () => api.syncSubscriptions(), onSuccess: (r: { subscriptions?: number }) => { invalidate(); - notify({ level: "success", message: `Synced ${r.subscriptions ?? 0} subscriptions` }); + notify({ level: "success", message: t("channels.notify.synced", { count: r.subscriptions ?? 0 }) }); }, - onError: () => notify({ level: "error", message: "Subscription sync failed" }), + onError: () => notify({ level: "error", message: t("channels.notify.syncFailed") }), }); const createTag = useMutation({ mutationFn: (name: string) => api.createTag({ name, category: "other" }), @@ -112,9 +114,9 @@ export default function Channels({ onSuccess: () => { qc.invalidateQueries({ queryKey: ["channels"] }); qc.invalidateQueries({ queryKey: ["my-status"] }); - notify({ level: "success", message: "Unsubscribed on YouTube" }); + notify({ level: "success", message: t("channels.notify.unsubscribed") }); }, - onError: () => notify({ level: "error", message: "Unsubscribe failed" }), + onError: () => notify({ level: "error", message: t("channels.notify.unsubscribeFailed") }), }); const deepAll = useMutation({ mutationFn: () => api.deepAll(true), @@ -123,10 +125,10 @@ export default function Channels({ qc.invalidateQueries({ queryKey: ["my-status"] }); notify({ level: "success", - message: `Full history requested for ${r.updated ?? 0} channels`, + message: t("channels.notify.fullHistoryRequested", { count: r.updated ?? 0 }), }); }, - onError: () => notify({ level: "error", message: "Couldn't request full history" }), + onError: () => notify({ level: "error", message: t("channels.notify.fullHistoryFailed") }), }); const channels = (channelsQuery.data ?? []) @@ -147,29 +149,29 @@ export default function Channels({ {/* Per-user sync status */} {s && (
- Set a channel's priority to push its videos up when you sort
- by “Channel priority”, attach your own tags to filter the feed,
- or hide a channel to drop it from the feed without unsubscribing.
+