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