feat: 完成多个组件的国际化支持与文本替换

- 更新 AccountForm.vue 中的占位符文本为 i18n 语言包中的键
- 修改 ConfirmModal.vue 中的确认和取消按钮文本为 i18n 语言包中的键
- 更新 CustomDropdown.vue 中的占位符文本为 i18n 语言包中的键
- 修改 app.js 中的应用标题为英文版本
- 更新 router/index.js 中的日志输出为英文
- 在 accounts.js 和 apiKeys.js 中的错误处理信息中引入 i18n 键以提升多语言一致性
- 更新 dashboard.js 中的系统状态和错误日志为 i18n 键
- 在 DashboardView.vue 中的多个文本替换为 i18n 语言包中的键
This commit is contained in:
Wangnov
2025-09-11 18:03:54 +08:00
parent 22e27738aa
commit e36bacfd6b
11 changed files with 59 additions and 40 deletions

View File

@@ -25,13 +25,13 @@
class="flex-1 rounded-xl bg-gray-100 px-4 py-2.5 font-medium text-gray-700 transition-colors hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600"
@click="$emit('cancel')"
>
{{ cancelText }}
{{ cancelLabel }}
</button>
<button
class="flex-1 rounded-xl bg-gradient-to-r from-yellow-500 to-orange-500 px-4 py-2.5 font-medium text-white shadow-sm transition-colors hover:from-yellow-600 hover:to-orange-600"
@click="$emit('confirm')"
>
{{ confirmText }}
{{ confirmLabel }}
</button>
</div>
</div>
@@ -40,11 +40,12 @@
</template>
<script setup>
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
defineProps({
const props = defineProps({
show: {
type: Boolean,
required: true
@@ -59,14 +60,17 @@ defineProps({
},
confirmText: {
type: String,
default: () => t('common.confirmModal.continue')
default: ''
},
cancelText: {
type: String,
default: () => t('common.confirmModal.cancel')
default: ''
}
})
const confirmLabel = computed(() => props.confirmText || t('common.confirmModal.continue'))
const cancelLabel = computed(() => props.cancelText || t('common.confirmModal.cancel'))
defineEmits(['confirm', 'cancel'])
</script>

View File

@@ -11,7 +11,7 @@
<span
class="select-none whitespace-nowrap text-sm font-medium text-gray-700 dark:text-gray-200"
>
{{ selectedLabel || placeholder }}
{{ selectedLabel || placeholderText }}
</span>
<i
:class="[
@@ -80,7 +80,7 @@ const props = defineProps({
},
placeholder: {
type: String,
default: () => t('common.customDropdown.placeholder')
default: ''
},
icon: {
type: String,
@@ -99,6 +99,8 @@ const triggerRef = ref(null)
const dropdownRef = ref(null)
const dropdownStyle = ref({})
const placeholderText = computed(() => props.placeholder || t('common.customDropdown.placeholder'))
const selectedLabel = computed(() => {
const selected = props.options.find((opt) => opt.value === props.modelValue)
return selected ? selected.label : ''