Skip to content

Commit

Permalink
feat: Korean language support (1Panel-dev#7727)
Browse files Browse the repository at this point in the history
  • Loading branch information
lan-yonghui authored Jan 15, 2025
1 parent 7bc45f2 commit 9052386
Show file tree
Hide file tree
Showing 15 changed files with 2,788 additions and 35 deletions.
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 ja ru ms 'pt-BR'"`
Language string `json:"language" validate:"required,oneof=zh en tw ja ko ru ms 'pt-BR'"`
}

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 @@ -104,6 +104,7 @@ func Init() {
_, _ = bundle.LoadMessageFileFS(fs, "lang/ja.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/ru.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/ms.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/ko.yaml")
}

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

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ja from 'element-plus/es/locale/lang/ja';
import ms from 'element-plus/es/locale/lang/ms';
import ptBR from 'element-plus/es/locale/lang/pt-br';
import ru from 'element-plus/es/locale/lang/ru';
import ko from 'element-plus/es/locale/lang/ko';
import { useTheme } from '@/hooks/use-theme';
useTheme();
Expand All @@ -30,6 +31,7 @@ const i18nLocale = computed(() => {
if (globalStore.language === 'ms') return ms;
if (globalStore.language === 'ru') return ru;
if (globalStore.language === 'pt-br') return ptBR;
if (globalStore.language === 'ko') return ko;
return zhCn;
});
Expand All @@ -43,5 +45,3 @@ const reload = () => {
};
provide('reload', reload);
</script>

<style scoped lang="scss"></style>
2 changes: 2 additions & 0 deletions frontend/src/lang/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ptBr from './modules/pt-br';
import ja from './modules/ja';
import ru from './modules/ru';
import ms from './modules/ms';
import ko from './modules/ko';

const i18n = createI18n({
legacy: false,
Expand All @@ -20,6 +21,7 @@ const i18n = createI18n({
ja,
ru,
ms,
ko,
},
warnHtmlMessage: false,
});
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const message = {
copy: 'Copy',
random: 'Random',
uninstall: 'Uninstall',
fullscreen: 'Enter fullscreen',
fullscreen: 'Fullscreen',
quitFullscreen: 'Exit fullscreen',
update: 'Edit',
showAll: 'Show All',
Expand Down Expand Up @@ -1942,7 +1942,7 @@ const message = {
app: 'Application',
appNew: 'New Application',
appInstalled: 'Installed application',
create: 'Create website',
create: 'Create',
delete: 'Delete Website',
deleteApp: 'Delete Application',
deleteBackup: 'Delete Backup',
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/lang/modules/ja.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import fit2cloudEnLocale from 'fit2cloud-ui-plus/src/locale/lang/ja';
let xpackJpLocale = {};
import fit2cloudJaLocale from 'fit2cloud-ui-plus/src/locale/lang/ja';
let xpackJaLocale = {};
const xpackModules = import.meta.glob('../../xpack/lang/ja.ts', { eager: true });
if (xpackModules['../../xpack/lang/ja.ts']) {
xpackJpLocale = xpackModules['../../xpack/lang/ja.ts']['default'] || {};
xpackJaLocale = xpackModules['../../xpack/lang/ja.ts']['default'] || {};
}

const message = {
Expand Down Expand Up @@ -59,8 +59,8 @@ const message = {
copy: 'コピー',
random: 'ランダム',
uninstall: 'アンインストール',
fullscreen: 'ルスクリーンを入力します',
quitFullscreen: 'ルスクリーンを終了します',
fullscreen: 'ルスクリーン',
quitFullscreen: 'ルスクリーンを終了',
update: '編',
showAll: 'すべてを表示します',
hideSome: 'いくつかを隠します',
Expand Down Expand Up @@ -1915,7 +1915,7 @@ const message = {
app: '応',
appNew: '新しいアプリケーション',
appInstalled: 'インストールされたアプリケーション',
create: 'Webサイトを作成します',
create: '成する',
delete: 'Webサイトを削除します',
deleteApp: 'アプリケーションを削除します',
deleteBackup: 'バックアップを削除します',
Expand Down Expand Up @@ -2490,7 +2490,7 @@ const message = {
},
};
export default {
...fit2cloudEnLocale,
...fit2cloudJaLocale,
...message,
...xpackJpLocale,
...xpackJaLocale,
};
2,460 changes: 2,460 additions & 0 deletions frontend/src/lang/modules/ko.ts

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions frontend/src/lang/modules/ms.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fit2cloudEnLocale from 'fit2cloud-ui-plus/src/locale/lang/ms';
import fit2cloudMsLocale from 'fit2cloud-ui-plus/src/locale/lang/ms';

let xpackEnLocale = {};
let xpackMsLocale = {};
const xpackModules = import.meta.glob('../../xpack/lang/ms.ts', { eager: true });
if (xpackModules['../../xpack/lang/ms.ts']) {
xpackEnLocale = xpackModules['../../xpack/lang/ms.ts']['default'] || {};
xpackMsLocale = xpackModules['../../xpack/lang/ms.ts']['default'] || {};
}

const message = {
Expand Down Expand Up @@ -60,8 +60,8 @@ const message = {
copy: 'Salin',
random: 'Rawak',
uninstall: 'Nyahpasang',
fullscreen: 'Masuk ke skrin penuh',
quitFullscreen: 'Keluar dari skrin penuh',
fullscreen: 'Skrin Penuh',
quitFullscreen: 'Keluar Skrin Penuh',
update: 'Kemas kini',
showAll: 'Tunjukkan Semua',
hideSome: 'Sembunyikan Sebahagian',
Expand Down Expand Up @@ -1966,7 +1966,7 @@ const message = {
app: 'Aplikasi',
appNew: 'Aplikasi Baru',
appInstalled: 'Aplikasi yang Dipasang',
create: 'Cipta laman web',
create: 'Cipta',
delete: 'Padam Laman Web',
deleteApp: 'Padam Aplikasi',
deleteBackup: 'Padam Sandaran',
Expand Down Expand Up @@ -2551,7 +2551,7 @@ const message = {
};

export default {
...fit2cloudEnLocale,
...fit2cloudMsLocale,
...message,
...xpackEnLocale,
...xpackMsLocale,
};
4 changes: 2 additions & 2 deletions frontend/src/lang/modules/pt-br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const message = {
copy: 'Copiar',
random: 'Aleatório',
uninstall: 'Desinstalar',
fullscreen: 'Entrar em tela cheia',
fullscreen: 'Tela Cheia',
quitFullscreen: 'Sair da tela cheia',
update: 'Editar',
showAll: 'Exibir tudo',
Expand Down Expand Up @@ -1957,7 +1957,7 @@ const message = {
app: 'Aplicativo',
appNew: 'Novo Aplicativo',
appInstalled: 'Aplicativo instalado',
create: 'Criar site',
create: 'Criar',
delete: 'Excluir site',
deleteApp: 'Excluir Aplicativo',
deleteBackup: 'Excluir Backup',
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/lang/modules/ru.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fit2cloudEnLocale from 'fit2cloud-ui-plus/src/locale/lang/ru';
import fit2cloudRuLocale from 'fit2cloud-ui-plus/src/locale/lang/ru';

let xpackEnLocale = {};
let xpackRuLocale = {};
const xpackModules = import.meta.glob('../../xpack/lang/ru.ts', { eager: true });
if (xpackModules['../../xpack/lang/ru.ts']) {
xpackEnLocale = xpackModules['../../xpack/lang/ru.ts']['default'] || {};
xpackRuLocale = xpackModules['../../xpack/lang/ru.ts']['default'] || {};
}

const message = {
Expand Down Expand Up @@ -1957,7 +1957,7 @@ const message = {
app: 'Приложение',
appNew: 'Новое приложение',
appInstalled: 'Установленное приложение',
create: 'Создать веб-сайт',
create: 'Создать',
delete: 'Удалить веб-сайт',
deleteApp: 'Удалить приложение',
deleteBackup: 'Удалить резервную копию',
Expand Down Expand Up @@ -2542,7 +2542,7 @@ const message = {
};

export default {
...fit2cloudEnLocale,
...fit2cloudRuLocale,
...message,
...xpackEnLocale,
...xpackRuLocale,
};
6 changes: 3 additions & 3 deletions frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ const message = {
copy: '複製',
random: '隨機密碼',
uninstall: '移除',
fullscreen: '頁全螢幕',
quitFullscreen: '退出網頁全螢幕',
fullscreen: '全螢幕',
quitFullscreen: '退出全螢幕',
update: '編輯',
showAll: '顯示所有',
hideSome: '隱藏部分',
Expand Down Expand Up @@ -1815,7 +1815,7 @@ const message = {
app: '應用',
appNew: '新裝應用',
appInstalled: '已裝應用',
create: '立網站',
create: '建立',
delete: '刪除網站',
deleteApp: '刪除應用',
deleteBackup: '刪除備份',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ const message = {
copy: '复制',
random: '随机密码',
uninstall: '卸载',
fullscreen: '网页全屏',
quitFullscreen: '退出网页全屏',
fullscreen: '全屏',
quitFullscreen: '退出全屏',
update: '编辑',
showAll: '显示所有',
hideSome: '隐藏部分',
Expand Down Expand Up @@ -1815,7 +1815,7 @@ const message = {
app: '应用',
appNew: '新装应用',
appInstalled: '已装应用',
create: '创建网站',
create: '创建',
delete: '删除网站',
deleteApp: '删除应用',
deleteBackup: '删除备份',
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/views/login/components/login-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
</el-dropdown-item>
<el-dropdown-item command="ja">日本語</el-dropdown-item>
<el-dropdown-item command="pt-BR">Português (Brasil)</el-dropdown-item>
<el-dropdown-item command="ko">한국어</el-dropdown-item>
<el-dropdown-item command="ru">Русский</el-dropdown-item>
<el-dropdown-item command="ms">Bahasa Melayu</el-dropdown-item>
</el-dropdown-menu>
Expand Down Expand Up @@ -278,6 +279,8 @@ function handleCommand(command: string) {
dropdownText.value = 'Português (Brasil)';
} else if (command === 'tw') {
dropdownText.value = '中文(繁體)';
} else if (command === 'ko') {
dropdownText.value = '한국어';
} else if (command === 'ja') {
dropdownText.value = '日本語';
} else if (command === 'ru') {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/setting/panel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ const languageOptions = ref([
...(!globalStore.isIntl ? [{ value: 'en', label: 'English' }] : []),
{ value: 'ja', label: '日本語' },
{ value: 'pt-BR', label: 'Português (Brasil)' },
{ value: 'ko', label: '한국어' },
{ value: 'ru', label: 'Русский' },
{ value: 'ms', label: 'Bahasa Melayu' },
]);
Expand Down

0 comments on commit 9052386

Please sign in to comment.