feat(settings): add Slovak language support for spell check (#11664)

* refactor(settings): move spell check languages to constants and add type

Add Slovak language option and define SpellCheckOption type for better type safety

* fix(settings): disable spell check selector on Mac platforms

The spell check selector should not be shown on Mac platforms as it's not supported. This change adds a platform check to hide the selector when running on macOS.
This commit is contained in:
Phantom 2025-12-04 23:55:33 +08:00 committed by GitHub
parent 86a16f5762
commit cd699825ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@ import { InfoCircleOutlined } from '@ant-design/icons'
import { HStack } from '@renderer/components/Layout'
import Selector from '@renderer/components/Selector'
import { InfoTooltip } from '@renderer/components/TooltipIcons'
import { isMac } from '@renderer/config/constant'
import { useTheme } from '@renderer/context/ThemeProvider'
import { useEnableDeveloperMode, useSettings } from '@renderer/hooks/useSettings'
import { useTimer } from '@renderer/hooks/useTimer'
@ -31,6 +32,23 @@ import { useSelector } from 'react-redux'
import { SettingContainer, SettingDivider, SettingGroup, SettingRow, SettingRowTitle, SettingTitle } from '.'
type SpellCheckOption = { readonly value: string; readonly label: string; readonly flag: string }
// Define available spell check languages with display names (only commonly supported languages)
const spellCheckLanguageOptions: readonly SpellCheckOption[] = [
{ value: 'en-US', label: 'English (US)', flag: '🇺🇸' },
{ value: 'es', label: 'Español', flag: '🇪🇸' },
{ value: 'fr', label: 'Français', flag: '🇫🇷' },
{ value: 'de', label: 'Deutsch', flag: '🇩🇪' },
{ value: 'it', label: 'Italiano', flag: '🇮🇹' },
{ value: 'pt', label: 'Português', flag: '🇵🇹' },
{ value: 'ru', label: 'Русский', flag: '🇷🇺' },
{ value: 'nl', label: 'Nederlands', flag: '🇳🇱' },
{ value: 'pl', label: 'Polski', flag: '🇵🇱' },
{ value: 'sk', label: 'Slovenčina', flag: '🇸🇰' },
{ value: 'el', label: 'Ελληνικά', flag: '🇬🇷' }
]
const GeneralSettings: FC = () => {
const {
language,
@ -140,20 +158,6 @@ const GeneralSettings: FC = () => {
dispatch(setNotificationSettings({ ...notificationSettings, [type]: value }))
}
// Define available spell check languages with display names (only commonly supported languages)
const spellCheckLanguageOptions = [
{ value: 'en-US', label: 'English (US)', flag: '🇺🇸' },
{ value: 'es', label: 'Español', flag: '🇪🇸' },
{ value: 'fr', label: 'Français', flag: '🇫🇷' },
{ value: 'de', label: 'Deutsch', flag: '🇩🇪' },
{ value: 'it', label: 'Italiano', flag: '🇮🇹' },
{ value: 'pt', label: 'Português', flag: '🇵🇹' },
{ value: 'ru', label: 'Русский', flag: '🇷🇺' },
{ value: 'nl', label: 'Nederlands', flag: '🇳🇱' },
{ value: 'pl', label: 'Polski', flag: '🇵🇱' },
{ value: 'el', label: 'Ελληνικά', flag: '🇬🇷' }
]
const handleSpellCheckLanguagesChange = (selectedLanguages: string[]) => {
dispatch(setSpellCheckLanguages(selectedLanguages))
window.api.setSpellCheckLanguages(selectedLanguages)
@ -257,7 +261,7 @@ const GeneralSettings: FC = () => {
<SettingRow>
<HStack justifyContent="space-between" alignItems="center" style={{ flex: 1, marginRight: 16 }}>
<SettingRowTitle>{t('settings.general.spell_check.label')}</SettingRowTitle>
{enableSpellCheck && (
{enableSpellCheck && !isMac && (
<Selector<string>
size={14}
multiple