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": {
|
"pdfToBmp": {
|
||||||
"name": "PDF zu BMP",
|
"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": {
|
"pdfToTiff": {
|
||||||
"name": "PDF zu TIFF",
|
"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": {
|
"pdfToGreyscale": {
|
||||||
"name": "PDF zu Graustufen",
|
"name": "PDF zu Graustufen",
|
||||||
|
|||||||
@@ -255,11 +255,33 @@
|
|||||||
},
|
},
|
||||||
"pdfToBmp": {
|
"pdfToBmp": {
|
||||||
"name": "PDF to BMP",
|
"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": {
|
"pdfToTiff": {
|
||||||
"name": "PDF to TIFF",
|
"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": {
|
"pdfToGreyscale": {
|
||||||
"name": "PDF to Greyscale",
|
"name": "PDF to Greyscale",
|
||||||
|
|||||||
@@ -92,10 +92,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:pdfToBmp.alert.noFile'),
|
||||||
|
t('tools:pdfToBmp.alert.noFileExplanation')
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showLoader('Converting to BMP...');
|
showLoader(t('tools:pdfToBmp.loader.converting'));
|
||||||
try {
|
try {
|
||||||
const pdf = await getPDFDocument(await readFileAsArrayBuffer(files[0]))
|
const pdf = await getPDFDocument(await readFileAsArrayBuffer(files[0]))
|
||||||
.promise;
|
.promise;
|
||||||
@@ -119,8 +122,8 @@ async function convert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showAlert(
|
showAlert(
|
||||||
'Success',
|
t('common.success'),
|
||||||
'PDF converted to BMPs successfully!',
|
t('tools:pdfToBmp.alert.conversionSuccess'),
|
||||||
'success',
|
'success',
|
||||||
() => {
|
() => {
|
||||||
resetState();
|
resetState();
|
||||||
@@ -128,10 +131,7 @@ async function convert() {
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
showAlert(
|
showAlert(t('common.error'), t('tools:pdfToBmp.alert.conversionError'));
|
||||||
'Error',
|
|
||||||
'Failed to convert PDF to BMP. The file might be corrupted.'
|
|
||||||
);
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (validFiles.length === 0) {
|
if (validFiles.length === 0) {
|
||||||
showAlert('Invalid File', 'Please upload a PDF file.');
|
showAlert(
|
||||||
|
t('tools:pdfToBmp.alert.invalidFile'),
|
||||||
|
t('tools:pdfToBmp.alert.invalidFileExplanation')
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,10 +92,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:pdfToTiff.alert.noFile'),
|
||||||
|
t('tools:pdfToTiff.alert.noFileExplanation')
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showLoader('Converting to TIFF...');
|
showLoader(t('tools:pdfToTiff.loader.converting'));
|
||||||
try {
|
try {
|
||||||
const pdf = await getPDFDocument(await readFileAsArrayBuffer(files[0]))
|
const pdf = await getPDFDocument(await readFileAsArrayBuffer(files[0]))
|
||||||
.promise;
|
.promise;
|
||||||
@@ -122,8 +125,8 @@ async function convert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showAlert(
|
showAlert(
|
||||||
'Success',
|
t('common.success'),
|
||||||
'PDF converted to TIFFs successfully!',
|
t('tools:pdfToTiff.alert.conversionSuccess'),
|
||||||
'success',
|
'success',
|
||||||
() => {
|
() => {
|
||||||
resetState();
|
resetState();
|
||||||
@@ -131,10 +134,7 @@ async function convert() {
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
showAlert(
|
showAlert(t('common.error'), t('tools:pdfToTiff.alert.conversionError'));
|
||||||
'Error',
|
|
||||||
'Failed to convert PDF to TIFF. The file might be corrupted.'
|
|
||||||
);
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (validFiles.length === 0) {
|
if (validFiles.length === 0) {
|
||||||
showAlert('Invalid File', 'Please upload a PDF file.');
|
showAlert(
|
||||||
|
t('tools:pdfToTiff.alert.invalidFile'),
|
||||||
|
t('tools:pdfToTiff.alert.invalidFileExplanation')
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user