Add localization for PDF to JPG conversion alerts and loader messages
This commit is contained in:
@@ -206,7 +206,18 @@
|
|||||||
"name": "PDF zu JPG",
|
"name": "PDF zu JPG",
|
||||||
"subtitle": "Jede PDF-Seite in ein JPG-Bild konvertieren.",
|
"subtitle": "Jede PDF-Seite in ein JPG-Bild konvertieren.",
|
||||||
"imageQuality": "Bildqualität",
|
"imageQuality": "Bildqualität",
|
||||||
"imageQualityExplanation": "Höhere Qualität = größere Dateigröße"
|
"imageQualityExplanation": "Höhere Qualität = größere Dateigröße",
|
||||||
|
"alert": {
|
||||||
|
"invalidFile": "Ungültige Datei",
|
||||||
|
"invalidFileExplanation": "Bitte wähle eine PDF Datei aus.",
|
||||||
|
"noFile": "Keine Datei",
|
||||||
|
"noFileExplanation": "Bitte lade zuerst eine PDF-Datei hoch.",
|
||||||
|
"conversionSuccess": "PDF erfolgreich in JPGs konvertiert!",
|
||||||
|
"conversionError": "Konvertierung in JPG fehlgeschlagen. Die Datei könnte beschädigt sein."
|
||||||
|
},
|
||||||
|
"loader": {
|
||||||
|
"converting": "Wird in JPG konvertiert..."
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"pdfToPng": {
|
"pdfToPng": {
|
||||||
"name": "PDF zu PNG",
|
"name": "PDF zu PNG",
|
||||||
|
|||||||
@@ -206,7 +206,18 @@
|
|||||||
"name": "PDF to JPG",
|
"name": "PDF to JPG",
|
||||||
"subtitle": "Convert each PDF page into a JPG image.",
|
"subtitle": "Convert each PDF page into a JPG image.",
|
||||||
"imageQuality": "Image Quality",
|
"imageQuality": "Image Quality",
|
||||||
"imageQualityExplanation": "Higher quality = larger file size"
|
"imageQualityExplanation": "Higher quality = larger file size",
|
||||||
|
"alert": {
|
||||||
|
"invalidFile": "Invalid File",
|
||||||
|
"invalidFileExplanation": "Please upload a PDF file.",
|
||||||
|
"noFile": "No File",
|
||||||
|
"noFileExplanation": "Please upload a PDF file first.",
|
||||||
|
"conversionSuccess": "PDF converted to JPGs successfully!",
|
||||||
|
"conversionError": "Failed to convert PDF to JPG. The file might be corrupted."
|
||||||
|
},
|
||||||
|
"loader": {
|
||||||
|
"converting": "Converting to JPG..."
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"pdfToPng": {
|
"pdfToPng": {
|
||||||
"name": "PDF to PNG",
|
"name": "PDF to PNG",
|
||||||
|
|||||||
@@ -97,10 +97,13 @@ const resetState = () => {
|
|||||||
|
|
||||||
async function convert() {
|
async function convert() {
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
showAlert('No File', 'Please upload a PDF file first.');
|
showAlert(
|
||||||
|
t('tools:pdfToJpg.alert.noFile'),
|
||||||
|
t('tools:pdfToJpg.alert.noFileExplanation')
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showLoader('Converting to JPG...');
|
showLoader(t('tools:pdfToJpg.loader.converting'));
|
||||||
try {
|
try {
|
||||||
const pdf = await getPDFDocument(await readFileAsArrayBuffer(files[0]))
|
const pdf = await getPDFDocument(await readFileAsArrayBuffer(files[0]))
|
||||||
.promise;
|
.promise;
|
||||||
@@ -129,8 +132,8 @@ async function convert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showAlert(
|
showAlert(
|
||||||
'Success',
|
t('common.success'),
|
||||||
'PDF converted to JPGs successfully!',
|
t('tools:pdfToJpg.alert.conversionSuccess'),
|
||||||
'success',
|
'success',
|
||||||
() => {
|
() => {
|
||||||
resetState();
|
resetState();
|
||||||
@@ -138,10 +141,7 @@ async function convert() {
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
showAlert(
|
showAlert(t('common.error'), t('tools:pdfToJpg.alert.conversionError'));
|
||||||
'Error',
|
|
||||||
'Failed to convert PDF to JPG. The file might be corrupted.'
|
|
||||||
);
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (validFiles.length === 0) {
|
if (validFiles.length === 0) {
|
||||||
showAlert('Invalid File', 'Please upload a PDF file.');
|
showAlert(
|
||||||
|
t('tools:pdfToJpg.alert.invalidFile'),
|
||||||
|
t('tools:pdfToJpg.alert.invalidFileExplanation')
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user