judge: add translation api, add zh_CN.yaml

This commit is contained in:
undefined committed 2020-11-27 22:58:14 +08:00
1 parent eec28d788a
commit c16a1248a0
15 files changed
+88 -52

No files matched your search

+4 -3
View File
@@ -4,6 +4,7 @@ import axios from 'axios';
import AdmZip from 'adm-zip';
import fs from 'fs-extra';
import WebSocket from 'ws';
import { argv } from 'yargs';
import { noop } from 'lodash';
import { ObjectID } from 'bson';
import * as tmpfs from '../tmpfs';
@@ -89,14 +90,14 @@ class JudgeTask {
status: STATUS_COMPILE_ERROR, score: 0, time_ms: 0, memory_kb: 0,
});
} else if (e instanceof FormatError) {
this.next({ judge_text: '题目配置出现错误。请联系题目上传者。' });
this.next({ judge_text: `${e.message}\n${JSON.stringify(e.params)}` });
this.next({ judge_text: 'Testdata configuration incorrect.' });
this.next({ judge_text: { message: e.message, params: e.params } });
this.end({
status: STATUS_SYSTEM_ERROR, score: 0, time_ms: 0, memory_kb: 0,
});
} else {
log.error(e);
this.next({ judge_text: `${e.message}\n${e.stack}\n${JSON.stringify(e.params)}` });
this.next({ message: { message: e.message, params: e.params, ...argv.debug ? { stack: e.stack } : {} } });
this.end({
status: STATUS_SYSTEM_ERROR, score: 0, time_ms: 0, memory_kb: 0,
});
+6
View File
@@ -134,10 +134,16 @@ class JudgeTask {
data.judge_text = data.message;
delete data.message;
}
if (data.judge_text && typeof data.judge_text !== 'string') {
data.judge_text = `${data.judge_text.message} ${JSON.stringify(data.judge_text.params || {})}`;
}
if (data.case?.message !== undefined) {
data.case.judge_text = data.case.message;
delete data.case.message;
}
if (data.case?.judge_text && typeof data.case?.judge_text !== 'string') {
data.case.judge_text = `${data.case.judge_text.message} ${JSON.stringify(data.case.judge_text.params || {})}`;
}
data.key = 'next';
data.tag = this.tag;
if (id) {