Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP(Language management): Support Japanese by Google Translate #7437

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/app/dto/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Login struct {
Captcha string `json:"captcha"`
CaptchaID string `json:"captchaID"`
AuthMethod string `json:"authMethod" validate:"required,oneof=jwt session"`
Language string `json:"language" validate:"required,oneof=zh en tw"`
Language string `json:"language" validate:"required,oneof=zh en tw jp"`
}

type MFALogin struct {
Expand Down
1 change: 1 addition & 0 deletions backend/i18n/i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func Init() {
_, _ = bundle.LoadMessageFileFS(fs, "lang/zh-Hant.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/fa.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/pt.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/jp.yaml")
}

func UseI18nForCmd(lang string) {
Expand Down
283 changes: 283 additions & 0 deletions backend/i18n/lang/jp.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions frontend/src/lang/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createI18n } from 'vue-i18n';
import zh from './modules/zh';
import tw from './modules/tw';
import en from './modules/en';
import jp from './modules/jp';

const i18n = createI18n({
legacy: false,
Expand All @@ -12,6 +13,7 @@ const i18n = createI18n({
zh,
tw,
en,
jp,
},
warnHtmlMessage: false,
});
Expand Down
2,487 changes: 2,487 additions & 0 deletions frontend/src/lang/modules/jp.ts

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions frontend/src/views/login/components/login-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@
<el-dropdown-item v-if="globalStore.isIntl" command="en">
English
</el-dropdown-item>
<el-dropdown-item v-if="globalStore.isIntl" command="jp">
日本語
</el-dropdown-item>
<el-dropdown-item command="zh">中文(简体)</el-dropdown-item>
<el-dropdown-item command="tw">中文(繁體)</el-dropdown-item>
<el-dropdown-item v-if="!globalStore.isIntl" command="en">
English
</el-dropdown-item>
<el-dropdown-item v-if="!globalStore.isIntl" command="jp">
日本語
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
Expand Down Expand Up @@ -272,6 +278,8 @@ function handleCommand(command: string) {
dropdownText.value = 'English';
} else if (command === 'tw') {
dropdownText.value = '中文(繁體)';
} else if (command === 'jp') {
dropdownText.value = '日本語';
}
nextTick(() => {
loginFormRef.value.clearValidate();
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/setting/panel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@
v-model="form.language"
>
<el-radio v-if="globalStore.isIntl" value="en">English</el-radio>
<el-radio v-if="globalStore.isIntl" value="jp">日本語</el-radio>
<el-radio value="zh">中文(简体)</el-radio>
<el-radio value="tw">中文(繁體)</el-radio>
<el-radio v-if="!globalStore.isIntl" value="en">English</el-radio>
<el-radio v-if="!globalStore.isIntl" value="jp">日本語</el-radio>
</el-radio-group>
</el-form-item>

Expand Down
Loading