Add localization to fileDisplayArea
This commit is contained in:
@@ -10,6 +10,7 @@ import { PDFDocument } from 'pdf-lib';
|
||||
import { applyColorAdjustments } from '../utils/image-effects.js';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import type { AdjustColorsSettings } from '../types/adjust-colors-type.js';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
||||
@@ -146,7 +147,7 @@ const updateUI = () => {
|
||||
return getPDFDocument(buffer).promise;
|
||||
})
|
||||
.then((pdf: pdfjsLib.PDFDocumentProxy) => {
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} page${pdf.numPages !== 1 ? 's' : ''}`;
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} ${pdf.numPages !== 1 ? t('common.pages') : t('common.page')}`;
|
||||
})
|
||||
.catch(() => {
|
||||
metaSpan.textContent = formatBytes(file.size);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { createIcons, icons } from 'lucide';
|
||||
import JSZip from 'jszip';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import { PDFPageProxy } from 'pdfjs-dist';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
||||
@@ -67,7 +68,7 @@ const updateUI = () => {
|
||||
return getPDFDocument(buffer).promise;
|
||||
})
|
||||
.then((pdf) => {
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} page${pdf.numPages !== 1 ? 's' : ''}`;
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} ${pdf.numPages !== 1 ? t('common.pages') : t('common.page')}`;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('Error loading PDF page count:', e);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { createIcons, icons } from 'lucide';
|
||||
import { PDFDocument } from 'pdf-lib';
|
||||
import { applyGreyscale } from '../utils/image-effects.js';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
||||
@@ -66,7 +67,7 @@ const updateUI = () => {
|
||||
return getPDFDocument(buffer).promise;
|
||||
})
|
||||
.then((pdf) => {
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} page${pdf.numPages !== 1 ? 's' : ''}`;
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} ${pdf.numPages !== 1 ? t('common.pages') : t('common.page')}`;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('Error loading PDF page count:', e);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { createIcons, icons } from 'lucide';
|
||||
import JSZip from 'jszip';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import { PDFPageProxy } from 'pdfjs-dist';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
||||
@@ -66,7 +67,7 @@ const updateUI = () => {
|
||||
return getPDFDocument(buffer).promise;
|
||||
})
|
||||
.then((pdf) => {
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} page${pdf.numPages !== 1 ? 's' : ''}`;
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} ${pdf.numPages !== 1 ? t('common.pages') : t('common.page')}`;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('Error loading PDF page count:', e);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { createIcons, icons } from 'lucide';
|
||||
import JSZip from 'jszip';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import { PDFPageProxy } from 'pdfjs-dist';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
||||
@@ -66,7 +67,7 @@ const updateUI = () => {
|
||||
return getPDFDocument(buffer).promise;
|
||||
})
|
||||
.then((pdf) => {
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} page${pdf.numPages !== 1 ? 's' : ''}`;
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} ${pdf.numPages !== 1 ? t('common.pages') : t('common.page')}`;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('Error loading PDF page count:', e);
|
||||
|
||||
@@ -11,6 +11,7 @@ import JSZip from 'jszip';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import UTIF from 'utif';
|
||||
import { PDFPageProxy } from 'pdfjs-dist';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
||||
@@ -67,7 +68,7 @@ const updateUI = () => {
|
||||
return getPDFDocument(buffer).promise;
|
||||
})
|
||||
.then((pdf) => {
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} page${pdf.numPages !== 1 ? 's' : ''}`;
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} ${pdf.numPages !== 1 ? t('common.pages') : t('common.page')}`;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('Error loading PDF page count:', e);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { createIcons, icons } from 'lucide';
|
||||
import JSZip from 'jszip';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import { PDFPageProxy } from 'pdfjs-dist';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
||||
@@ -66,7 +67,7 @@ const updateUI = () => {
|
||||
return getPDFDocument(buffer).promise;
|
||||
})
|
||||
.then((pdf) => {
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} page${pdf.numPages !== 1 ? 's' : ''}`;
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} ${pdf.numPages !== 1 ? t('common.pages') : t('common.page')}`;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('Error loading PDF page count:', e);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { PDFDocument } from 'pdf-lib';
|
||||
import { applyScannerEffect } from '../utils/image-effects.js';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import type { ScanSettings } from '../types/scanner-effect-type.js';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
||||
@@ -152,7 +153,7 @@ const updateUI = () => {
|
||||
return getPDFDocument(buffer).promise;
|
||||
})
|
||||
.then((pdf: pdfjsLib.PDFDocumentProxy) => {
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} page${pdf.numPages !== 1 ? 's' : ''}`;
|
||||
metaSpan.textContent = `${formatBytes(file.size)} • ${pdf.numPages} ${pdf.numPages !== 1 ? t('common.pages') : t('common.page')}`;
|
||||
})
|
||||
.catch(() => {
|
||||
metaSpan.textContent = formatBytes(file.size);
|
||||
|
||||
Reference in New Issue
Block a user