refactor: use vue-i18n for toggle option labels

- Add 'yes', 'on', 'off' keys to locales/en/main.json
- Replace hardcoded strings in WidgetSelectToggle with t() function
This commit is contained in:
Johnpaul
2025-11-27 04:21:26 +01:00
parent e092986cfd
commit 1e384c6735
2 changed files with 8 additions and 4 deletions

View File

@@ -95,6 +95,9 @@
"save": "Save",
"saving": "Saving",
"no": "No",
"yes": "Yes",
"on": "On",
"off": "Off",
"cancel": "Cancel",
"close": "Close",
"pressKeysForNewBinding": "Press keys for new binding",

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { computed } from 'vue'
import { t } from '@/i18n'
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
import { cn } from '@/utils/tailwindUtil'
import {
@@ -48,15 +49,15 @@ const options = computed<ToggleOption[]>(() => {
// Default options for boolean widgets
if (typeof modelValue.value === 'boolean') {
return [
{ label: 'On', value: true },
{ label: 'Off', value: false }
{ label: t('g.on', 'On'), value: true },
{ label: t('g.off', 'Off'), value: false }
]
}
// Fallback default options
return [
{ label: 'Yes', value: true },
{ label: 'No', value: false }
{ label: t('g.yes', 'Yes'), value: true },
{ label: t('g.no', 'No'), value: false }
]
})