diff --git a/web/components/admin/Offline.tsx b/web/components/admin/Offline.tsx index 515a872b9..366c15f0f 100644 --- a/web/components/admin/Offline.tsx +++ b/web/components/admin/Offline.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from 'next-export-i18n'; import { Card, Col, Row, Typography } from 'antd'; import Link from 'next/link'; import { FC, useContext } from 'react'; @@ -43,6 +44,7 @@ export type OfflineProps = { export const Offline: FC = ({ logs = [], config }) => { const serverStatusData = useContext(ServerStatusContext); + const { t } = useTranslation(); const { serverConfig } = serverStatusData || {}; const { rtmpServerPort, streamKeyOverridden } = serverConfig; const instanceUrl = global.window?.location.hostname || ''; @@ -55,7 +57,7 @@ export const Offline: FC = ({ logs = [], config }) => { const data = [ { icon: , - title: 'Use your broadcasting software', + title: t('Use your broadcasting software'), content: (
= ({ logs = [], config }) => { target="_blank" rel="noopener noreferrer" > - Learn how to point your existing software to your new server and start streaming your - content. + {t( + 'Learn how to point your existing software to your new server and start streaming your content.', + )}
- Streaming URL: + {t('Streaming URL:')} {rtmpURL && ( @@ -76,14 +79,14 @@ export const Offline: FC = ({ logs = [], config }) => { )} - Streaming Keys: + {t('Streaming Keys:')} {!streamKeyOverridden ? ( - View + {t('View')} ) : ( - Overridden via command line. + {t('Overridden via command line.')} )} @@ -93,7 +96,7 @@ export const Offline: FC = ({ logs = [], config }) => { }, { icon: , - title: 'Embed your video onto other sites', + title: t('Embed your video onto other sites'), content: ( ), @@ -111,19 +114,19 @@ export const Offline: FC = ({ logs = [], config }) => { if (!config?.chatDisabled) { data.push({ icon: , - title: 'Chat is disabled', - content: Chat will continue to be disabled until you begin a live stream., + title: t('Chat is disabled'), + content: {t('Chat will continue to be disabled until you begin a live stream.')}, }); } if (!config?.yp?.enabled) { data.push({ icon: , - title: 'Find an audience on the Owncast Directory', + title: t('Find an audience on the Owncast Directory'), content: (
- List yourself in the Owncast Directory and show off your stream. Enable it in{' '} - settings. + {t('List yourself in the Owncast Directory and show off your stream. Enable it in')}{' '} + {t('settings.')}
), }); @@ -132,12 +135,13 @@ export const Offline: FC = ({ logs = [], config }) => { if (!config?.federation?.enabled) { data.push({ icon: fediverse, - title: 'Add your Owncast instance to the Fediverse', + title: t('Add your Owncast instance to the Fediverse'), content: (
- Enable Owncast social features to have your - instance join the Fediverse, allowing people to follow, share and engage with your live - stream. + {t('Enable Owncast social features')}{' '} + {t( + 'to have your instance join the Fediverse, allowing people to follow, share and engage with your live stream.', + )}
), }); @@ -152,8 +156,8 @@ export const Offline: FC = ({ logs = [], config }) => {
- No stream is active -

You should start one.

+ {t('No stream is active')} +

{t('You should start one.')}

diff --git a/web/pages/admin/chat/messages.tsx b/web/pages/admin/chat/messages.tsx index 288cac8da..fb1a1355f 100644 --- a/web/pages/admin/chat/messages.tsx +++ b/web/pages/admin/chat/messages.tsx @@ -5,6 +5,7 @@ import { ColumnsType } from 'antd/es/table'; import { format } from 'date-fns'; import dynamic from 'next/dynamic'; +import { useTranslation } from 'next-export-i18n'; import { MessageType } from '../../../types/chat'; import { CHAT_HISTORY, @@ -61,6 +62,7 @@ export default function Chat() { const [bulkProcessing, setBulkProcessing] = useState(false); const [bulkOutcome, setBulkOutcome] = useState(null); const [bulkAction, setBulkAction] = useState(''); + const { t } = useTranslation(); let outcomeTimeout = null; let chatReloadInterval = null; @@ -153,7 +155,7 @@ export default function Chat() { const chatColumns: ColumnsType = [ { - title: 'Time', + title: t('Time'), dataIndex: 'timestamp', key: 'timestamp', className: 'timestamp-col', @@ -166,7 +168,7 @@ export default function Chat() { width: 90, }, { - title: 'User', + title: t('User'), dataIndex: 'user', key: 'user', className: 'name-col', @@ -182,7 +184,7 @@ export default function Chat() { width: 110, }, { - title: 'Message', + title: t('Message'), dataIndex: 'body', key: 'body', className: 'message-col', @@ -201,8 +203,8 @@ export default function Chat() { key: 'hiddenAt', className: 'toggle-col', filters: [ - { text: 'Visible messages', value: true }, - { text: 'Hidden messages', value: false }, + { text: t('Visible messages'), value: true }, + { text: t('Hidden messages'), value: false }, ], onFilter: (value, record) => record.visible === value, render: (hiddenAt, record) => ( @@ -219,10 +221,12 @@ export default function Chat() { return (
- Chat Messages -

Manage the messages from viewers that show up on your stream.

+ {t('Chat Messages')} +

{t('Manage the messages from viewers that show up on your stream.')}

- Check multiple messages to change their visibility to: + + {t('Check multiple messages to change their visibility to:')}{' '} +
{ try { @@ -71,34 +73,50 @@ export default function ChatUsers() { <>

- Visit the{' '} + {t('Visit the')}{' '} - documentation + {t('documentation')} {' '} - to configure additional details about your viewers. + {t('to configure additional details about your viewers.')}

) : (

- When a stream is active and chat is enabled, connected chat clients will be displayed here. + {t( + 'When a stream is active and chat is enabled, connected chat clients will be displayed here.', + )}

); const connectedUserTabTitle = ( - Connected {online ? `(${clients.length})` : '(offline)'} + + {t('Connected')} ({online ? clients.length : t('offline')}) + ); - const bannedUsersTabTitle = Banned Users ({disabledUsers.length}); + const bannedUsersTabTitle = ( + + {t('Banned Users')} ({disabledUsers.length}) + + ); const bannedUsersTable = ; - const bannedIPTabTitle = IP Bans ({ipBans.length}); + const bannedIPTabTitle = ( + + {t('IP Bans')} ({ipBans.length}) + + ); const bannedIpTable = ; - const moderatorUsersTabTitle = Moderators ({moderators.length}); + const moderatorUsersTabTitle = ( + + {t('Moderators')} ({moderators.length}) + + ); const moderatorTable = ; const items = [ diff --git a/web/pages/admin/viewer-info.tsx b/web/pages/admin/viewer-info.tsx index d2a79a7a0..795a3cdab 100644 --- a/web/pages/admin/viewer-info.tsx +++ b/web/pages/admin/viewer-info.tsx @@ -2,6 +2,7 @@ import React, { useState, useEffect, useContext, ReactElement } from 'react'; import { Row, Col, Typography, MenuProps, Dropdown, Spin, Alert } from 'antd'; import { getUnixTime, sub } from 'date-fns'; import dynamic from 'next/dynamic'; +import { useTranslation } from 'next-export-i18n'; import { Chart } from '../../components/admin/Chart'; import { StatisticItem } from '../../components/admin/StatisticItem'; import { ViewerTable } from '../../components/admin/ViewerTable'; @@ -26,6 +27,7 @@ const FETCH_INTERVAL = 60 * 1000; // 1 min export default function ViewersOverTime() { const context = useContext(ServerStatusContext); + const { t } = useTranslation(); const { online, broadcaster, viewerCount, overallPeakViewerCount, sessionPeakViewerCount } = context || {}; let streamStart; @@ -34,13 +36,13 @@ export default function ViewersOverTime() { } const times = [ - { title: 'Current stream', start: streamStart }, - { title: 'Last 12 hours', start: sub(new Date(), { hours: 12 }) }, - { title: 'Last 24 hours', start: sub(new Date(), { hours: 24 }) }, - { title: 'Last 7 days', start: sub(new Date(), { days: 7 }) }, - { title: 'Last 30 days', start: sub(new Date(), { days: 30 }) }, - { title: 'Last 3 months', start: sub(new Date(), { months: 3 }) }, - { title: 'Last 6 months', start: sub(new Date(), { months: 6 }) }, + { title: t('Current stream'), start: streamStart }, + { title: t('Last 12 hours'), start: sub(new Date(), { hours: 12 }) }, + { title: t('Last 24 hours'), start: sub(new Date(), { hours: 24 }) }, + { title: t('Last 7 days'), start: sub(new Date(), { days: 7 }) }, + { title: t('Last 30 days'), start: sub(new Date(), { days: 30 }) }, + { title: t('Last 3 months'), start: sub(new Date(), { months: 3 }) }, + { title: t('Last 6 months'), start: sub(new Date(), { months: 6 }) }, ]; const [loadingChart, setLoadingChart] = useState(true); @@ -94,13 +96,13 @@ export default function ViewersOverTime() { return ( <> - Viewer Info + {t('Viewer Info')}
{online && (
} /> @@ -108,14 +110,14 @@ export default function ViewersOverTime() { )} } /> } /> @@ -125,8 +127,8 @@ export default function ViewersOverTime() { )} @@ -134,7 +136,7 @@ export default function ViewersOverTime() { {viewerInfo.length > 0 && (