From 7e31034e244e107533f2a09925dd13a76a8e4145 Mon Sep 17 00:00:00 2001
From: Zephyruso <176294927+Zephyruso@users.noreply.github.com>
Date: Mon, 9 Dec 2024 10:16:57 +0800
Subject: [PATCH] fix: respect the system's language settings
---
src/components/connections/ConnectionCard.tsx | 10 +++++++++-
src/store/settings.ts | 7 ++++++-
src/views/ConnectionsPage.vue | 2 +-
src/views/SetupPage.vue | 2 +-
tailwind.config.ts | 9 ++-------
5 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/components/connections/ConnectionCard.tsx b/src/components/connections/ConnectionCard.tsx
index b5128928..62979885 100644
--- a/src/components/connections/ConnectionCard.tsx
+++ b/src/components/connections/ConnectionCard.tsx
@@ -15,6 +15,7 @@ import {
InformationCircleIcon,
XMarkIcon,
} from '@heroicons/vue/24/outline'
+import { first, last } from 'lodash'
import { twMerge } from 'tailwind-merge'
import { defineComponent } from 'vue'
@@ -71,9 +72,16 @@ export default defineComponent<{
)
+
+ const connChians = props.conn.chains
+ const fisrtChain = first(connChians)
+ const lastChain = last(connChians)
const chians = (
- {[...props.conn.chains].reverse().join('->')}
+ {[...connChians].reverse().join('->')}
+
+ {connChians.length > 1 ? [lastChain, fisrtChain].join(' =>> ') : fisrtChain}
+
)
const rule = {props.conn.rule}
diff --git a/src/store/settings.ts b/src/store/settings.ts
index 4942bf21..8001e813 100644
--- a/src/store/settings.ts
+++ b/src/store/settings.ts
@@ -9,7 +9,12 @@ import { useStorage } from '@vueuse/core'
// global
export const theme = useStorage('config/theme', 'default')
-export const language = useStorage('config/language', LANG.EN_US)
+export const language = useStorage(
+ 'config/language',
+ Object.values(LANG).includes(navigator.language as LANG)
+ ? (navigator.language as LANG)
+ : LANG.EN_US,
+)
export const isSiderbarCollapsed = useStorage('config/is-sidebar-collapsed', true)
export const font = useStorage('config/font', FONTS.MI_SANS)
diff --git a/src/views/ConnectionsPage.vue b/src/views/ConnectionsPage.vue
index 6eaf6731..429bd74a 100644
--- a/src/views/ConnectionsPage.vue
+++ b/src/views/ConnectionsPage.vue
@@ -6,7 +6,7 @@
{{ $t('noContent') }}
-