feat(ocr): add PREPROCESSING_PAGE progress translation and i18n strings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -526,6 +526,7 @@
|
|||||||
"ocr_status_creating_blocks": "{count} Textblöcke erkannt — erstelle Transkription…",
|
"ocr_status_creating_blocks": "{count} Textblöcke erkannt — erstelle Transkription…",
|
||||||
"ocr_status_done_blocks": "{count} Blöcke erstellt",
|
"ocr_status_done_blocks": "{count} Blöcke erstellt",
|
||||||
"ocr_status_analyzing_page": "Seite {current} von {total} wird analysiert…",
|
"ocr_status_analyzing_page": "Seite {current} von {total} wird analysiert…",
|
||||||
|
"ocr_status_preprocessing_page": "Seite {current} von {total} wird aufbereitet…",
|
||||||
"ocr_status_done_skipped": "{count} Blöcke erstellt, {skipped} Seite(n) übersprungen",
|
"ocr_status_done_skipped": "{count} Blöcke erstellt, {skipped} Seite(n) übersprungen",
|
||||||
"ocr_status_error": "OCR fehlgeschlagen",
|
"ocr_status_error": "OCR fehlgeschlagen",
|
||||||
"ocr_trigger_no_annotations": "Zeichnen Sie zuerst Bereiche auf dem Dokument ein.",
|
"ocr_trigger_no_annotations": "Zeichnen Sie zuerst Bereiche auf dem Dokument ein.",
|
||||||
|
|||||||
@@ -526,6 +526,7 @@
|
|||||||
"ocr_status_creating_blocks": "{count} text blocks detected — creating transcription…",
|
"ocr_status_creating_blocks": "{count} text blocks detected — creating transcription…",
|
||||||
"ocr_status_done_blocks": "{count} blocks created",
|
"ocr_status_done_blocks": "{count} blocks created",
|
||||||
"ocr_status_analyzing_page": "Analyzing page {current} of {total}…",
|
"ocr_status_analyzing_page": "Analyzing page {current} of {total}…",
|
||||||
|
"ocr_status_preprocessing_page": "Preparing page {current} of {total}…",
|
||||||
"ocr_status_done_skipped": "{count} blocks created, {skipped} page(s) skipped",
|
"ocr_status_done_skipped": "{count} blocks created, {skipped} page(s) skipped",
|
||||||
"ocr_status_error": "OCR failed",
|
"ocr_status_error": "OCR failed",
|
||||||
"ocr_trigger_no_annotations": "Draw regions on the document first.",
|
"ocr_trigger_no_annotations": "Draw regions on the document first.",
|
||||||
|
|||||||
@@ -526,6 +526,7 @@
|
|||||||
"ocr_status_creating_blocks": "{count} bloques de texto detectados — creando transcripción…",
|
"ocr_status_creating_blocks": "{count} bloques de texto detectados — creando transcripción…",
|
||||||
"ocr_status_done_blocks": "{count} bloques creados",
|
"ocr_status_done_blocks": "{count} bloques creados",
|
||||||
"ocr_status_analyzing_page": "Analizando página {current} de {total}…",
|
"ocr_status_analyzing_page": "Analizando página {current} de {total}…",
|
||||||
|
"ocr_status_preprocessing_page": "Preparando página {current} de {total}…",
|
||||||
"ocr_status_done_skipped": "{count} bloques creados, {skipped} página(s) omitida(s)",
|
"ocr_status_done_skipped": "{count} bloques creados, {skipped} página(s) omitida(s)",
|
||||||
"ocr_status_error": "OCR fallido",
|
"ocr_status_error": "OCR fallido",
|
||||||
"ocr_trigger_no_annotations": "Dibuje regiones en el documento primero.",
|
"ocr_trigger_no_annotations": "Dibuje regiones en el documento primero.",
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ vi.mock('$lib/paraglide/messages.js', () => ({
|
|||||||
`${count} Blöcke erstellt, ${skipped} Seite(n) übersprungen`,
|
`${count} Blöcke erstellt, ${skipped} Seite(n) übersprungen`,
|
||||||
ocr_status_analyzing_page: ({ current, total }: { current: string; total: string }) =>
|
ocr_status_analyzing_page: ({ current, total }: { current: string; total: string }) =>
|
||||||
`Seite ${current} von ${total} wird analysiert…`,
|
`Seite ${current} von ${total} wird analysiert…`,
|
||||||
|
ocr_status_preprocessing_page: ({ current, total }: { current: string; total: string }) =>
|
||||||
|
`Seite ${current} von ${total} wird aufbereitet…`,
|
||||||
ocr_status_error: () => 'OCR fehlgeschlagen'
|
ocr_status_error: () => 'OCR fehlgeschlagen'
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@@ -68,6 +70,13 @@ describe('translateOcrProgress', () => {
|
|||||||
expect(result.totalPages).toBe(5);
|
expect(result.totalPages).toBe(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('translates PREPROCESSING_PAGE with current and total', () => {
|
||||||
|
const result = translateOcrProgress('PREPROCESSING_PAGE:3:10');
|
||||||
|
expect(result.message).toBe('Seite 3 von 10 wird aufbereitet…');
|
||||||
|
expect(result.currentPage).toBe(3);
|
||||||
|
expect(result.totalPages).toBe(10);
|
||||||
|
});
|
||||||
|
|
||||||
it('translates ERROR', () => {
|
it('translates ERROR', () => {
|
||||||
expect(translateOcrProgress('ERROR').message).toBe('OCR fehlgeschlagen');
|
expect(translateOcrProgress('ERROR').message).toBe('OCR fehlgeschlagen');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -48,6 +48,18 @@ export function translateOcrProgress(code: string): OcrProgressResult {
|
|||||||
totalPages: total
|
totalPages: total
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
case 'PREPROCESSING_PAGE': {
|
||||||
|
const current = parseInt(parts[1] ?? '0', 10);
|
||||||
|
const total = parseInt(parts[2] ?? '0', 10);
|
||||||
|
return {
|
||||||
|
message: m.ocr_status_preprocessing_page({
|
||||||
|
current: String(current),
|
||||||
|
total: String(total)
|
||||||
|
}),
|
||||||
|
currentPage: current,
|
||||||
|
totalPages: total
|
||||||
|
};
|
||||||
|
}
|
||||||
case 'ERROR':
|
case 'ERROR':
|
||||||
return { message: m.ocr_status_error() };
|
return { message: m.ocr_status_error() };
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user