Merge pull request #664 from Skillkiller/translation

Localize status messages and UI elements across various tools
This commit is contained in:
Alam
2026-05-08 19:44:24 +05:30
committed by GitHub
41 changed files with 1309 additions and 312 deletions
+142 -34
View File
@@ -131,29 +131,58 @@
<!-- How it works info box -->
<div class="p-3 bg-gray-900 rounded-lg border border-gray-700 mb-6">
<p class="text-sm text-gray-300">
<strong class="text-white">How it works:</strong>
<strong class="text-white" data-i18n="tools:ocrPdf.howItWorksTitle"
>How it works:</strong
>
</p>
<ul
class="list-disc list-inside text-xs text-gray-400 mt-1 space-y-1"
>
<li>
<strong class="text-white">Extract Text:</strong> Uses Tesseract
OCR to recognize text from scanned images or PDFs.
<strong
class="text-white"
data-i18n="tools:ocrPdf.extractTextLabel"
>Extract Text:</strong
>
<span data-i18n="tools:ocrPdf.extractTextDescription"
>Uses Tesseract OCR to recognize text from scanned images or
PDFs.</span
>
</li>
<li>
<strong class="text-white">Searchable Output:</strong> Creates a
new PDF with an invisible text layer, making your document fully
searchable while preserving the original appearance.
<strong
class="text-white"
data-i18n="tools:ocrPdf.searchableOutputLabel"
>Searchable Output:</strong
>
<span data-i18n="tools:ocrPdf.searchableOutputDescription"
>Creates a new PDF with an invisible text layer, making your
document fully searchable while preserving the original
appearance.</span
>
</li>
<li>
<strong class="text-white">Character Filtering:</strong> Use
whitelists to filter out unwanted characters and improve accuracy
for specific document types (invoices, forms, etc.).
<strong
class="text-white"
data-i18n="tools:ocrPdf.characterFilteringLabel"
>Character Filtering:</strong
>
<span data-i18n="tools:ocrPdf.characterFilteringDescription"
>Use whitelists to filter out unwanted characters and improve
accuracy for specific document types (invoices, forms,
etc.).</span
>
</li>
<li>
<strong class="text-white">Multi-language Support:</strong> Select
multiple languages for documents containing mixed language
content.
<strong
class="text-white"
data-i18n="tools:ocrPdf.multiLanguageSupportLabel"
>Multi-language Support:</strong
>
<span data-i18n="tools:ocrPdf.multiLanguageSupportDescription"
>Select multiple languages for documents containing mixed
language content.</span
>
</li>
</ul>
</div>
@@ -190,7 +219,9 @@
<!-- OCR Options -->
<div id="tool-options" class="hidden mt-6 space-y-4">
<div>
<label class="block mb-2 text-sm font-medium text-gray-300"
<label
class="block mb-2 text-sm font-medium text-gray-300"
data-i18n="tools:ocrPdf.languagesInDocument"
>Languages in Document</label
>
<div class="relative">
@@ -199,6 +230,7 @@
id="lang-search"
class="w-full bg-gray-900 border border-gray-600 text-white rounded-lg p-2.5 mb-2"
placeholder="Search for languages..."
data-i18n-placeholder="tools:ocrPdf.searchLanguagesPlaceholder"
/>
<div
id="lang-list"
@@ -208,8 +240,11 @@
</div>
</div>
<p class="text-xs text-gray-500 mt-1">
Selected:
<span id="selected-langs-display" class="font-semibold"
<span data-i18n="tools:ocrPdf.selectedLabel">Selected:</span>
<span
id="selected-langs-display"
class="font-semibold"
data-i18n="tools:ocrPdf.none"
>None</span
>
</p>
@@ -224,7 +259,9 @@
<summary
class="text-sm font-medium text-gray-300 cursor-pointer flex items-center justify-between"
>
<span>Advanced Settings (Recommended to improve accuracy)</span>
<span data-i18n="tools:ocrPdf.advancedSettingsSummary"
>Advanced Settings (Recommended to improve accuracy)</span
>
<i
data-lucide="chevron-down"
class="w-4 h-4 transition-transform details-icon"
@@ -236,15 +273,29 @@
<label
for="ocr-resolution"
class="block mb-1 text-xs font-medium text-gray-400"
data-i18n="tools:ocrPdf.resolutionLabel"
>Resolution</label
>
<select
id="ocr-resolution"
class="w-full bg-gray-700 border border-gray-600 text-white rounded-lg p-2 text-sm"
>
<option value="2.0">Standard (192 DPI)</option>
<option value="3.0" selected>High (288 DPI)</option>
<option value="4.0">Ultra (384 DPI)</option>
<option
value="2.0"
data-i18n="tools:ocrPdf.resolutionStandard"
>
Standard (192 DPI)
</option>
<option
value="3.0"
selected
data-i18n="tools:ocrPdf.resolutionHigh"
>
High (288 DPI)
</option>
<option value="4.0" data-i18n="tools:ocrPdf.resolutionUltra">
Ultra (384 DPI)
</option>
</select>
</div>
<!-- Binarization -->
@@ -256,7 +307,9 @@
id="ocr-binarize"
class="w-4 h-4 rounded text-indigo-600 bg-gray-700 border-gray-600"
/>
Binarize Image (Enhance Contrast for Clean Scans)
<span data-i18n="tools:ocrPdf.binarizeLabel"
>Binarize Image (Enhance Contrast for Clean Scans)</span
>
</label>
<label
class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer"
@@ -266,37 +319,69 @@
id="ocr-embed-full-fonts"
class="w-4 h-4 rounded text-indigo-600 bg-gray-700 border-gray-600"
/>
Embed Full Fonts (Larger file, better compatibility)
<span data-i18n="tools:ocrPdf.embedFullFontsLabel"
>Embed Full Fonts (Larger file, better compatibility)</span
>
</label>
<!-- Whitelist Presets -->
<div>
<label
for="whitelist-preset"
class="block mb-1 text-xs font-medium text-gray-400"
data-i18n="tools:ocrPdf.whitelistPresetLabel"
>Character Whitelist Preset</label
>
<select
id="whitelist-preset"
class="w-full bg-gray-700 border border-gray-600 text-white rounded-lg p-2 text-sm mb-2"
>
<option value="">None (All characters)</option>
<option value="alphanumeric">
<option value="" data-i18n="tools:ocrPdf.whitelistNone">
None (All characters)
</option>
<option
value="alphanumeric"
data-i18n="tools:ocrPdf.whitelistAlphanumeric"
>
Alphanumeric + Basic Punctuation
</option>
<option value="numbers-currency">
<option
value="numbers-currency"
data-i18n="tools:ocrPdf.whitelistNumbersCurrency"
>
Numbers + Currency Symbols
</option>
<option value="letters-only">Letters Only (A-Z, a-z)</option>
<option value="numbers-only">Numbers Only (0-9)</option>
<option value="invoice">
<option
value="letters-only"
data-i18n="tools:ocrPdf.whitelistLettersOnly"
>
Letters Only (A-Z, a-z)
</option>
<option
value="numbers-only"
data-i18n="tools:ocrPdf.whitelistNumbersOnly"
>
Numbers Only (0-9)
</option>
<option
value="invoice"
data-i18n="tools:ocrPdf.whitelistInvoice"
>
Invoice/Receipt (Numbers, $, ., -, /)
</option>
<option value="forms">
<option value="forms" data-i18n="tools:ocrPdf.whitelistForms">
Forms (Alphanumeric + Common Symbols)
</option>
<option value="custom">Custom...</option>
<option
value="custom"
data-i18n="tools:ocrPdf.whitelistCustom"
>
Custom...
</option>
</select>
<p class="text-xs text-gray-500 mt-1">
<p
class="text-xs text-gray-500 mt-1"
data-i18n="tools:ocrPdf.whitelistHelp"
>
Only these characters will be recognized. Leave empty for all
characters.
</p>
@@ -306,6 +391,7 @@
<label
for="ocr-whitelist"
class="block mb-1 text-xs font-medium text-gray-400"
data-i18n="tools:ocrPdf.whitelistInputLabel"
>Character Whitelist (Optional)</label
>
<input
@@ -313,8 +399,12 @@
id="ocr-whitelist"
class="w-full bg-gray-700 border border-gray-600 text-white rounded-lg p-2 text-sm"
placeholder="e.g., abcdefghijklmnopqrstuvwxyz0123456789$.,"
data-i18n-placeholder="tools:ocrPdf.whitelistInputPlaceholder"
/>
<p class="text-xs text-gray-500 mt-1">
<p
class="text-xs text-gray-500 mt-1"
data-i18n="tools:ocrPdf.whitelistHelp"
>
Only these characters will be recognized. Leave empty for all
characters.
</p>
@@ -326,6 +416,7 @@
id="process-btn"
class="btn-gradient w-full disabled:opacity-50"
disabled
data-i18n="tools:ocrPdf.startButton"
>
Start OCR
</button>
@@ -336,7 +427,13 @@
id="ocr-progress"
class="hidden mt-6 p-4 bg-gray-900 border border-gray-700 rounded-lg"
>
<p id="progress-status" class="text-white mb-2">Initializing...</p>
<p
id="progress-status"
class="text-white mb-2"
data-i18n="tools:ocrPdf.progressInitializing"
>
Initializing...
</p>
<div class="w-full bg-gray-700 rounded-full h-4">
<div
id="progress-bar"
@@ -352,8 +449,16 @@
<!-- Results Section -->
<div id="ocr-results" class="hidden mt-6">
<h3 class="text-xl font-bold text-white mb-2">OCR Complete</h3>
<p class="mb-4 text-gray-400">
<h3
class="text-xl font-bold text-white mb-2"
data-i18n="tools:ocrPdf.resultsTitle"
>
OCR Complete
</h3>
<p
class="mb-4 text-gray-400"
data-i18n="tools:ocrPdf.resultsDescription"
>
Your searchable PDF is ready. You can also copy or download the
extracted text below.
</p>
@@ -368,6 +473,7 @@
id="copy-text-btn"
class="absolute top-2 right-2 bg-gray-700 hover:bg-gray-600 p-2 rounded-md"
title="Copy to Clipboard"
data-i18n-title="tools:ocrPdf.copyToClipboard"
>
<i data-lucide="clipboard-copy" class="w-4 h-4 text-gray-300"></i>
</button>
@@ -376,12 +482,14 @@
<button
id="download-txt-btn"
class="w-full bg-gray-700 text-white font-semibold py-3 rounded-lg hover:bg-gray-600"
data-i18n="tools:ocrPdf.downloadTxt"
>
Download as .txt
</button>
<button
id="download-searchable-pdf"
class="w-full bg-green-600 text-white font-semibold py-3 rounded-lg hover:bg-green-700"
data-i18n="tools:ocrPdf.downloadSearchablePdf"
>
Download Searchable PDF
</button>