mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-01-12 14:54:34 +08:00
Feat: i18n & dark mode
This commit is contained in:
parent
a63ece10bc
commit
54f2e9df4f
@ -28,6 +28,10 @@
|
||||
.ant-btn-default {
|
||||
background-color: var(--vscode-bg-color);
|
||||
}
|
||||
.ant-modal-content {
|
||||
border: 1px solid var(--color-gray-5);
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.app-dark-base-color {
|
||||
|
@ -179,7 +179,19 @@ const appMenus = computed(() => {
|
||||
title: t("TXT_CODE_f591e2fa"),
|
||||
icon: FormatPainterOutlined,
|
||||
click: (key: string) => {
|
||||
setTheme(key as THEME);
|
||||
if (key === THEME.DARK) {
|
||||
Modal.confirm({
|
||||
title: $t("确定要切换到深色模式吗?"),
|
||||
content: $t(
|
||||
"MCSManager 优先确保浅色模式的用户体验,深色模式对于某些界面可能较差的用户体验。"
|
||||
),
|
||||
async onOk() {
|
||||
setTheme(THEME.DARK);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setTheme(THEME.LIGHT);
|
||||
}
|
||||
},
|
||||
conditions: !containerState.isDesignMode,
|
||||
onlyPC: false,
|
||||
|
@ -123,7 +123,7 @@ let btns = arrayFilter([
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
> div {
|
||||
min-width: 110px;
|
||||
min-width: 120px;
|
||||
margin: 0px 6px;
|
||||
margin-bottom: 8px;
|
||||
padding: 2px 4px;
|
||||
|
@ -140,7 +140,7 @@ const handleChangePassword = async () => {
|
||||
:title="t('TXT_CODE_6819de18')"
|
||||
@confirm="handleGenerateApiKey(false)"
|
||||
>
|
||||
<a-button danger> {{ t("TXT_CODE_b1dedda3") }} </a-button>
|
||||
<a-button danger> {{ t("TXT_CODE_718c9310") }} </a-button>
|
||||
</a-popconfirm>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
@ -70,13 +70,6 @@ const cardCategoryList = [
|
||||
];
|
||||
|
||||
const currentCardCategory = ref<NEW_CARD_TYPE>(NEW_CARD_TYPE.COMMON);
|
||||
|
||||
const handleTabClick = (value: string) => {
|
||||
if (value === "EXIT") {
|
||||
containerState.showNewCardDialog = false;
|
||||
currentCardCategory.value = NEW_CARD_TYPE.COMMON;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -90,7 +83,7 @@ const handleTabClick = (value: string) => {
|
||||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
<a-button class="ml-8" @click="() => (containerState.showNewCardDialog = false)">
|
||||
{{ t("TXT_CODE_b1dedda3") }}
|
||||
{{ t("TXT_CODE_a7e9d4e") }}
|
||||
</a-button>
|
||||
</div>
|
||||
<div v-for="card in cardPool" :key="card.id + currentCardCategory">
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { t } from "@/lang/i18n";
|
||||
import { isCN, t } from "@/lang/i18n";
|
||||
import { remoteNodeList } from "@/services/apis";
|
||||
import { arrayFilter } from "@/tools/array";
|
||||
import type { LayoutCard } from "@/types";
|
||||
@ -97,13 +97,16 @@ export function useQuickStartFlow() {
|
||||
formData.appType = appType;
|
||||
currentIcon.value = DatabaseTwoTone;
|
||||
await execute();
|
||||
formData.actions = remoteNodes.value?.map((v) => {
|
||||
return {
|
||||
title: `${v.ip}:${v.port} (${v.remarks})`,
|
||||
key: v.uuid,
|
||||
icon: NodeIndexOutlined
|
||||
};
|
||||
});
|
||||
formData.actions = remoteNodes.value
|
||||
?.filter((v) => v.available)
|
||||
?.map((v) => {
|
||||
return {
|
||||
title: `${v.ip}:${v.port} (${v.remarks})`,
|
||||
key: v.uuid,
|
||||
icon: NodeIndexOutlined
|
||||
};
|
||||
});
|
||||
|
||||
formData.title = t("TXT_CODE_d182c422");
|
||||
};
|
||||
|
||||
@ -118,8 +121,9 @@ export function useQuickStartFlow() {
|
||||
key: QUICKSTART_METHOD.FAST,
|
||||
icon: AppstoreAddOutlined,
|
||||
condition: () =>
|
||||
formData.appType === QUICKSTART_ACTION_TYPE.Minecraft ||
|
||||
formData.appType === QUICKSTART_ACTION_TYPE.Bedrock,
|
||||
isCN() &&
|
||||
(formData.appType === QUICKSTART_ACTION_TYPE.Minecraft ||
|
||||
formData.appType === QUICKSTART_ACTION_TYPE.Bedrock),
|
||||
click: () => {
|
||||
router.push({
|
||||
path: "/quickstart/minecraft",
|
||||
|
@ -51,6 +51,14 @@ const getCurrentLang = (): string => {
|
||||
return String(i18n.global.locale).toLowerCase();
|
||||
};
|
||||
|
||||
const isCN = () => {
|
||||
return getCurrentLang() === "zh_cn";
|
||||
};
|
||||
|
||||
const isEN = () => {
|
||||
return getCurrentLang() === "en_us";
|
||||
};
|
||||
|
||||
const $t = (...args: string[]): string => {
|
||||
return (i18n.global.t as Function)(...args);
|
||||
};
|
||||
@ -60,4 +68,4 @@ const t = (...args: string[]): string => {
|
||||
|
||||
(window as any).setLang = setLanguage;
|
||||
|
||||
export { setLanguage, getCurrentLang, $t, t, initI18n };
|
||||
export { setLanguage, getCurrentLang, $t, t, initI18n, isCN, isEN };
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import LeftMenusPanel from "@/components/LeftMenusPanel.vue";
|
||||
import { getCurrentLang, t } from "@/lang/i18n";
|
||||
import { getCurrentLang, isCN, t } from "@/lang/i18n";
|
||||
import type { LayoutCard, Settings } from "@/types";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
@ -175,7 +175,7 @@ onMounted(async () => {
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item>
|
||||
<a-form-item v-if="isCN()">
|
||||
<a-typography-title :level="5">{{ t("TXT_CODE_b2767aa2") }}</a-typography-title>
|
||||
<a-typography-paragraph type="secondary">
|
||||
{{ t("TXT_CODE_b1f833f3") }}
|
||||
|
@ -21,6 +21,7 @@ import {
|
||||
createInstance as createInstanceApi
|
||||
} from "@/services/apis/instance";
|
||||
import { parseForwardAddress } from "@/tools/protocol";
|
||||
import { useCmdAssistantDialog } from "@/components/fc";
|
||||
|
||||
enum UNZIP {
|
||||
ON = 1,
|
||||
@ -94,6 +95,11 @@ const rules: Record<string, Rule[]> = {
|
||||
]
|
||||
};
|
||||
|
||||
const openCmdAssistDialog = async () => {
|
||||
const cmd = await useCmdAssistantDialog();
|
||||
if (cmd) formData.startCommand = cmd;
|
||||
};
|
||||
|
||||
const uFile = ref<File>();
|
||||
|
||||
const beforeUpload: UploadProps["beforeUpload"] = async (file) => {
|
||||
@ -234,6 +240,7 @@ const createInstance = async () => {
|
||||
<a-button
|
||||
type="default"
|
||||
style="height: auto; border-top-left-radius: 0; border-bottom-left-radius: 0"
|
||||
@click="openCmdAssistDialog"
|
||||
>
|
||||
{{ t("TXT_CODE_2728d0d4") }}
|
||||
</a-button>
|
||||
|
@ -5,7 +5,7 @@
|
||||
"TXT_CODE_153f705d": "Remove Card",
|
||||
"TXT_CODE_16d71239": "Dashboard",
|
||||
"TXT_CODE_18cdc17f": "Edit Title",
|
||||
"TXT_CODE_1f246be3": "Minimum Height:",
|
||||
"TXT_CODE_1f246be3": "Min Height:",
|
||||
"TXT_CODE_2c69ab15": "Logout",
|
||||
"TXT_CODE_3efe364e": "Block",
|
||||
"TXT_CODE_46913a7f": "Jesus 123",
|
||||
@ -260,7 +260,7 @@
|
||||
"TXT_CODE_6819de18": "Are you sure you want to disable the API Key?",
|
||||
"TXT_CODE_b1dedda3": "Stop",
|
||||
"TXT_CODE_41406a5f": "Data",
|
||||
"TXT_CODE_d941eb89": "Instance Operation",
|
||||
"TXT_CODE_d941eb89": "Operation",
|
||||
"TXT_CODE_765d34e6": "User",
|
||||
"TXT_CODE_76b2a495": "Other",
|
||||
"TXT_CODE_6e23c48": "General",
|
||||
@ -1675,7 +1675,7 @@
|
||||
"TXT_CODE_463375d2": "About This Page",
|
||||
"TXT_CODE_6b2a9cab": "Upgraded configuration to new version:",
|
||||
"TXT_CODE_fb75aba9": "[Configuration Upgrade] Configuration file parsing error, ignored:",
|
||||
"TXT_CODE_c7b1b8d0": "Program to start",
|
||||
"TXT_CODE_c7b1b8d0": "Program",
|
||||
"TXT_CODE_a2a0e054": "For example: server.exe, app.exe, or use an absolute path, etc.",
|
||||
"TXT_CODE_b9442311": "Additional parameters",
|
||||
"TXT_CODE_2a379a13": "Optional, fill in according to your program, such as: -server -XXX -ZZZ, etc.",
|
||||
@ -1744,5 +1744,6 @@
|
||||
"TXT_CODE_6750d9d3": "Using files shared by others may compromise the panel.",
|
||||
"TXT_CODE_6345aa71": "HTML file:",
|
||||
"TXT_CODE_40a87804": "Upload HTML File",
|
||||
"TXT_CODE_ccb60658": "Authentication"
|
||||
"TXT_CODE_ccb60658": "Authentication",
|
||||
"TXT_CODE_a7e9d4e": "Close"
|
||||
}
|
||||
|
@ -257,7 +257,7 @@
|
||||
"TXT_CODE_6819de18": "你确定要关闭APIKey吗",
|
||||
"TXT_CODE_b1dedda3": "关闭",
|
||||
"TXT_CODE_41406a5f": "数据型卡片",
|
||||
"TXT_CODE_d941eb89": "实例操作型卡片",
|
||||
"TXT_CODE_d941eb89": "操作型卡片",
|
||||
"TXT_CODE_765d34e6": "用户型卡片",
|
||||
"TXT_CODE_76b2a495": "其他",
|
||||
"TXT_CODE_6e23c48": "通用型卡片",
|
||||
@ -1734,5 +1734,6 @@
|
||||
"TXT_CODE_6750d9d3": "使用其他人分享的文件可能会导致面板被入侵。",
|
||||
"TXT_CODE_6345aa71": "HTML 文件:",
|
||||
"TXT_CODE_40a87804": "上传 HTML 文件",
|
||||
"TXT_CODE_ccb60658": "身份验证"
|
||||
"TXT_CODE_ccb60658": "身份验证",
|
||||
"TXT_CODE_a7e9d4e": "关闭此窗口"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user