Revert "Internalisation"

This commit is contained in:
nelson.li
2025-08-11 20:47:10 +08:00
committed by GitHub
parent 378954e4aa
commit 91f8d4c725
7 changed files with 25 additions and 150 deletions
+8 -14
View File
@@ -2,13 +2,6 @@
import { computed, ref, onUnmounted } from 'vue'
import type { Milestone } from '../models/classes/Milestone'
import { TimelineScale } from '../models/types/TimelineScale'
import { useI18n } from '../composables/useI18n'
const { setLocale, getTranslation } = useI18n()
const t = (key: string): string => {
return getTranslation(key)
}
interface Props {
date: string // 里程碑日期
@@ -485,26 +478,26 @@ const handleMilestoneMouseLeave = () => {
// 格式化日期显示
const formatDisplayDate = (dateStr: string): string => {
if (!dateStr) return t('dateNotSet') //Not Set
if (!dateStr) return '未设置'
try {
const date = new Date(dateStr)
if (isNaN(date.getTime())) return t('dateNotSet')
if (isNaN(date.getTime())) return '未设置'
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
} catch {
return t('dateNotSet')
return '未设置'
}
}
// Tooltip内容 Target date
// Tooltip内容
const tooltipContent = computed(() => {
const milestoneName = props.name || props.milestone?.name || t('milestone')
const milestoneName = props.name || props.milestone?.name || '里程碑'
const targetDate = formatDisplayDate(props.date || props.milestone?.startDate || '')
return `${t('milestone')}${milestoneName} <br> ${t('targetDate')}${targetDate}`
return `里程碑:${milestoneName} - 目标日期${targetDate}`
})
// 组件销毁时清理事件监听器
@@ -688,7 +681,8 @@ const calculateMilestonePositionFromTimelineData = (
top: `${tooltipPosition.y}px`,
}"
>
<div class="tooltip-content" v-html="tooltipContent">
<div class="tooltip-content">
{{ tooltipContent }}
</div>
</div>
</Teleport>