diff --git a/src/components/SimulationView.vue b/src/components/SimulationView.vue index be3e159..1baeb34 100644 --- a/src/components/SimulationView.vue +++ b/src/components/SimulationView.vue @@ -3,9 +3,11 @@ import { ref, computed } from 'vue'; import { generateRandomGrid, calculateHints } from '@/utils/puzzleUtils'; import { solvePuzzle } from '@/utils/solver'; +import { useI18n } from '@/composables/useI18n'; import { X, Play, Square, RotateCcw } from 'lucide-vue-next'; const emit = defineEmits(['close']); +const { t } = useI18n(); const SIZES = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]; const DENSITIES = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]; @@ -13,12 +15,17 @@ const SAMPLES_PER_POINT = 10; // Reduced for web performance demo const isRunning = ref(false); const progress = ref(0); -const currentStatus = ref('Ready'); +const currentStatus = ref(''); const results = ref([]); const simulationSpeed = ref(1); // 1 = Normal, 2 = Fast (less render updates) let stopRequested = false; +const displayStatus = computed(() => { + if (!currentStatus.value) return t('simulation.status.ready'); + return currentStatus.value; +}); + const startSimulation = async () => { if (isRunning.value) return; isRunning.value = true; @@ -32,12 +39,15 @@ const startSimulation = async () => { for (const size of SIZES) { for (const density of DENSITIES) { if (stopRequested) { - currentStatus.value = 'Stopped'; + currentStatus.value = t('simulation.status.stopped'); isRunning.value = false; return; } - currentStatus.value = `Simulating ${size}x${size} @ ${(density * 100).toFixed(0)}%`; + currentStatus.value = t('simulation.status.simulating', { + size: size, + density: (density * 100).toFixed(0) + }); let totalSolved = 0; @@ -66,7 +76,7 @@ const startSimulation = async () => { } isRunning.value = false; - currentStatus.value = 'Completed'; + currentStatus.value = t('simulation.status.completed'); }; const stopSimulation = () => { @@ -86,7 +96,7 @@ const getRowColor = (solved) => {