feat(ai): localize AI features
This commit is contained in:
@@ -6,6 +6,7 @@ import { Label } from '@/components/ui/label'
|
||||
import { Loader2, Check, X } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { toast } from 'sonner'
|
||||
import { useLanguage } from '@/lib/i18n'
|
||||
|
||||
interface SettingToggleProps {
|
||||
label: string
|
||||
@@ -22,6 +23,7 @@ export function SettingToggle({
|
||||
onChange,
|
||||
disabled
|
||||
}: SettingToggleProps) {
|
||||
const { t } = useLanguage()
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [error, setError] = useState(false)
|
||||
|
||||
@@ -31,15 +33,11 @@ export function SettingToggle({
|
||||
|
||||
try {
|
||||
await onChange(newChecked)
|
||||
toast.success('Setting saved', {
|
||||
description: `${label} has been ${newChecked ? 'enabled' : 'disabled'}`
|
||||
})
|
||||
toast.success(t('toast.saved'))
|
||||
} catch (err) {
|
||||
console.error('Error updating setting:', err)
|
||||
setError(true)
|
||||
toast.error('Failed to save setting', {
|
||||
description: 'Please try again'
|
||||
})
|
||||
toast.error(t('toast.saveFailed'))
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user