Add localization for PDF to BMP and PDF to TIFF conversion alerts and loader messages
This commit is contained in:
@@ -255,11 +255,33 @@
|
||||
},
|
||||
"pdfToBmp": {
|
||||
"name": "PDF zu BMP",
|
||||
"subtitle": "Jede PDF-Seite in ein BMP-Bild konvertieren."
|
||||
"subtitle": "Jede PDF-Seite in ein BMP-Bild konvertieren.",
|
||||
"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 BMPs konvertiert!",
|
||||
"conversionError": "Konvertierung in BMP fehlgeschlagen. Die Datei könnte beschädigt sein."
|
||||
},
|
||||
"loader": {
|
||||
"converting": "Wird in BMP konvertiert..."
|
||||
}
|
||||
},
|
||||
"pdfToTiff": {
|
||||
"name": "PDF zu TIFF",
|
||||
"subtitle": "Jede PDF-Seite in ein TIFF-Bild konvertieren."
|
||||
"subtitle": "Jede PDF-Seite in ein TIFF-Bild konvertieren.",
|
||||
"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 TIFFs konvertiert!",
|
||||
"conversionError": "Konvertierung in TIFF fehlgeschlagen. Die Datei könnte beschädigt sein."
|
||||
},
|
||||
"loader": {
|
||||
"converting": "Wird in TIFF konvertiert..."
|
||||
}
|
||||
},
|
||||
"pdfToGreyscale": {
|
||||
"name": "PDF zu Graustufen",
|
||||
|
||||
@@ -255,11 +255,33 @@
|
||||
},
|
||||
"pdfToBmp": {
|
||||
"name": "PDF to BMP",
|
||||
"subtitle": "Convert each PDF page into a BMP image."
|
||||
"subtitle": "Convert each PDF page into a BMP image.",
|
||||
"alert": {
|
||||
"invalidFile": "Invalid File",
|
||||
"invalidFileExplanation": "Please upload a PDF file.",
|
||||
"noFile": "No File",
|
||||
"noFileExplanation": "Please upload a PDF file first.",
|
||||
"conversionSuccess": "PDF converted to BMPs successfully!",
|
||||
"conversionError": "Failed to convert PDF to BMP. The file might be corrupted."
|
||||
},
|
||||
"loader": {
|
||||
"converting": "Converting to BMP..."
|
||||
}
|
||||
},
|
||||
"pdfToTiff": {
|
||||
"name": "PDF to TIFF",
|
||||
"subtitle": "Convert each PDF page into a TIFF image."
|
||||
"subtitle": "Convert each PDF page into a TIFF image.",
|
||||
"alert": {
|
||||
"invalidFile": "Invalid File",
|
||||
"invalidFileExplanation": "Please upload a PDF file.",
|
||||
"noFile": "No File",
|
||||
"noFileExplanation": "Please upload a PDF file first.",
|
||||
"conversionSuccess": "PDF converted to TIFFs successfully!",
|
||||
"conversionError": "Failed to convert PDF to TIFF. The file might be corrupted."
|
||||
},
|
||||
"loader": {
|
||||
"converting": "Converting to TIFF..."
|
||||
}
|
||||
},
|
||||
"pdfToGreyscale": {
|
||||
"name": "PDF to Greyscale",
|
||||
|
||||
@@ -92,10 +92,13 @@ const resetState = () => {
|
||||
|
||||
async function convert() {
|
||||
if (files.length === 0) {
|
||||
showAlert('No File', 'Please upload a PDF file first.');
|
||||
showAlert(
|
||||
t('tools:pdfToBmp.alert.noFile'),
|
||||
t('tools:pdfToBmp.alert.noFileExplanation')
|
||||
);
|
||||
return;
|
||||
}
|
||||
showLoader('Converting to BMP...');
|
||||
showLoader(t('tools:pdfToBmp.loader.converting'));
|
||||
try {
|
||||
const pdf = await getPDFDocument(await readFileAsArrayBuffer(files[0]))
|
||||
.promise;
|
||||
@@ -119,8 +122,8 @@ async function convert() {
|
||||
}
|
||||
|
||||
showAlert(
|
||||
'Success',
|
||||
'PDF converted to BMPs successfully!',
|
||||
t('common.success'),
|
||||
t('tools:pdfToBmp.alert.conversionSuccess'),
|
||||
'success',
|
||||
() => {
|
||||
resetState();
|
||||
@@ -128,10 +131,7 @@ async function convert() {
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
showAlert(
|
||||
'Error',
|
||||
'Failed to convert PDF to BMP. The file might be corrupted.'
|
||||
);
|
||||
showAlert(t('common.error'), t('tools:pdfToBmp.alert.conversionError'));
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
@@ -175,7 +175,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
);
|
||||
|
||||
if (validFiles.length === 0) {
|
||||
showAlert('Invalid File', 'Please upload a PDF file.');
|
||||
showAlert(
|
||||
t('tools:pdfToBmp.alert.invalidFile'),
|
||||
t('tools:pdfToBmp.alert.invalidFileExplanation')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,10 +92,13 @@ const resetState = () => {
|
||||
|
||||
async function convert() {
|
||||
if (files.length === 0) {
|
||||
showAlert('No File', 'Please upload a PDF file first.');
|
||||
showAlert(
|
||||
t('tools:pdfToTiff.alert.noFile'),
|
||||
t('tools:pdfToTiff.alert.noFileExplanation')
|
||||
);
|
||||
return;
|
||||
}
|
||||
showLoader('Converting to TIFF...');
|
||||
showLoader(t('tools:pdfToTiff.loader.converting'));
|
||||
try {
|
||||
const pdf = await getPDFDocument(await readFileAsArrayBuffer(files[0]))
|
||||
.promise;
|
||||
@@ -122,8 +125,8 @@ async function convert() {
|
||||
}
|
||||
|
||||
showAlert(
|
||||
'Success',
|
||||
'PDF converted to TIFFs successfully!',
|
||||
t('common.success'),
|
||||
t('tools:pdfToTiff.alert.conversionSuccess'),
|
||||
'success',
|
||||
() => {
|
||||
resetState();
|
||||
@@ -131,10 +134,7 @@ async function convert() {
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
showAlert(
|
||||
'Error',
|
||||
'Failed to convert PDF to TIFF. The file might be corrupted.'
|
||||
);
|
||||
showAlert(t('common.error'), t('tools:pdfToTiff.alert.conversionError'));
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
@@ -212,7 +212,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
);
|
||||
|
||||
if (validFiles.length === 0) {
|
||||
showAlert('Invalid File', 'Please upload a PDF file.');
|
||||
showAlert(
|
||||
t('tools:pdfToTiff.alert.invalidFile'),
|
||||
t('tools:pdfToTiff.alert.invalidFileExplanation')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user