mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: allow edit ja_jp statement
This commit is contained in:
4 files changed
+14
-6
No files matched your search
@@ -608,6 +608,7 @@ export class ProblemManageHandler extends ProblemDetailHandler {
|
|||||||
export class ProblemEditHandler extends ProblemManageHandler {
|
export class ProblemEditHandler extends ProblemManageHandler {
|
||||||
async get() {
|
async get() {
|
||||||
this.response.body.additional_file = sortFiles(this.pdoc.additional_file || []);
|
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';
|
this.response.template = 'problem_edit.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,15 @@ export class I18nService extends Service {
|
|||||||
this.load('ja', { __flag: '🇯🇵', __id: 'ja', __langname: '日本語' });
|
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>) {
|
load(lang: string, content: Record<string, string>) {
|
||||||
this.ctx.effect(() => {
|
this.ctx.effect(() => {
|
||||||
translations[lang] ||= [];
|
translations[lang] ||= [];
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</style>
|
</style>
|
||||||
{% if process.env.DEV %}
|
{% if process.env.DEV %}
|
||||||
<script src="/default.theme.js?version={{ global.Hydro.version['ui-default'] }}"></script>
|
<script src="/default.theme.js?version={{ global.Hydro.version['ui-default'] }}"></script>
|
||||||
<link rel="stylesheet" media="all" href="/theme.css?version={{ global.Hydro.version['ui-default'] }}">
|
<link rel="stylesheet" media="all" href="/theme-{{ global.Hydro.version['ui-default'] }}.css">
|
||||||
{% else %}
|
{% else %}
|
||||||
<link rel="stylesheet" media="all" href="{{ UiContext.cdn_prefix }}theme-{{ global.Hydro.version['ui-default'] }}.css">
|
<link rel="stylesheet" media="all" href="{{ UiContext.cdn_prefix }}theme-{{ global.Hydro.version['ui-default'] }}.css">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -52,11 +52,9 @@
|
|||||||
<div class="section__tab-header-wrapper">
|
<div class="section__tab-header-wrapper">
|
||||||
<ul class="section__tab-header">
|
<ul class="section__tab-header">
|
||||||
<li class="section__tab-header-item tab--active" data-lang="{{ _('__id') }}">{{ _('__langname') }}</li>
|
<li class="section__tab-header-item tab--active" data-lang="{{ _('__id') }}">{{ _('__langname') }}</li>
|
||||||
{% for k, v in model.setting.SETTINGS_BY_KEY['viewLang'].range %}
|
{% for k, v in statementLangs %}{% if k != handler.user.viewLang %}
|
||||||
{% if k != handler.user.viewLang %}
|
<li class="section__tab-header-item" data-lang="{{ k }}">{{ v }}</li>
|
||||||
<li class="section__tab-header-item" data-lang="{{ k }}">{{ v }}</li>
|
{% endif %}{% endfor %}
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user