From dfc98c9b3d47d7b1016ee3c12baee110140ed267 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Thu, 1 Apr 2021 19:33:08 +0100 Subject: [PATCH 1/6] Check convert is a file #156 --- server/src/context.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/context.js b/server/src/context.js index 6a7c63f9..5a1c01fb 100644 --- a/server/src/context.js +++ b/server/src/context.js @@ -3,8 +3,10 @@ const Config = require('./config'); const Devices = require('./devices'); const diagnostic = (path) => { - const success = fs.existsSync(path); - const message = success ? `Found ${path}` : `Unable to find ${path}`; + const exists = fs.existsSync(path); + const isDirectory = fs.statSync(path).isDirectory(); + const success = exists && !isDirectory; + const message = success ? `Found ${path}` : `Unable to find file ${path}`; return { success, message From f9267ced01195bb95c7ca6a219bb682db4416736 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Fri, 2 Apr 2021 21:27:49 +0200 Subject: [PATCH 2/6] Italian translation --- webui/src/locales/it.json | 89 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 webui/src/locales/it.json diff --git a/webui/src/locales/it.json b/webui/src/locales/it.json new file mode 100644 index 00000000..fdef18bf --- /dev/null +++ b/webui/src/locales/it.json @@ -0,0 +1,89 @@ +{ + "global": { + "application-name": "scanservjs" + }, + + "about": { + "main": "scanservjs è una semplice interfaccia web per il tuo scanner. Permette di condividere uno o più scanner (usando SANE) in una rete, senza necessità di driver o installazioni complicate. Può salvare nei formati TIF, JPG, PNG, PDF e TXT (via Tesseract OCR) con vari livelli di compressione. Supporta la scansione multi-pagina e tutti i dispositivi compatibili con SANE.", + "issue": "Segnala problemi o visualizza il codice sorgente:" + }, + + "batch-dialog": { + "btn-finish": "Finito", + "btn-rescan": "Ripeti scansione", + "btn-next": "Prossima pagina" + }, + + "files": { + "filename": "Nome file", + "date": "Data", + "size": "Dimensione", + "message:deleted": "Eliminato" + }, + + "navigation": { + "scan": "Scansiona", + "files": "File", + "settings": "Impostazioni", + "about": "Informazioni", + "version": "Versione" + }, + + "pipeline": { + "high-quality": "Qualità alta", + "medium-quality": "Qualità media", + "low-quality": "Qualità bassa", + "uncompressed": "Non compresso", + "lzw-compressed": "Conpresso con LZW", + "ocr": "OCR", + "text-file": "File di testo" + }, + + "scan": { + "device": "Dispositivo", + "source": "Sorgente", + "resolution": "Risoluzione", + "mode": "Modalità", + "dynamic-lineart": "Lineart dinamico", + "dynamic-lineart:enabled": "Abilitato", + "dynamic-lineart:disabled": "Disabilitato", + "batch": "Raggruppa", + "batch:none": "No", + "batch:manual": "Manuale (Con finestra guidata)", + "batch:auto": "Automatico (Cassetto dei documenti)", + "batch:auto-collate-standard": "Automatico (Fascicola 1, 3... 4, 2)", + "batch:auto-collate-reverse": "Automatico (Inverso 1, 3... 2, 4)", + "filters": "Filtri", + "filters:auto-level": "Livello automatico", + "filters:threshold": "Soglia", + "filters:blur": "Sfocatura", + "format": "Formato", + "btn-preview": "Anteprima", + "btn-clear": "Cancella", + "btn-scan": "Scansiona", + "btn-reset": "Ripristina", + "top": "Sopra", + "left": "Sinistra", + "width": "Larghezza", + "height": "Altezza", + "brightness": "Luminosità", + "contrast": "Contrasto", + "message:loading-devices": "Caricamento dispositivi...", + "message:no-devices": "Nessun dispositivo trovato", + "message:deleted-preview": "Anteprima eliminata", + "message:turn-documents": "Capovolgi i documenti", + "message:preview-of-page": "Anteprima della pagina" + }, + + "settings": { + "title": "@:navigation.settings", + "behaviour-ui": "Comportamento ed interfaccia", + "locale": "Lingua", + "locale:description": "Scegli la lingua", + "theme": "Tema", + "theme:description": "Tema. Se usi il tema Sistema e lo cambi, dovrai ricaricare l'app.", + "theme:system": "Sistema", + "theme:light": "Chiaro", + "theme:dark": "Scuro" + } +} From 8ebbaddbc0990d8b45c30c024eec5167d27975dc Mon Sep 17 00:00:00 2001 From: Guldoman Date: Fri, 2 Apr 2021 21:50:27 +0200 Subject: [PATCH 3/6] Add i18n to BatchDialog --- webui/src/components/BatchDialog.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webui/src/components/BatchDialog.vue b/webui/src/components/BatchDialog.vue index aedcfee2..ce1fdacc 100644 --- a/webui/src/components/BatchDialog.vue +++ b/webui/src/components/BatchDialog.vue @@ -6,9 +6,9 @@ - Finish - Rescan page - Next + {{ $t('batch-dialog.btn-finish') }} + {{ $t('batch-dialog.btn-rescan') }} + {{ $t('batch-dialog.btn-next') }} From e10210c69fc98c65229fb064999588735c110e3b Mon Sep 17 00:00:00 2001 From: ceskyDJ <48548230+ceskyDJ@users.noreply.github.com> Date: Sat, 3 Apr 2021 02:35:37 +0200 Subject: [PATCH 4/6] Added czech translation --- webui/src/locales/cz.json | 89 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 webui/src/locales/cz.json diff --git a/webui/src/locales/cz.json b/webui/src/locales/cz.json new file mode 100644 index 00000000..bd1420b9 --- /dev/null +++ b/webui/src/locales/cz.json @@ -0,0 +1,89 @@ +{ + "global": { + "application-name": "scanservjs" + }, + + "about": { + "main": "scanservjs je jednoduché webové uživatelské rozhraní pro váš skener. Umožňuje vám sdílet jeden nebo více skenerů (s využitím SANE) bez ovladačů nebo komplikované instalace. Umí ukládat do TIF, JPG, PNG, PDF a TXT (využívá Tesseract OCR) s různými nastaveními komprese, vše je možné konfigurovat. Podporuje vícestránkové skenování a všechna zařízení kompatibilní se SANE.", + "issue": "Ohlaste chybu nebo se podívejte na zdrojový kód:" + }, + + "batch-dialog": { + "btn-finish": "Dokončit", + "btn-rescan": "Znovu oskenovat stránku", + "btn-next": "Další" + }, + + "files": { + "filename": "Název souboru", + "date": "Datum", + "size": "Velikost", + "message:deleted": "Odstraněno" + }, + + "navigation": { + "scan": "Skenování", + "files": "Soubory", + "settings": "Nastavení", + "about": "Informace", + "version": "Verze" + }, + + "pipeline": { + "high-quality": "Vysoká kvalita", + "medium-quality": "Střední kvalita", + "low-quality": "Nízká kvalita", + "uncompressed": "Bez komprese", + "lzw-compressed": "S kompresí LZW", + "ocr": "OCR", + "text-file": "Textový soubor" + }, + + "scan": { + "device": "Zařízení", + "source": "Zdroj", + "resolution": "Rozlišení", + "mode": "Mód", + "dynamic-lineart": "Dynamická perokresba", + "dynamic-lineart:enabled": "Zapnuto", + "dynamic-lineart:disabled": "Vypnuto", + "batch": "Vícestránkový sken", + "batch:none": "Vypnuto", + "batch:manual": "Manuální (s výzvou)", + "batch:auto": "Automatický (Podavač dokumentů)", + "batch:auto-collate-standard": "Automatický (Kompletovat 1, 3... 4, 2)", + "batch:auto-collate-reverse": "Automatický (Obrátit 1, 3... 2, 4)", + "filters": "Filtry", + "filters:auto-level": "Automatické zarovnání", + "filters:threshold": "Prahová hodnota barev", + "filters:blur": "Rozmazané", + "format": "Formát", + "btn-preview": "Načíst náhled", + "btn-clear": "Vymazat", + "btn-scan": "Skenovat", + "btn-reset": "Resetovat", + "top": "Nahoře", + "left": "Vlevo", + "width": "Šířka", + "height": "Výška", + "brightness": "Jas", + "contrast": "Kontrast", + "message:loading-devices": "Načítání zařízení...", + "message:no-devices": "Nebyla nalezena žádná zařízení", + "message:deleted-preview": "Odstranit náhled", + "message:turn-documents": "Obrátit dokumenty", + "message:preview-of-page": "Náhled stránky" + }, + + "settings": { + "title": "@:navigation.settings", + "behaviour-ui": "Chování a uživatelské rozhraní", + "locale": "Lokalizace", + "locale:description": "Vyberte vaši lokalizaci", + "theme": "Motiv", + "theme:description": "Motiv. Pokud použijete systémový motiv a ten se změní, budete potřebovat přenačíst aplikaci.", + "theme:system": "Podle systému", + "theme:light": "Světlý", + "theme:dark": "Tmavý" + } +} \ No newline at end of file From 28a9cb9462d3a50f48f13c6de1da98f5f9dd17e0 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sat, 3 Apr 2021 10:05:37 +0100 Subject: [PATCH 5/6] Version++; locale list --- README.md | 2 +- server/package-lock.json | 2 +- server/package.json | 2 +- webui/src/classes/constants.js | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8dc2cbaf..2af4d0a6 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ complicated installation. * Configurable overrides for all defaults as well as filters and formats * Multipage scanning (with collation for double sided scans) * Light and dark mode -* **NEW**: International translations: German; Spanish (**help requested**) +* **NEW**: International translations: Czech, German, Italian, Spanish (**help requested**) It supports any [SANE compatible devices](http://www.sane-project.org/sane-supported-devices.html). diff --git a/server/package-lock.json b/server/package-lock.json index e7d4f474..6a05db6c 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,6 +1,6 @@ { "name": "scanservjs-server", - "version": "2.8.1", + "version": "2.8.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/server/package.json b/server/package.json index 11e9f978..d1d62e43 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "scanservjs-server", - "version": "2.8.1", + "version": "2.8.2", "description": "scanservjs is a simple web-based UI for SANE which allows you to share a scanner on a network without the need for drivers or complicated installation. scanserv does not do image conversion or manipulation (beyond the bare minimum necessary for the purposes of browser preview) or OCR.", "scripts": { "serve": "nodemon --exec 'vue-cli-service serve'", diff --git a/webui/src/classes/constants.js b/webui/src/classes/constants.js index 7e7d07a2..5ed4a8b7 100644 --- a/webui/src/classes/constants.js +++ b/webui/src/classes/constants.js @@ -2,9 +2,11 @@ const Constants = { Version: process.env.VUE_APP_VERSION, Locales: [ + 'cz', 'de', 'en', 'es', + 'it', 'test' ], From 9c76223b69e5a2b4c0160be5300585bc0cc82090 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sat, 3 Apr 2021 10:20:48 +0100 Subject: [PATCH 6/6] Fix unit test --- server/src/context.js | 2 +- server/test/context.test.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 server/test/context.test.js diff --git a/server/src/context.js b/server/src/context.js index 5a1c01fb..f3649d1b 100644 --- a/server/src/context.js +++ b/server/src/context.js @@ -4,7 +4,7 @@ const Devices = require('./devices'); const diagnostic = (path) => { const exists = fs.existsSync(path); - const isDirectory = fs.statSync(path).isDirectory(); + const isDirectory = exists && fs.statSync(path).isDirectory(); const success = exists && !isDirectory; const message = success ? `Found ${path}` : `Unable to find file ${path}`; return { diff --git a/server/test/context.test.js b/server/test/context.test.js new file mode 100644 index 00000000..a2c3a34b --- /dev/null +++ b/server/test/context.test.js @@ -0,0 +1,15 @@ +/* eslint-env mocha */ +const assert = require('assert'); +const Config = require('../src/config'); +const Context = require('../src/context'); + +describe('Context', () => { + it('missing files', () => { + const temp = Config.scanimage; + Config.scanimage = '/x'; + const context = new Context([]); + assert.strictEqual(context.diagnostics.length, 2); + assert.strictEqual(context.diagnostics[0].success, false); + Config.scanimage = temp; + }); +}); \ No newline at end of file