From 7463bbe3a6648ec8cbb7ded692809fff46346bb2 Mon Sep 17 00:00:00 2001 From: naiba Date: Sat, 30 Nov 2024 20:14:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=91=BD=E4=BB=A4=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 10 ++++++++++ src/components/install-commands.tsx | 11 +++++------ src/locales/en/translation.json | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0096cd4..650c495 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "cmdk": "^1.0.0", "copy-to-clipboard": "^3.3.3", "i18next": "^24.0.2", + "i18next-browser-languagedetector": "^8.0.0", "jotai-zustand": "^0.6.0", "lucide-react": "^0.454.0", "next-themes": "^0.3.0", @@ -4394,6 +4395,15 @@ } } }, + "node_modules/i18next-browser-languagedetector": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-8.0.0.tgz", + "integrity": "sha512-zhXdJXTTCoG39QsrOCiOabnWj2jecouOqbchu3EfhtSHxIB5Uugnm9JaizenOy39h7ne3+fLikIjeW88+rgszw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", diff --git a/src/components/install-commands.tsx b/src/components/install-commands.tsx index c5dfe1a..a618f1b 100644 --- a/src/components/install-commands.tsx +++ b/src/components/install-commands.tsx @@ -29,13 +29,12 @@ export const InstallCommandsMenu = forwardRef((p if (!copy) { try { setCopy(true); - if (settings) - await copyToClipboard(generateCommand(type, settings) || ''); - - } catch (e) { + if (!settings) throw new Error("Settings is not found."); + await copyToClipboard(generateCommand(type, settings) || ''); + } catch (e: Error | any) { console.error(e); toast(t("Error"), { - description: t("Results.UnExpectedError"), + description: e.message, }) } finally { setTimeout(() => { @@ -64,7 +63,7 @@ export const InstallCommandsMenu = forwardRef((p const generateCommand = (type: number, { agent_secret_key, install_host, listen_port, tls }: ModelConfig) => { if (!install_host) - throw new Error("You have not specify the installed host."); + throw new Error("You have not specify the installed host.") const env = `NZ_SERVER=${install_host}:${listen_port} NZ_TLS=${tls || false} NZ_CLIENT_SECRET=${agent_secret_key}`; diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 868b130..12a3ef6 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -27,7 +27,7 @@ "DDNS": "Dynamic DNS", "NATT": "NAT Traversal", "Group": "Group", - "Profile": "personal information", + "Profile": "Profile", "Settings": "System settings", "Logout": "Log out", "NavigateTo": "Navigate to",