mirror of
https://github.com/owncast/owncast.git
synced 2025-11-02 11:56:57 +08:00
Update localization files + references (#4556)
* Initial plan * Add localization support to NameChangeModal component Co-authored-by: gabek <414923+gabek@users.noreply.github.com> * Add NameChangeModal translations to English language file Co-authored-by: gabek <414923+gabek@users.noreply.github.com> * fix(i18n): fix localization keys * chore(test): add i18n test * chore(i18n): update translation script * chore(i18n): reorgnize translation keys and update components * chore: fix linting warnings * chore(i18n): update all the language files * feat(i18n): add last live ago i18n key --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gabek <414923+gabek@users.noreply.github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
@ -4,6 +4,7 @@ import Linkify from 'react-linkify';
|
||||
import { SortOrder, TablePaginationConfig } from 'antd/lib/table/interface';
|
||||
import { format } from 'date-fns';
|
||||
import { useTranslation } from 'next-export-i18n';
|
||||
import { Localization } from '../../types/localization';
|
||||
|
||||
const { Title } = Typography;
|
||||
|
||||
@ -19,10 +20,6 @@ function renderColumnLevel(text, entry) {
|
||||
return <Tag color={color}>{text}</Tag>;
|
||||
}
|
||||
|
||||
function renderMessage(text) {
|
||||
return <Linkify>{text}</Linkify>;
|
||||
}
|
||||
|
||||
export type LogTableProps = {
|
||||
logs: object[];
|
||||
initialPageSize: number;
|
||||
@ -42,49 +39,50 @@ export const LogTable: FC<LogTableProps> = ({ logs, initialPageSize }) => {
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t('Level'),
|
||||
title: t(Localization.Admin.LogTable.level),
|
||||
dataIndex: 'level',
|
||||
key: 'level',
|
||||
filters: [
|
||||
{
|
||||
text: t('Info'),
|
||||
text: t(Localization.Admin.LogTable.info),
|
||||
value: 'info',
|
||||
},
|
||||
{
|
||||
text: t('Warning'),
|
||||
text: t(Localization.Admin.LogTable.warning),
|
||||
value: 'warning',
|
||||
},
|
||||
{
|
||||
text: t('Error'),
|
||||
value: 'Error',
|
||||
text: t(Localization.Admin.LogTable.error),
|
||||
value: 'error',
|
||||
},
|
||||
],
|
||||
onFilter: (level, row) => row.level.indexOf(level) === 0,
|
||||
onFilter: (level, row) => row.level === level,
|
||||
render: renderColumnLevel,
|
||||
},
|
||||
{
|
||||
title: t('Timestamp'),
|
||||
title: t(Localization.Admin.LogTable.timestamp),
|
||||
dataIndex: 'time',
|
||||
key: 'time',
|
||||
render: timestamp => {
|
||||
render: (timestamp: Date) => {
|
||||
const dateObject = new Date(timestamp);
|
||||
return format(dateObject, 'pp P');
|
||||
return format(dateObject, 'p P');
|
||||
},
|
||||
sorter: (a, b) => new Date(a.time).getTime() - new Date(b.time).getTime(),
|
||||
sorter: (a: any, b: any) => new Date(a.time).getTime() - new Date(b.time).getTime(),
|
||||
sortDirections: ['descend', 'ascend'] as SortOrder[],
|
||||
defaultSortOrder: 'descend' as SortOrder,
|
||||
},
|
||||
|
||||
{
|
||||
title: t('Message'),
|
||||
title: t(Localization.Admin.LogTable.message),
|
||||
dataIndex: 'message',
|
||||
key: 'message',
|
||||
render: renderMessage,
|
||||
render: (message: string) => <Linkify>{message}</Linkify>,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="logs-section">
|
||||
<Title>{t('Logs')}</Title>
|
||||
<Title>{t(Localization.Admin.LogTable.logs)}</Title>
|
||||
<Table
|
||||
size="middle"
|
||||
dataSource={logs}
|
||||
|
||||
Reference in New Issue
Block a user