feat: add i18n to status bar
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
// src/renderer/src/components/StatusBar.vue
|
||||
// src/components/StatusBar.vue
|
||||
import { computed } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
import DbSelector from './DbSelector.vue'
|
||||
|
||||
const connStore = useConnectionStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
const statusText = computed(() => {
|
||||
if (connStore.connecting) return 'Connecting...'
|
||||
if (connStore.error) return `Error: ${connStore.error}`
|
||||
if (connStore.connecting) return t('status.connecting')
|
||||
if (connStore.error) return t('status.error', { error: connStore.error })
|
||||
if (connStore.activeConnection) {
|
||||
return `${connStore.activeConnection.host}:${connStore.activeConnection.port}`
|
||||
}
|
||||
return 'No connection'
|
||||
return t('status.noConnection')
|
||||
})
|
||||
|
||||
const statusClass = computed(() => {
|
||||
|
||||
@@ -123,6 +123,9 @@ export default {
|
||||
database: 'Database',
|
||||
keys: 'Keys',
|
||||
refresh: 'Refresh',
|
||||
connecting: 'Connecting...',
|
||||
error: 'Error: {error}',
|
||||
noConnection: 'No connection',
|
||||
},
|
||||
db: {
|
||||
label: 'DB',
|
||||
|
||||
@@ -123,6 +123,9 @@ export default {
|
||||
database: '数据库',
|
||||
keys: '键数',
|
||||
refresh: '刷新',
|
||||
connecting: '连接中...',
|
||||
error: '错误: {error}',
|
||||
noConnection: '无连接',
|
||||
},
|
||||
db: {
|
||||
label: '数据库',
|
||||
|
||||
Reference in New Issue
Block a user