remove OCR language picker from settings code to make it a little easier to read. Added the link to docs on using different languages with OCR and more

This commit is contained in:
EthanHealy01 2025-07-30 14:02:56 +01:00
parent a0e57655db
commit 9b16e2ed75
5 changed files with 56 additions and 26 deletions

View File

@ -833,7 +833,37 @@
}, },
"help": "Please read this documentation on how to use this for other languages and/or use not in docker", "help": "Please read this documentation on how to use this for other languages and/or use not in docker",
"credit": "This service uses qpdf and Tesseract for OCR.", "credit": "This service uses qpdf and Tesseract for OCR.",
"submit": "Process PDF with OCR" "submit": "Process PDF with OCR",
"settings": {
"title": "OCR Configuration",
"ocrMode": {
"label": "OCR Mode",
"auto": "Auto (skip text layers)",
"force": "Force (re-OCR all, replace text)",
"strict": "Strict (abort if text found)"
},
"languages": {
"label": "Languages",
"placeholder": "Select primary language for OCR"
},
"output": {
"label": "Output",
"searchablePdf": "Searchable PDF (sandwich)",
"sandwich": "Sandwich"
},
"additionalOptions": {
"label": "Additional Options",
"placeholder": "Select Options",
"sidecar": "Create sidecar text file",
"deskew": "Deskew pages",
"clean": "Clean input file",
"cleanFinal": "Clean final output"
}
},
"languagePicker": {
"additionalLanguages": "Looking for additional languages?",
"viewSetupGuide": "View setup guide →"
}
}, },
"extractImages": { "extractImages": {
"tags": "picture,photo,save,archive,zip,capture,grab", "tags": "picture,photo,save,archive,zip,capture,grab",

View File

@ -44,7 +44,7 @@
/* Dark theme support */ /* Dark theme support */
[data-mantine-color-scheme="dark"] .languageItem { [data-mantine-color-scheme="dark"] .languageItem {
border-right-color: var(--mantine-color-dark-4); border-right-color: var(--mantine-color-dark-3);
} }
[data-mantine-color-scheme="dark"] .languageItem:nth-child(4n) { [data-mantine-color-scheme="dark"] .languageItem:nth-child(4n) {
@ -52,11 +52,11 @@
} }
[data-mantine-color-scheme="dark"] .languageItem:nth-child(2n) { [data-mantine-color-scheme="dark"] .languageItem:nth-child(2n) {
border-right-color: var(--mantine-color-dark-4); border-right-color: var(--mantine-color-dark-3);
} }
[data-mantine-color-scheme="dark"] .languageItem:nth-child(3n) { [data-mantine-color-scheme="dark"] .languageItem:nth-child(3n) {
border-right-color: var(--mantine-color-dark-4); border-right-color: var(--mantine-color-dark-3);
} }
/* Responsive text visibility */ /* Responsive text visibility */

View File

@ -102,7 +102,7 @@ const LanguageSelector = () => {
styles={{ styles={{
root: { root: {
border: 'none', border: 'none',
color: colorScheme === 'dark' ? theme.colors.gray[3] : theme.colors.gray[7], color: colorScheme === 'dark' ? theme.colors.gray[1] : theme.colors.gray[7],
transition: 'background-color 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)', transition: 'background-color 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)',
'&:hover': { '&:hover': {
backgroundColor: colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1], backgroundColor: colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1],
@ -125,6 +125,7 @@ const LanguageSelector = () => {
padding: '12px', padding: '12px',
borderRadius: '8px', borderRadius: '8px',
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)', boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)',
backgroundColor: colorScheme === 'dark' ? theme.colors.dark[6] : theme.white,
border: colorScheme === 'dark' ? `1px solid ${theme.colors.dark[4]}` : `1px solid ${theme.colors.gray[3]}`, border: colorScheme === 'dark' ? `1px solid ${theme.colors.dark[4]}` : `1px solid ${theme.colors.gray[3]}`,
}} }}
> >
@ -157,9 +158,9 @@ const LanguageSelector = () => {
colorScheme === 'dark' ? theme.colors.blue[8] : theme.colors.blue[1] colorScheme === 'dark' ? theme.colors.blue[8] : theme.colors.blue[1]
) : 'transparent', ) : 'transparent',
color: option.value === i18n.language ? ( color: option.value === i18n.language ? (
colorScheme === 'dark' ? theme.colors.blue[2] : theme.colors.blue[7] colorScheme === 'dark' ? theme.white : theme.colors.blue[9]
) : ( ) : (
colorScheme === 'dark' ? theme.colors.gray[3] : theme.colors.gray[7] colorScheme === 'dark' ? theme.white : theme.colors.gray[7]
), ),
transition: 'all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)', transition: 'all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)',
'&:hover': { '&:hover': {

View File

@ -200,7 +200,7 @@ const LanguagePicker: React.FC<LanguagePickerProps> = ({
fontSize: '12px' fontSize: '12px'
}}> }}>
<Text size="xs" c="dimmed" mb={4}> <Text size="xs" c="dimmed" mb={4}>
Looking for additional languages? {t('ocr.languagePicker.additionalLanguages', 'Looking for additional languages?')}
</Text> </Text>
<Text <Text
size="xs" size="xs"
@ -208,7 +208,7 @@ const LanguagePicker: React.FC<LanguagePickerProps> = ({
style={{ textDecoration: 'underline', cursor: 'pointer' }} style={{ textDecoration: 'underline', cursor: 'pointer' }}
onClick={() => window.open('https://docs.stirlingpdf.com/Advanced%20Configuration/OCR', '_blank')} onClick={() => window.open('https://docs.stirlingpdf.com/Advanced%20Configuration/OCR', '_blank')}
> >
View setup guide {t('ocr.languagePicker.viewSetupGuide', 'View setup guide →')}
</Text> </Text>
</Box> </Box>
</Stack> </Stack>

View File

@ -25,24 +25,24 @@ const OCRSettings: React.FC<OCRSettingsProps> = ({
// Define the additional options available // Define the additional options available
const additionalOptionsData = [ const additionalOptionsData = [
{ value: 'sidecar', label: 'Create sidecar text file' }, { value: 'sidecar', label: t('ocr.settings.additionalOptions.sidecar', 'Create sidecar text file') },
{ value: 'deskew', label: 'Deskew pages' }, { value: 'deskew', label: t('ocr.settings.additionalOptions.deskew', 'Deskew pages') },
{ value: 'clean', label: 'Clean input file' }, { value: 'clean', label: t('ocr.settings.additionalOptions.clean', 'Clean input file') },
{ value: 'cleanFinal', label: 'Clean final output' }, { value: 'cleanFinal', label: t('ocr.settings.additionalOptions.cleanFinal', 'Clean final output') },
]; ];
return ( return (
<Stack gap="md"> <Stack gap="md">
<Text size="sm" fw={500}>OCR Configuration</Text> <Text size="sm" fw={500}>{t('ocr.settings.title', 'OCR Configuration')}</Text>
<Select <Select
label="OCR Mode" label={t('ocr.settings.ocrMode.label', 'OCR Mode')}
value={parameters.ocrType} value={parameters.ocrType}
onChange={(value) => onParameterChange('ocrType', value || 'skip-text')} onChange={(value) => onParameterChange('ocrType', value || 'skip-text')}
data={[ data={[
{ value: 'skip-text', label: 'Auto (skip text layers)' }, { value: 'skip-text', label: t('ocr.settings.ocrMode.auto', 'Auto (skip text layers)') },
{ value: 'force-ocr', label: 'Force (re-OCR all, replace text)' }, { value: 'force-ocr', label: t('ocr.settings.ocrMode.force', 'Force (re-OCR all, replace text)') },
{ value: 'Normal', label: 'Strict (abort if text found)' }, { value: 'Normal', label: t('ocr.settings.ocrMode.strict', 'Strict (abort if text found)') },
]} ]}
disabled={disabled} disabled={disabled}
/> />
@ -52,20 +52,20 @@ const OCRSettings: React.FC<OCRSettingsProps> = ({
<LanguagePicker <LanguagePicker
value={parameters.languages[0] || ''} value={parameters.languages[0] || ''}
onChange={(value) => onParameterChange('languages', [value])} onChange={(value) => onParameterChange('languages', [value])}
placeholder="Select primary language for OCR" placeholder={t('ocr.settings.languages.placeholder', 'Select primary language for OCR')}
disabled={disabled} disabled={disabled}
label="Languages" label={t('ocr.settings.languages.label', 'Languages')}
/> />
<Divider /> <Divider />
<Select <Select
label="Output" label={t('ocr.settings.output.label', 'Output')}
value={parameters.ocrRenderType} value={parameters.ocrRenderType}
onChange={(value) => onParameterChange('ocrRenderType', value || 'hocr')} onChange={(value) => onParameterChange('ocrRenderType', value || 'hocr')}
data={[ data={[
{ value: 'hocr', label: 'Searchable PDF (sandwich)' }, { value: 'hocr', label: t('ocr.settings.output.searchablePdf', 'Searchable PDF (sandwich)') },
{ value: 'sandwich', label: 'Sandwich' }, { value: 'sandwich', label: t('ocr.settings.output.sandwich', 'Sandwich') },
]} ]}
disabled={disabled} disabled={disabled}
/> />
@ -73,15 +73,14 @@ const OCRSettings: React.FC<OCRSettingsProps> = ({
<Divider /> <Divider />
<MultiSelect <MultiSelect
label="Additional Options" label={t('ocr.settings.additionalOptions.label', 'Additional Options')}
placeholder="Select Options" placeholder={t('ocr.settings.additionalOptions.placeholder', 'Select Options')}
value={parameters.additionalOptions} value={parameters.additionalOptions}
onChange={(value) => onParameterChange('additionalOptions', value)} onChange={(value) => onParameterChange('additionalOptions', value)}
data={additionalOptionsData} data={additionalOptionsData}
disabled={disabled} disabled={disabled}
clearable clearable
comboboxProps={{ position: 'top', middlewares: { flip: false, shift: false } }} comboboxProps={{ position: 'top', middlewares: { flip: false, shift: false } }}
/> />
</Stack> </Stack>
); );