Skip to content

Commit d96ccd0

Browse files
JB-SelfCompanyBubblegum
andauthored
Russian language support. (#7554)
* Add Russian language * Use prettier --------- Co-authored-by: Bubblegum <jack_benq@selfhosted.lan>
1 parent 14095af commit d96ccd0

File tree

8 files changed

+2877
-4
lines changed

8 files changed

+2877
-4
lines changed

backend/app/dto/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type Login struct {
2929
Captcha string `json:"captcha"`
3030
CaptchaID string `json:"captchaID"`
3131
AuthMethod string `json:"authMethod" validate:"required,oneof=jwt session"`
32-
Language string `json:"language" validate:"required,oneof=zh en tw"`
32+
Language string `json:"language" validate:"required,oneof=zh en tw ru"`
3333
}
3434

3535
type MFALogin struct {

backend/i18n/i18n.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ func GetMsgByKey(key string) string {
7575
return content
7676
}
7777

78-
//go:embed lang/*
7978
var fs embed.FS
8079
var bundle *i18n.Bundle
8180

@@ -100,6 +99,7 @@ func Init() {
10099
_, _ = bundle.LoadMessageFileFS(fs, "lang/zh-Hant.yaml")
101100
_, _ = bundle.LoadMessageFileFS(fs, "lang/fa.yaml")
102101
_, _ = bundle.LoadMessageFileFS(fs, "lang/pt.yaml")
102+
_, _ = bundle.LoadMessageFileFS(fs, "lang/ru.yaml")
103103
}
104104

105105
func UseI18nForCmd(lang string) {

backend/i18n/lang/ru.yaml

Lines changed: 283 additions & 0 deletions
Large diffs are not rendered by default.

frontend/src/lang/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createI18n } from 'vue-i18n';
22
import zh from './modules/zh';
33
import tw from './modules/tw';
44
import en from './modules/en';
5+
import ru from './modules/ru';
56

67
const i18n = createI18n({
78
legacy: false,
@@ -12,6 +13,7 @@ const i18n = createI18n({
1213
zh,
1314
tw,
1415
en,
16+
ru,
1517
},
1618
warnHtmlMessage: false,
1719
});

frontend/src/lang/modules/ru.ts

Lines changed: 2535 additions & 0 deletions
Large diffs are not rendered by default.

frontend/src/views/home/status/index.vue

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<el-row :gutter="10">
2+
<el-row :gutter="10" class="status-container">
33
<el-col :xs="12" :sm="12" :md="6" :lg="6" :xl="6" align="center">
44
<el-popover placement="bottom" :width="loadWidth()" trigger="hover" v-if="chartsOption['cpu']">
55
<div>
@@ -52,7 +52,7 @@
5252
</span>
5353
</el-col>
5454
<el-col :xs="12" :sm="12" :md="6" :lg="6" :xl="6" align="center">
55-
<el-popover placement="bottom" :width="160" trigger="hover" v-if="chartsOption['memory']">
55+
<el-popover placement="bottom" :width="200" trigger="hover" v-if="chartsOption['memory']">
5656
<el-tag style="font-weight: 500">{{ $t('home.mem') }}:</el-tag>
5757
<el-tag class="tagClass">{{ $t('home.total') }}: {{ computeSize(currentInfo.memoryTotal) }}</el-tag>
5858
<el-tag class="tagClass">{{ $t('home.used') }}: {{ computeSize(currentInfo.memoryUsed) }}</el-tag>
@@ -431,6 +431,39 @@ defineExpose({
431431
</script>
432432

433433
<style scoped lang="scss">
434+
.status-container {
435+
:deep(.el-button) {
436+
min-width: 180px;
437+
padding: 8px 16px;
438+
height: auto;
439+
white-space: normal;
440+
line-height: 1.5;
441+
text-align: left;
442+
}
443+
444+
:deep(.el-tag) {
445+
min-width: 180px;
446+
padding: 8px 12px;
447+
height: auto;
448+
white-space: normal;
449+
line-height: 1.5;
450+
margin: 4px;
451+
text-align: left;
452+
}
453+
454+
:deep(.el-button--primary) {
455+
background-color: var(--el-color-primary);
456+
&.is-plain {
457+
background: var(--el-color-primary-light-9);
458+
color: var(--el-color-primary);
459+
&:hover {
460+
background: var(--el-color-primary);
461+
color: white;
462+
}
463+
}
464+
}
465+
}
466+
434467
.cpuModeTag {
435468
justify-content: flex-start !important;
436469
text-align: left !important;
@@ -445,6 +478,10 @@ defineExpose({
445478
}
446479
.tagClass {
447480
margin-top: 3px;
481+
min-width: 140px;
482+
white-space: normal;
483+
height: auto;
484+
line-height: 1.5;
448485
}
449486
450487
.tagCPUClass {
@@ -460,6 +497,14 @@ defineExpose({
460497
margin-top: 28%;
461498
font-size: 14px;
462499
}
500+
501+
.input-help {
502+
display: inline-block;
503+
min-width: 120px;
504+
white-space: normal;
505+
line-height: 1.2;
506+
padding: 2px 4px;
507+
}
463508
.nameTag {
464509
margin-top: 3px;
465510
height: auto;

frontend/src/views/login/components/login-form.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@
5555
<el-dropdown-item v-if="globalStore.isIntl" command="en">
5656
English
5757
</el-dropdown-item>
58+
<el-dropdown-item v-if="globalStore.isIntl" command="ru">
59+
Русский
60+
</el-dropdown-item>
5861
<el-dropdown-item command="zh">中文(简体)</el-dropdown-item>
5962
<el-dropdown-item command="tw">中文(繁體)</el-dropdown-item>
6063
<el-dropdown-item v-if="!globalStore.isIntl" command="en">
6164
English
6265
</el-dropdown-item>
6366
</el-dropdown-menu>
67+
<el-dropdown-item v-if="!globalStore.isIntl" command="ru">Русский</el-dropdown-item>
6468
</template>
6569
</el-dropdown>
6670
</div>
@@ -272,6 +276,8 @@ function handleCommand(command: string) {
272276
dropdownText.value = 'English';
273277
} else if (command === 'tw') {
274278
dropdownText.value = '中文(繁體)';
279+
} else if (command === 'ru') {
280+
dropdownText.value = 'Русский';
275281
}
276282
nextTick(() => {
277283
loginFormRef.value.clearValidate();

frontend/src/views/setting/panel/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@
7878
v-model="form.language"
7979
>
8080
<el-radio v-if="globalStore.isIntl" value="en">English</el-radio>
81+
<el-radio v-if="globalStore.isIntl" value="ru">Русский</el-radio>
8182
<el-radio value="zh">中文(简体)</el-radio>
8283
<el-radio value="tw">中文(繁體)</el-radio>
8384
<el-radio v-if="!globalStore.isIntl" value="en">English</el-radio>
85+
<el-radio v-if="!globalStore.isIntl" value="ru">Русский</el-radio>
8486
</el-radio-group>
8587
</el-form-item>
8688

0 commit comments

Comments
 (0)