feat(i18n): replace remaining hardcoded Chinese in frontend addLog calls
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import GraphPanel from '../components/GraphPanel.vue'
|
||||
import Step5Interaction from '../components/Step5Interaction.vue'
|
||||
import { getProject, getGraphData } from '../api/graph'
|
||||
@@ -75,6 +76,7 @@ import LanguageSwitcher from '../components/LanguageSwitcher.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { t } = useI18n()
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
@@ -143,27 +145,27 @@ const toggleMaximize = (target) => {
|
||||
// --- Data Logic ---
|
||||
const loadReportData = async () => {
|
||||
try {
|
||||
addLog(`加载报告数据: ${currentReportId.value}`)
|
||||
|
||||
addLog(t('log.loadReportData', { id: currentReportId.value }))
|
||||
|
||||
// 获取 report 信息以获取 simulation_id
|
||||
const reportRes = await getReport(currentReportId.value)
|
||||
if (reportRes.success && reportRes.data) {
|
||||
const reportData = reportRes.data
|
||||
simulationId.value = reportData.simulation_id
|
||||
|
||||
|
||||
if (simulationId.value) {
|
||||
// 获取 simulation 信息
|
||||
const simRes = await getSimulation(simulationId.value)
|
||||
if (simRes.success && simRes.data) {
|
||||
const simData = simRes.data
|
||||
|
||||
|
||||
// 获取 project 信息
|
||||
if (simData.project_id) {
|
||||
const projRes = await getProject(simData.project_id)
|
||||
if (projRes.success && projRes.data) {
|
||||
projectData.value = projRes.data
|
||||
addLog(`项目加载成功: ${projRes.data.project_id}`)
|
||||
|
||||
addLog(t('log.projectLoadSuccess', { id: projRes.data.project_id }))
|
||||
|
||||
// 获取 graph 数据
|
||||
if (projRes.data.graph_id) {
|
||||
await loadGraph(projRes.data.graph_id)
|
||||
@@ -173,10 +175,10 @@ const loadReportData = async () => {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addLog(`获取报告信息失败: ${reportRes.error || '未知错误'}`)
|
||||
addLog(t('log.getReportInfoFailed', { error: reportRes.error || t('common.unknownError') }))
|
||||
}
|
||||
} catch (err) {
|
||||
addLog(`加载异常: ${err.message}`)
|
||||
addLog(t('log.loadException', { error: err.message }))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,10 +189,10 @@ const loadGraph = async (graphId) => {
|
||||
const res = await getGraphData(graphId)
|
||||
if (res.success) {
|
||||
graphData.value = res.data
|
||||
addLog('图谱数据加载成功')
|
||||
addLog(t('log.graphDataLoadSuccess'))
|
||||
}
|
||||
} catch (err) {
|
||||
addLog(`图谱加载失败: ${err.message}`)
|
||||
addLog(t('log.graphLoadFailed', { error: err.message }))
|
||||
} finally {
|
||||
graphLoading.value = false
|
||||
}
|
||||
@@ -211,7 +213,7 @@ watch(() => route.params.reportId, (newId) => {
|
||||
}, { immediate: true })
|
||||
|
||||
onMounted(() => {
|
||||
addLog('InteractionView 初始化')
|
||||
addLog(t('log.interactionViewInit'))
|
||||
loadReportData()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -164,11 +164,11 @@ const toggleMaximize = (target) => {
|
||||
const handleNextStep = (params = {}) => {
|
||||
if (currentStep.value < 5) {
|
||||
currentStep.value++
|
||||
addLog(`进入 Step ${currentStep.value}: ${stepNames.value[currentStep.value - 1]}`)
|
||||
addLog(t('log.enterStep', { step: currentStep.value, name: stepNames.value[currentStep.value - 1] }))
|
||||
|
||||
// 如果是从 Step 2 进入 Step 3,记录模拟轮数配置
|
||||
if (currentStep.value === 3 && params.maxRounds) {
|
||||
addLog(`自定义模拟轮数: ${params.maxRounds} 轮`)
|
||||
addLog(t('log.customSimRounds', { rounds: params.maxRounds }))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ const handleNextStep = (params = {}) => {
|
||||
const handleGoBack = () => {
|
||||
if (currentStep.value > 1) {
|
||||
currentStep.value--
|
||||
addLog(`返回 Step ${currentStep.value}: ${stepNames.value[currentStep.value - 1]}`)
|
||||
addLog(t('log.returnToStep', { step: currentStep.value, name: stepNames.value[currentStep.value - 1] }))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import GraphPanel from '../components/GraphPanel.vue'
|
||||
import Step4Report from '../components/Step4Report.vue'
|
||||
import { getProject, getGraphData } from '../api/graph'
|
||||
@@ -75,6 +76,7 @@ import LanguageSwitcher from '../components/LanguageSwitcher.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { t } = useI18n()
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
@@ -142,27 +144,27 @@ const toggleMaximize = (target) => {
|
||||
// --- Data Logic ---
|
||||
const loadReportData = async () => {
|
||||
try {
|
||||
addLog(`加载报告数据: ${currentReportId.value}`)
|
||||
|
||||
addLog(t('log.loadReportData', { id: currentReportId.value }))
|
||||
|
||||
// 获取 report 信息以获取 simulation_id
|
||||
const reportRes = await getReport(currentReportId.value)
|
||||
if (reportRes.success && reportRes.data) {
|
||||
const reportData = reportRes.data
|
||||
simulationId.value = reportData.simulation_id
|
||||
|
||||
|
||||
if (simulationId.value) {
|
||||
// 获取 simulation 信息
|
||||
const simRes = await getSimulation(simulationId.value)
|
||||
if (simRes.success && simRes.data) {
|
||||
const simData = simRes.data
|
||||
|
||||
|
||||
// 获取 project 信息
|
||||
if (simData.project_id) {
|
||||
const projRes = await getProject(simData.project_id)
|
||||
if (projRes.success && projRes.data) {
|
||||
projectData.value = projRes.data
|
||||
addLog(`项目加载成功: ${projRes.data.project_id}`)
|
||||
|
||||
addLog(t('log.projectLoadSuccess', { id: projRes.data.project_id }))
|
||||
|
||||
// 获取 graph 数据
|
||||
if (projRes.data.graph_id) {
|
||||
await loadGraph(projRes.data.graph_id)
|
||||
@@ -172,10 +174,10 @@ const loadReportData = async () => {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addLog(`获取报告信息失败: ${reportRes.error || '未知错误'}`)
|
||||
addLog(t('log.getReportInfoFailed', { error: reportRes.error || t('common.unknownError') }))
|
||||
}
|
||||
} catch (err) {
|
||||
addLog(`加载异常: ${err.message}`)
|
||||
addLog(t('log.loadException', { error: err.message }))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,10 +188,10 @@ const loadGraph = async (graphId) => {
|
||||
const res = await getGraphData(graphId)
|
||||
if (res.success) {
|
||||
graphData.value = res.data
|
||||
addLog('图谱数据加载成功')
|
||||
addLog(t('log.graphDataLoadSuccess'))
|
||||
}
|
||||
} catch (err) {
|
||||
addLog(`图谱加载失败: ${err.message}`)
|
||||
addLog(t('log.graphLoadFailed', { error: err.message }))
|
||||
} finally {
|
||||
graphLoading.value = false
|
||||
}
|
||||
@@ -210,7 +212,7 @@ watch(() => route.params.reportId, (newId) => {
|
||||
}, { immediate: true })
|
||||
|
||||
onMounted(() => {
|
||||
addLog('ReportView 初始化')
|
||||
addLog(t('log.reportViewInit'))
|
||||
loadReportData()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user