core&ui: allow edit ja_jp statement

This commit is contained in:
undefined committed 2025-10-29 17:29:59 +08:00
1 parent c416c1893e
commit 15c58e0404
4 files changed
+14 -6

No files matched your search

+1
View File
@@ -608,6 +608,7 @@ export class ProblemManageHandler extends ProblemDetailHandler {
export class ProblemEditHandler extends ProblemManageHandler {
async get() {
this.response.body.additional_file = sortFiles(this.pdoc.additional_file || []);
this.response.body.statementLangs = this.ctx.i18n.langs(false);
this.response.template = 'problem_edit.html';
}
+9
View File
@@ -20,6 +20,15 @@ export class I18nService extends Service {
this.load('ja', { __flag: '🇯🇵', __id: 'ja', __langname: '日本語' });
}
langs(interfaceOnly = false) {
const langs: Record<string, string> = {};
for (const lang in translations) {
if (interfaceOnly && !translations[lang].find((i) => i.__interface)) continue;
langs[lang] = this.get('__langname', lang);
}
return langs;
}
load(lang: string, content: Record<string, string>) {
this.ctx.effect(() => {
translations[lang] ||= [];