Skip to content

Commit

Permalink
i18n: make some type error
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjunyu19 committed Jan 23, 2024
1 parent 4d06707 commit 0eedda8
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 86 deletions.
12 changes: 6 additions & 6 deletions src/GZCTF/ClientApp/src/components/AppNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ interface NavbarItem {
}

const items: NavbarItem[] = [
{ icon: mdiHomeVariantOutline, label: '主页', link: '/' },
{ icon: mdiNoteTextOutline, label: '文章', link: '/posts' },
{ icon: mdiFlagOutline, label: '赛事', link: '/games' },
{ icon: mdiAccountGroupOutline, label: '队伍', link: '/teams' },
{ icon: mdiInformationOutline, label: '关于', link: '/about' },
{ icon: mdiWrenchOutline, label: '管理', link: '/admin/games', admin: true },
{ icon: mdiHomeVariantOutline, label: t('主页'), link: '/' },
{ icon: mdiNoteTextOutline, label: t('文章'), link: '/posts' },
{ icon: mdiFlagOutline, label: t('赛事'), link: '/games' },
{ icon: mdiAccountGroupOutline, label: t('队伍'), link: '/teams' },
{ icon: mdiInformationOutline, label: t('关于'), link: '/about' },
{ icon: mdiWrenchOutline, label: t('管理'), link: '/admin/games', admin: true },
]

export interface NavbarLinkProps {
Expand Down
88 changes: 44 additions & 44 deletions src/GZCTF/ClientApp/src/components/ChallengeDetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,53 +39,53 @@ interface ChallengeDetailModalProps extends ModalProps {
}

export const FlagPlaceholders: string[] = [
'横看成岭侧成峰,flag 高低各不同',
'flag 当关,万夫莫开',
'寻寻觅觅,冷冷清清,flag 惨惨戚戚',
'问君能有几多愁?恰似一江 flag 向东流',
'人生得意须尽欢,莫使 flag 空对月',
'汉皇重色思 flag,御宇多年求不得',
'flag 几时有?把酒问青天',
'羽扇纶巾,谈笑间,flag 灰飞烟灭',
'浊酒一杯家万里,flag 未勒归无计',
'孤帆远影碧空尽,唯见 flag 天际流',
'安得 flag 千万间,大庇天下 ctfer 俱欢颜!',
'两个黄鹂鸣翠柳,一行 flag 上青天',
'flag 一场大梦,人生几度秋凉?',
'剪不断,理还乱,是 flag',
'蓦然回首,flag 却在,灯火阑珊处',
'稻花香里说丰年,听取 flag 一片',
'采菊东篱下,悠然见 flag',
'不畏 flag 遮望眼,自缘身在最高层',
'便纵有千种 flag,更与何人说?',
'人生自古谁无死?留取 flag 照汗青',
'借问 flag 何处有?牧童遥指杏花村',
t('横看成岭侧成峰,flag 高低各不同'),
t('flag 当关,万夫莫开'),
t('寻寻觅觅,冷冷清清,flag 惨惨戚戚'),
t('问君能有几多愁?恰似一江 flag 向东流'),
t('人生得意须尽欢,莫使 flag 空对月'),
t('汉皇重色思 flag,御宇多年求不得'),
t('flag 几时有?把酒问青天'),
t('羽扇纶巾,谈笑间,flag 灰飞烟灭'),
t('浊酒一杯家万里,flag 未勒归无计'),
t('孤帆远影碧空尽,唯见 flag 天际流'),
t('安得 flag 千万间,大庇天下 ctfer 俱欢颜!'),
t('两个黄鹂鸣翠柳,一行 flag 上青天'),
t('flag 一场大梦,人生几度秋凉?'),
t('剪不断,理还乱,是 flag'),
t('蓦然回首,flag 却在,灯火阑珊处'),
t('稻花香里说丰年,听取 flag 一片'),
t('采菊东篱下,悠然见 flag'),
t('不畏 flag 遮望眼,自缘身在最高层'),
t('便纵有千种 flag,更与何人说?'),
t('人生自古谁无死?留取 flag 照汗青'),
t('借问 flag 何处有?牧童遥指杏花村'),
]

export const WrongFlagHints: string[] = [
'饮水思源,重新审题吧。',
'诗云:路漫漫其修远兮,再接再厉吧。',
'沉着冷静,可能会有意想不到的收获。',
'失败乃成功之母,回去再琢磨琢磨。',
'非也非也,不是这个 flag。',
'望眼欲穿,flag 却不在这里。',
'不要浮躁,仔细再思考思考。',
'翻遍天涯,也不是这个答案。',
'走马观花,可找不到 flag。',
'反复推敲,答案应该就在你手边。',
'深谋远虑,flag 不是那么简单。',
'山高水远,flag 藏得真是深啊!',
'时运不济,碾过你的难道是寂寞?',
'兴奋过头,还需要学会更加冷静的思考。',
'碰壁了,难道是你已经到了巅峰?',
'岁月静好,flag 却已然远去。',
'浅水已涸,flag 不可复得。',
'白雪纷纷何所似,似此 flag 被错过。',
'旧事追思,往事如烟。flag 已然消逝。',
'桃花潭水深千尺,不及 flag 不见了踪迹。',
'万籁俱寂,唯有 flag 的错误提示在耳边响起。',
'陌上花开,可缓缓归矣。flag 未得而返。',
'风萧萧兮易水寒,无奈 flag 仍未到彼岸。',
t('饮水思源,重新审题吧。'),
t('诗云:路漫漫其修远兮,再接再厉吧。'),
t('沉着冷静,可能会有意想不到的收获。'),
t('失败乃成功之母,回去再琢磨琢磨。'),
t('非也非也,不是这个 flag。'),
t('望眼欲穿,flag 却不在这里。'),
t('不要浮躁,仔细再思考思考。'),
t('翻遍天涯,也不是这个答案。'),
t('走马观花,可找不到 flag。'),
t('反复推敲,答案应该就在你手边。'),
t('深谋远虑,flag 不是那么简单。'),
t('山高水远,flag 藏得真是深啊!'),
t('时运不济,碾过你的难道是寂寞?'),
t('兴奋过头,还需要学会更加冷静的思考。'),
t('碰壁了,难道是你已经到了巅峰?'),
t('岁月静好,flag 却已然远去。'),
t('浅水已涸,flag 不可复得。'),
t('白雪纷纷何所似,似此 flag 被错过。'),
t('旧事追思,往事如烟。flag 已然消逝。'),
t('桃花潭水深千尺,不及 flag 不见了踪迹。'),
t('万籁俱寂,唯有 flag 的错误提示在耳边响起。'),
t('陌上花开,可缓缓归矣。flag 未得而返。'),
t('风萧萧兮易水寒,无奈 flag 仍未到彼岸。'),
]

const ChallengeDetailModal: FC<ChallengeDetailModalProps> = (props) => {
Expand Down
8 changes: 4 additions & 4 deletions src/GZCTF/ClientApp/src/components/StrengthPasswordInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const PasswordRequirement: FC<{ meets: boolean; label: string }> = ({ meets, lab
}

const requirements = [
{ re: /[0-9]/, label: '包含数字' },
{ re: /[a-z]/, label: '包含小写字母' },
{ re: /[A-Z]/, label: '包含大写字母' },
{ re: /[`$&+,:;=?@#|'<>.^*()%!-]/, label: '包含特殊字符' },
{ re: /[0-9]/, label: t('包含数字') },
{ re: /[a-z]/, label: t('包含小写字母') },
{ re: /[A-Z]/, label: t('包含大写字母') },
{ re: /[`$&+,:;=?@#|'<>.^*()%!-]/, label: t('包含特殊字符') },
]

const getStrength = (password: string) => {
Expand Down
8 changes: 4 additions & 4 deletions src/GZCTF/ClientApp/src/components/WithGameMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { useTranslation } from '@Utils/I18n'
import { Role } from '@Api'

const pages = [
{ icon: mdiLightningBolt, title: '事件监控', path: 'events' },
{ icon: mdiFlag, title: '提交记录', path: 'submissions' },
{ icon: mdiExclamationThick, title: '作弊信息', path: 'cheatinfo' },
{ icon: mdiPackageVariant, title: '流量捕获', path: 'traffic' },
{ icon: mdiLightningBolt, title: t('事件监控'), path: 'events' },
{ icon: mdiFlag, title: t('提交记录'), path: 'submissions' },
{ icon: mdiExclamationThick, title: t('作弊信息'), path: 'cheatinfo' },
{ icon: mdiPackageVariant, title: t('流量捕获'), path: 'traffic' },
]

interface WithGameMonitorProps extends React.PropsWithChildren {
Expand Down
6 changes: 3 additions & 3 deletions src/GZCTF/ClientApp/src/components/WithGameTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { DetailedGameInfoModel, ParticipationStatus, Role } from '@Api'
const pages = [
{
icon: mdiFlagOutline,
title: '比赛题目',
title: t('比赛题目'),
path: 'challenges',
link: 'challenges',
color: 'blue',
Expand All @@ -27,7 +27,7 @@ const pages = [
},
{
icon: mdiChartLine,
title: '积分总榜',
title: t('积分总榜'),
path: 'scoreboard',
link: 'scoreboard',
color: 'yellow',
Expand All @@ -36,7 +36,7 @@ const pages = [
},
{
icon: mdiMonitorEye,
title: '比赛监控',
title: t('比赛监控'),
path: 'monitor',
link: 'monitor/events',
color: 'green',
Expand Down
2 changes: 1 addition & 1 deletion src/GZCTF/ClientApp/src/components/admin/FlagEditPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const FlagCard: FC<FlagCardProps> = ({ flag, onDelete, unifiedAttachment }) => {
onClick={() => {
clipboard.copy(flag.flag)
showNotification({
message: 'flag 已复制到剪贴板',
message: t('flag 已复制到剪贴板'),
color: 'teal',
icon: <Icon path={mdiCheck} size={1} />,
})
Expand Down
12 changes: 6 additions & 6 deletions src/GZCTF/ClientApp/src/components/admin/WithAdminTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import { useTranslation } from '@Utils/I18n'
import { usePageTitle } from '@Utils/usePageTitle'

const pages = [
{ icon: mdiFlagOutline, title: '比赛管理', path: 'games', color: 'yellow' },
{ icon: mdiAccountGroupOutline, title: '队伍管理', path: 'teams', color: 'green' },
{ icon: mdiAccountCogOutline, title: '用户管理', path: 'users', color: 'cyan' },
{ icon: mdiPackageVariantClosed, title: '容器管理', path: 'instances', color: 'blue' },
{ icon: mdiFileDocumentOutline, title: '系统日志', path: 'logs', color: 'red' },
{ icon: mdiSitemapOutline, title: '全局设置', path: 'configs', color: 'orange' },
{ icon: mdiFlagOutline, title: t('比赛管理'), path: 'games', color: 'yellow' },
{ icon: mdiAccountGroupOutline, title: t('队伍管理'), path: 'teams', color: 'green' },
{ icon: mdiAccountCogOutline, title: t('用户管理'), path: 'users', color: 'cyan' },
{ icon: mdiPackageVariantClosed, title: t('容器管理'), path: 'instances', color: 'blue' },
{ icon: mdiFileDocumentOutline, title: t('系统日志'), path: 'logs', color: 'red' },
{ icon: mdiSitemapOutline, title: t('全局设置'), path: 'configs', color: 'orange' },
]

export interface AdminTabProps extends React.PropsWithChildren {
Expand Down
8 changes: 4 additions & 4 deletions src/GZCTF/ClientApp/src/components/admin/WithGameEditTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { useLocation, useNavigate, useParams } from 'react-router-dom'
import AdminPage from '@Components/admin/AdminPage'

const pages = [
{ icon: mdiTextBoxOutline, title: '信息编辑', path: 'info' },
{ icon: mdiBullhornOutline, title: '比赛通知', path: 'notices' },
{ icon: mdiFlagOutline, title: '题目编辑', path: 'challenges' },
{ icon: mdiAccountGroupOutline, title: '队伍审核', path: 'review' },
{ icon: mdiTextBoxOutline, title: t('信息编辑'), path: 'info' },
{ icon: mdiBullhornOutline, title: t('比赛通知'), path: 'notices' },
{ icon: mdiFlagOutline, title: t('题目编辑'), path: 'challenges' },
{ icon: mdiAccountGroupOutline, title: t('队伍审核'), path: 'review' },
{ icon: mdiFileDocumentCheckOutline, title: 'Writeups', path: 'writeups' },
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import { useEditChallenge } from '@Utils/useEdit'
import api, { ChallengeType, FileType, FlagInfoModel } from '@Api'

const FileTypeDesrcMap = new Map<FileType, string>([
[FileType.None, '无附件'],
[FileType.Remote, '远程文件'],
[FileType.Local, '平台附件'],
[FileType.None, t('无附件')],
[FileType.Remote, t('远程文件')],
[FileType.Local, t('平台附件')],
])

interface FlagEditProps {
Expand Down
22 changes: 11 additions & 11 deletions src/GZCTF/ClientApp/src/pages/games/[id]/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const GameAlertMap = new Map([
{
color: 'yellow',
icon: mdiTimerSand,
label: '你已经以队伍 {TEAM} 成员身份成功报名',
content: '请耐心等待审核结果',
label: t('你已经以队伍 {TEAM} 成员身份成功报名'),
content: t('请耐心等待审核结果'),
},
],
[ParticipationStatus.Accepted, null],
Expand All @@ -46,28 +46,28 @@ const GameAlertMap = new Map([
{
color: 'red',
icon: mdiAlertCircle,
label: '您的参赛申请未通过',
content: '请确保具备参赛资格和满足参赛要求后重新报名',
label: t('您的参赛申请未通过'),
content: t('请确保具备参赛资格和满足参赛要求后重新报名'),
},
],
[
ParticipationStatus.Suspended,
{
color: 'red',
icon: mdiAlertCircle,
label: '您的队伍 {TEAM} 已被禁赛',
content: '如有异议,请联系管理员进行申诉',
label: t('您的队伍 {TEAM} 已被禁赛'),
content: t('如有异议,请联系管理员进行申诉'),
},
],
[ParticipationStatus.Unsubmitted, null],
])

const GameActionMap = new Map([
[ParticipationStatus.Pending, '等待审核'],
[ParticipationStatus.Accepted, '通过审核'],
[ParticipationStatus.Rejected, '重新报名'],
[ParticipationStatus.Suspended, '通过审核'],
[ParticipationStatus.Unsubmitted, '报名参赛'],
[ParticipationStatus.Pending, t('等待审核')],
[ParticipationStatus.Accepted, t('通过审核')],
[ParticipationStatus.Rejected, t('重新报名')],
[ParticipationStatus.Suspended, t('通过审核')],
[ParticipationStatus.Unsubmitted, t('报名参赛')],
])

const GetAlert = (status: ParticipationStatus, team: string) => {
Expand Down

0 comments on commit 0eedda8

Please sign in to comment.