1
0
Fork 0
mirror of https://github.com/24eme/signaturepdf synced 2026-03-14 13:55:44 +01:00

compress: using %s sprinf syntax to traduction

This commit is contained in:
Vincent LAURENT 2025-06-01 22:36:28 +02:00
commit b1686b4ab7
2 changed files with 5 additions and 6 deletions

View file

@ -11,8 +11,6 @@ async function handleFileChange() {
return;
}
document.querySelector('#uploaded_size').innerText = convertOctet2MegoOctet(fileInput.files[0].size);
const compressBtn = document.getElementById('compressBtn');
const dropdownCompressBtn = document.getElementById('dropdownMenuReference');
@ -44,7 +42,8 @@ document.addEventListener('DOMContentLoaded', function () {
document.querySelector('#compressBtn').classList.remove('btn-primary');
document.querySelector('#compressBtn').classList.add('btn-outline-primary');
document.querySelector('#size_compressed').innerText = convertOctet2MegoOctet(blob.size);
document.querySelector('#uploaded_size').innerText = document.querySelector('#uploaded_size').dataset.templateText.replace("%s", convertOctet2MegoOctet(document.getElementById('input_pdf_upload').files[0].size));
document.querySelector('#size_compressed').innerText = document.querySelector('#size_compressed').dataset.templateText.replace("%s", convertOctet2MegoOctet(blob.size));
document.querySelector('#pourcentage_compressed').innerText = document.querySelector('#pourcentage_compressed').dataset.templateText.replace("%s", 100 - Math.round((blob.size * 100)/ document.getElementById('input_pdf_upload').files[0].size));
document.querySelector('#card_resultat').classList.remove('d-none');

View file

@ -18,7 +18,7 @@
<h1 class="display-5 fw-bold mb-0 mt-3"> <?php echo sprintf(_("%s Compress a PDF"), '<i class="bi bi-chevron-bar-contract"></i>'); ?></h1>
<p class="fs-5 fw-light mb-3 subtitle text-dark text-nowrap mt-2" style="overflow: hidden; text-overflow: ellipsis;"><?php echo _("Reduce the size of a PDF"); ?></p>
<div class="col-md-6 col-lg-5 col-xl-4 col-xxl-3 mx-auto">
<label class="form-label mt-4" for="input_pdf_upload"><?php echo _("Choose a PDF"); ?> <small class="opacity-75" style="cursor: help" title="<?php echo _("The PDF must not exceed "); ?> <?php echo round($maxSize / 1000 / 1000) ?> <?php echo _("Mb"); ?>"><i class="bi bi-info-circle"></i></small></label>
<label class="form-label mt-4" for="input_pdf_upload"><?php echo _("Choose a PDF"); ?> <small class="opacity-75" style="cursor: help" title="<?php echo sprintf(_("The PDF must not exceed %s Mb"), round($maxSize / 1000 / 1000)); ?>"><i class="bi bi-info-circle"></i></small></label>
<input name="input_pdf_upload" id="input_pdf_upload" placeholder="<?php echo _("Choose a PDF"); ?>" class="form-control form-control-lg" type="file" accept=".pdf,application/pdf" onchange="handleFileChange()" />
<p class="mt-2 small fw-light text-dark"><?php echo _("The PDF will be processed by the server without being retained or stored") ?></p>
@ -36,8 +36,8 @@
<div id="error_message" class="alert alert-warning mt-5 d-none"></div>
<div id="card_resultat" class="card text-bg-light shadow mt-5 d-none">
<div class="card-body">
<h6 class="card-title strong mt-2"><i class="bi bi-file-earmark"></i> <span id="uploaded_size"></span> <?php echo _("Mb"); ?> <i class="bi bi-caret-right-fill"></i> <strong><i class="bi bi-file-earmark-zip"></i> <span id="size_compressed"></span> <?php echo _("Mb"); ?></strong></h6>
<h6 id="pourcentage_compressed" class="card-subtitle mt-2 small text-muted" data-template-text="<?php echo _("Compressé à %s %"); ?>"></h6>
<h6 class="card-title strong mt-2"><i class="bi bi-file-earmark"></i> <span id="uploaded_size" data-template-text="<?php echo _("%s Mb"); ?>"></span> <i class="bi bi-caret-right-fill"></i> <strong><i class="bi bi-file-earmark-zip"></i> <span id="size_compressed" data-template-text="<?php echo _("%s Mb"); ?>"></span></strong></h6>
<h6 id="pourcentage_compressed" class="card-subtitle mt-2 small text-muted" data-template-text="<?php echo _("Compressed at %s%"); ?>"></h6>
<input id="input_pdf_compressed" class="form-control form-control-lg d-none" type="file" />
<button type="button" id="downloadBtn" class="btn btn-primary mt-4 mb-2"><i class="bi bi-download"></i> <?php echo _("Download the PDF"); ?></button>
</div>