v1.7.15 — i18n audit, splash min 3s, decimal precision, demo GIF, README fixes

- Complete i18n audit: 25+ new translation keys (en/it/de) — vacuum toast,
  TTS voices, timer steps, product notes, error prefixes, form placeholders,
  barcode hints, recipe/cooking ingredient labels, unit variants
- pz/conf unit labels now use t('units.pz') / t('units.conf') throughout
- Splash screen: minimum 3-second display (_splashStart recorded at parse
  time, fade delayed by remaining ms if app loads faster)
- Quantity decimal precision: qtyNum in recipe/cooking buttons and conf
  fallback display capped to 1 decimal (was showing 7+ from raw AI output)
- Recipe/cooking buttons: removed Italian fallback strings from t() calls
- README: translated remaining Italian phrases; added demo.gif to Screenshots
- CHANGELOG: updated 1.7.15 entry with all session changes
- assets/img/demo.gif: EverShelf.gif processed at 2x speed (~36s)
This commit is contained in:
dadaloop82
2026-05-16 15:36:31 +00:00
parent 195c3d3bfa
commit 473d3f59a4
13 changed files with 382 additions and 199 deletions
+15
View File
@@ -11,6 +11,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Recipe scraps tips** — During cooking steps, detect "waste" generated (peels, cores, bones, eggshells, coffee grounds, citrus zest, etc.) and surface AI-powered tips on how to reuse them (compost, natural cleaner, broth, candied peel, etc.). Could be shown as an optional collapsible hint card below the step that generates the scrap. - **Recipe scraps tips** — During cooking steps, detect "waste" generated (peels, cores, bones, eggshells, coffee grounds, citrus zest, etc.) and surface AI-powered tips on how to reuse them (compost, natural cleaner, broth, candied peel, etc.). Could be shown as an optional collapsible hint card below the step that generates the scrap.
## [1.7.15] - 2026-05-16
### Added
- **Full i18n audit** — Comprehensive sweep of all user-visible strings in `app.js` and `index.html`. 25+ new translation keys added across `it.json`, `en.json`, `de.json`, covering: vacuum toast, TTS voice controls, timer step labels, product note labels, error messages, expiry form, barcode hint, category select placeholder, cooking step fallback, `form.select_placeholder`, `btn.yes_short`/`no_short`, `add.vacuum_question`, `add.vacuum_saved`, `move.vacuum_seal_rest`, `cooking.step_fallback`, `error.prefix`/`unknown`, `product.select_variant`, and more.
- **Splash screen redesign** — Logo displayed prominently, spinner below, app version shown at the bottom; version label injected dynamically at boot time so it never gets out of sync. Minimum 3-second display duration enforced: `_splashStart` is recorded before `DOMContentLoaded`; the fade-out is delayed by the remaining time if the app loads faster than 3 s.
- **Demo GIF in README** — `assets/img/demo.gif` (processed at 2× speed, ~36 s) added to the `## 📸 Screenshots` section.
- **`pz`/`conf` unit labels translated** — "pz" now shows as "pcs" in English and "Stk" in German; "conf" shows as "pkg" / "Pkg". All `unitLabels` objects in JS now use `t('units.pz')` / `t('units.conf')`.
### Fixed
- **Logo white background on splash screen** — Re-processed both `logo.png` and `logo_icon.png` with fuzz 35% alpha extraction, removing the white background that was visible against the dark splash background (`#0f172a`).
- **Recipe button label** — Shortened to "Ricetta" / "Recipe" / "Rezept" for compact display in the inventory quick-action modal.
- **Quantity decimal precision** — `qtyNum` in recipe/cooking ingredient buttons and `conf` fallback display in inventory cards now limited to 1 decimal place (was showing 7+ decimal places from raw AI output, e.g. `0.25353223 conf`).
- **"Errore" / "Error" fallback strings** — All remaining Italian hardcoded `'Errore'` fallbacks in `showToast()` calls replaced with `t('error.generic')`. Italian fallback strings removed from buttons that already used `t()`.
- **README Italian phrases** — "La quantità è giusta (2 pz)", "🤖 Spiega", "Latte / Affettato / Panna da cucina", "Buon appetito!", "L'ho buttato" replaced with English equivalents in the README.
## [1.7.14] - 2026-05-16 ## [1.7.14] - 2026-05-16
### Added ### Added
+13 -7
View File
@@ -25,7 +25,7 @@
[![SQLite](https://img.shields.io/badge/SQLite-3-blue.svg)](https://www.sqlite.org/) [![SQLite](https://img.shields.io/badge/SQLite-3-blue.svg)](https://www.sqlite.org/)
[![Docker](https://img.shields.io/badge/Docker-Ready-2496ED.svg)](Dockerfile) [![Docker](https://img.shields.io/badge/Docker-Ready-2496ED.svg)](Dockerfile)
[![i18n](https://img.shields.io/badge/i18n-IT%20%7C%20EN%20%7C%20DE-orange.svg)](translations/) [![i18n](https://img.shields.io/badge/i18n-IT%20%7C%20EN%20%7C%20DE-orange.svg)](translations/)
[![Version](https://img.shields.io/badge/version-1.7.13-brightgreen.svg)](CHANGELOG.md) [![Version](https://img.shields.io/badge/version-1.7.15-brightgreen.svg)](CHANGELOG.md)
[![GitHub stars](https://img.shields.io/github/stars/dadaloop82/EverShelf?style=social)](https://github.com/dadaloop82/EverShelf/stargazers) [![GitHub stars](https://img.shields.io/github/stars/dadaloop82/EverShelf?style=social)](https://github.com/dadaloop82/EverShelf/stargazers)
[![Last commit](https://img.shields.io/github/last-commit/dadaloop82/EverShelf/main)](https://github.com/dadaloop82/EverShelf/commits/main) [![Last commit](https://img.shields.io/github/last-commit/dadaloop82/EverShelf/main)](https://github.com/dadaloop82/EverShelf/commits/main)
[![Contributors](https://img.shields.io/github/contributors/dadaloop82/EverShelf)](https://github.com/dadaloop82/EverShelf/graphs/contributors) [![Contributors](https://img.shields.io/github/contributors/dadaloop82/EverShelf)](https://github.com/dadaloop82/EverShelf/graphs/contributors)
@@ -45,7 +45,7 @@
- **Expiry tracking** — Automatic shelf-life estimation based on product type and storage - **Expiry tracking** — Automatic shelf-life estimation based on product type and storage
- **Opened product tracking** — Reduced shelf-life calculation when packages are opened; opened-product expiry is now also checked when building banner alerts (not just the dashboard section) - **Opened product tracking** — Reduced shelf-life calculation when packages are opened; opened-product expiry is now also checked when building banner alerts (not just the dashboard section)
- **Vacuum-sealed support** — Extended expiry dates for vacuum-sealed items - **Vacuum-sealed support** — Extended expiry dates for vacuum-sealed items
- **Anomaly detection** — Banner alerts for suspicious quantities and consumption predictions with inline correction; dismiss button now shows the current inventory quantity so the action is unambiguous ("La quantità è giusta (2 pz)") - **Anomaly detection** — Banner alerts for suspicious quantities and consumption predictions with inline correction; dismiss button now shows the current inventory quantity so the action is unambiguous ("Quantity is correct (2 pcs)")
### 🤖 AI-Powered (Google Gemini) ### 🤖 AI-Powered (Google Gemini)
- **Expiry date reading** — Photograph a label and extract the expiry date automatically - **Expiry date reading** — Photograph a label and extract the expiry date automatically
@@ -55,13 +55,13 @@
- **Recipe generation** — Get personalized recipes based on what's in your pantry; streams live via Server-Sent Events so results appear as they are generated - **Recipe generation** — Get personalized recipes based on what's in your pantry; streams live via Server-Sent Events so results appear as they are generated
- **Smart chat assistant** — Ask questions about your inventory, get cooking tips - **Smart chat assistant** — Ask questions about your inventory, get cooking tips
- **Shopping suggestions with tips** — AI-powered purchase recommendations, each enriched with a short practical buying/storing tip - **Shopping suggestions with tips** — AI-powered purchase recommendations, each enriched with a short practical buying/storing tip
- **Anomaly explanation** — "🤖 Spiega" button on anomaly banners explains in plain language why a discrepancy likely occurred and what to do - **Anomaly explanation** — "Explain" button on anomaly banners explains in plain language why a discrepancy likely occurred and what to do
- **Model fallback** — All AI endpoints try `gemini-2.5-flash` first and fall back to `gemini-2.0-flash` automatically - **Model fallback** — All AI endpoints try `gemini-2.5-flash` first and fall back to `gemini-2.0-flash` automatically
- **Graceful no-key state** — When no Gemini key is configured, AI entry points show a friendly message; the header button is visually greyed with an amber dot - **Graceful no-key state** — When no Gemini key is configured, AI entry points show a friendly message; the header button is visually greyed with an amber dot
### 🛒 Shopping List ### 🛒 Shopping List
- **Bring! integration** — Sync with the [Bring!](https://www.getbring.com/) shopping list app - **Bring! integration** — Sync with the [Bring!](https://www.getbring.com/) shopping list app
- **Generic shopping names** — Products are grouped by type ("Latte", "Affettato", "Panna da cucina") rather than brand, keeping the Bring! list clean and consolidated - **Generic shopping names** — Products are grouped by type (e.g. "Milk", "Cold cuts", "Cooking cream") rather than brand, keeping the Bring! list clean and consolidated
- **Smart predictions** — Know what you'll need before you run out - **Smart predictions** — Know what you'll need before you run out
- **Auto-add on depletion** — When a product reaches zero the app adds it to Bring! automatically, no confirmation needed - **Auto-add on depletion** — When a product reaches zero the app adds it to Bring! automatically, no confirmation needed
- **Auto-remove on scan** — Products are removed from the shopping list when scanned in - **Auto-migration** — Items already on the Bring! list are silently renamed to their generic name in the background (throttled, runs on list load) - **Auto-remove on scan** — Products are removed from the shopping list when scanned in - **Auto-migration** — Items already on the Bring! list are silently renamed to their generic name in the background (throttled, runs on list load)
@@ -72,7 +72,7 @@
- **Text-to-Speech** — Voice readout of recipe steps; supports browser Web Speech API, native Android TTS (kiosk), or a custom REST endpoint (Home Assistant, etc.); retries voice loading for up to 10 seconds with a fallback refresh button; TTS activates automatically without requiring the global TTS setting to be enabled - **Text-to-Speech** — Voice readout of recipe steps; supports browser Web Speech API, native Android TTS (kiosk), or a custom REST endpoint (Home Assistant, etc.); retries voice loading for up to 10 seconds with a fallback refresh button; TTS activates automatically without requiring the global TTS setting to be enabled
- **Auto-read on navigate** — Each step is read aloud automatically when you tap Next or Previous; the first step is read when entering cooking mode - **Auto-read on navigate** — Each step is read aloud automatically when you tap Next or Previous; the first step is read when entering cooking mode
- **Timer voice alerts** — 10-second countdown warning spoken aloud before each timer expires; expiry announced vocally when time is up - **Timer voice alerts** — 10-second countdown warning spoken aloud before each timer expires; expiry announced vocally when time is up
- **Recipe completion** — "Buon appetito!" spoken when the last step is confirmed - **Recipe completion** — "Bon appétit!" announced via TTS when the last step is confirmed
- **Built-in timer** — Automatic timer suggestions based on recipe instructions - **Built-in timer** — Automatic timer suggestions based on recipe instructions
- **Ingredient tracking** — Mark ingredients as used during cooking; leftover quantities prompt a "move to another location" flow - **Ingredient tracking** — Mark ingredients as used during cooking; leftover quantities prompt a "move to another location" flow
@@ -82,7 +82,7 @@
- **Expiry alerts** — Visual warnings for expired and soon-to-expire items - **Expiry alerts** — Visual warnings for expired and soon-to-expire items
- **Opened products panel** — Tracks partially-used items; expiry is recalculated from the opening date using AI (Gemini) + per-category rule fallback; whole sealed packages always keep their original manufacturer expiry; conf items with mixed whole + fractional units are shown as two separate entries - **Opened products panel** — Tracks partially-used items; expiry is recalculated from the opening date using AI (Gemini) + per-category rule fallback; whole sealed packages always keep their original manufacturer expiry; conf items with mixed whole + fractional units are shown as two separate entries
- **Freezer shelf-life** — Granular per-product estimates (USDA/EFSA): fish 120 d, poultry 270 d, whole red-meat cuts 365 d, mince 120 d, vegetables/fruit 270 d, generic 180 d; AI + cache still take priority over rules - **Freezer shelf-life** — Granular per-product estimates (USDA/EFSA): fish 120 d, poultry 270 d, whole red-meat cuts 365 d, mince 120 d, vegetables/fruit 270 d, generic 180 d; AI + cache still take priority over rules
- **Safety ratings** — Smart assessment of expired product safety (by category and location); expired unsafe items shown with a red danger banner and "L'ho buttato" as the primary action - **Safety ratings** — Smart assessment of expired product safety (by category and location); expired unsafe items shown with a red danger banner and a discard action as the primary action
- **Expired product banner** — Products that have passed their effective shelf-life (including opened-product reduced expiry) appear in the top notification banner; icon, colour and title adapt to the actual safety level (✅ green for safe, 👀 amber to check, 🚫 red for danger); high-risk items get a prominent discard action - **Expired product banner** — Products that have passed their effective shelf-life (including opened-product reduced expiry) appear in the top notification banner; icon, colour and title adapt to the actual safety level (✅ green for safe, 👀 amber to check, 🚫 red for danger); high-risk items get a prominent discard action
- **Quick recipe bar** — One-tap recipe suggestion using expiring products - **Quick recipe bar** — One-tap recipe suggestion using expiring products
- **Anomaly banner** — Scrollable banner with suspicious quantities and consumption prediction mismatches, with one-tap correction or inline edit - **Anomaly banner** — Scrollable banner with suspicious quantities and consumption prediction mismatches, with one-tap correction or inline edit
@@ -427,6 +427,12 @@ This project is licensed under the **MIT License** — see the [LICENSE](LICENSE
## 📸 Screenshots ## 📸 Screenshots
<div align="center">
![EverShelf demo — barcode scan, inventory management and AI recipe generation](assets/img/demo.gif)
</div>
For a live walkthrough with real data and full AI enabled, visit the **[live demo](https://evershelfproject.dadaloop.it/demo)** — no installation required. For a live walkthrough with real data and full AI enabled, visit the **[live demo](https://evershelfproject.dadaloop.it/demo)** — no installation required.
> Want to contribute a GIF or screenshots? See [CONTRIBUTING.md](CONTRIBUTING.md) — PRs welcome! > Want to contribute additional screenshots? See [CONTRIBUTING.md](CONTRIBUTING.md) — PRs welcome!
+23 -17
View File
@@ -2869,6 +2869,8 @@ function geminiChat(PDO $db): void {
$history = $input['history'] ?? []; $history = $input['history'] ?? [];
$appliances = $input['appliances'] ?? []; $appliances = $input['appliances'] ?? [];
$dietaryRestrictions = $input['dietary_restrictions'] ?? ''; $dietaryRestrictions = $input['dietary_restrictions'] ?? '';
$lang = recipeNormalizeLang($input['lang'] ?? 'it');
$langName = recipeLangName($lang);
if (empty($message)) { if (empty($message)) {
echo json_encode(['success' => false, 'error' => 'Messaggio vuoto']); echo json_encode(['success' => false, 'error' => 'Messaggio vuoto']);
@@ -2916,27 +2918,29 @@ function geminiChat(PDO $db): void {
$dietaryText = ''; $dietaryText = '';
if (!empty($dietaryRestrictions)) { if (!empty($dietaryRestrictions)) {
$dietaryText = "\nRestrizioni alimentari dell'utente: {$dietaryRestrictions}. Rispetta SEMPRE queste restrizioni."; $dietaryText = "\nUser dietary restrictions: {$dietaryRestrictions}. Always respect these restrictions.";
} }
$langName = recipeLangName($lang);
$systemPrompt = <<<PROMPT $systemPrompt = <<<PROMPT
Sei un assistente cucina italiano esperto, amichevole e conciso. L'utente ha una dispensa e ti chiede consigli su cosa preparare. You are an expert kitchen assistant, friendly and concise. The user has a pantry and asks you for advice on what to prepare.
IMPORTANT: Always respond in {$langName}, using a colloquial and friendly tone.
CONTESTO - INGREDIENTI DISPONIBILI IN DISPENSA: CONTEXT - AVAILABLE PANTRY INGREDIENTS:
{$ingredientsText} {$ingredientsText}
{$appliancesText}{$dietaryText} {$appliancesText}{$dietaryText}
REGOLE: RULES:
1. Rispondi SEMPRE in italiano, in modo colloquiale e amichevole 1. Always respond in {$langName}
2. Usa SOLO gli ingredienti dalla dispensa dell'utente (più acqua, sale, pepe, olio che si presumono sempre disponibili) 2. Use ONLY ingredients from the user's pantry (plus water, salt, pepper, oil which are assumed always available)
3. Dai priorità agli ingredienti in scadenza 3. Prioritize ingredients that expire soon
4. Sii conciso: non fare liste chilometriche, vai al sodo 4. Be concise: no lengthy lists, get to the point
5. Se l'utente chiede una ricetta o preparazione, dai istruzioni chiare con quantità 5. If the user asks for a recipe or preparation, give clear instructions with quantities
6. Se non ci sono ingredienti adatti per la richiesta, dillo onestamente e suggerisci alternative 6. If there are no suitable ingredients for the request, say so honestly and suggest alternatives
7. Puoi suggerire combinazioni creative 7. You can suggest creative combinations
8. Quando menzioni quantità, usa le stesse unità di misura della dispensa 8. When mentioning quantities, use the same units as in the pantry
9. Ricorda il contesto della conversazione precedente 9. Remember the context of the previous conversation
10. Se l'utente chiede esplicitamente una ricetta per un apparecchio specifico (es. macchina del pane, Cookeo, friggitrice ad aria), fornisci la ricetta SOLO per quell'apparecchio, con istruzioni specifiche per quel dispositivo (programmi, ordine degli ingredienti, tempi, temperature) 10. If the user explicitly asks for a recipe for a specific appliance (e.g. bread machine, Cookeo, air fryer), provide the recipe ONLY for that appliance, with device-specific instructions (programs, ingredient order, times, temperatures)
PROMPT; PROMPT;
// Build conversation for Gemini // Build conversation for Gemini
@@ -3810,6 +3814,8 @@ function recipeFromIngredient(PDO $db): void {
echo json_encode(['success' => false, 'error' => 'empty_ingredient']); echo json_encode(['success' => false, 'error' => 'empty_ingredient']);
return; return;
} }
$lang = recipeNormalizeLang($input['lang'] ?? 'it');
$langName = recipeLangName($lang);
// Fetch inventory (same as generateRecipe) // Fetch inventory (same as generateRecipe)
$stmt = $db->query(" $stmt = $db->query("
@@ -3825,18 +3831,18 @@ function recipeFromIngredient(PDO $db): void {
$safeName = htmlspecialchars($ingredientName, ENT_QUOTES, 'UTF-8'); $safeName = htmlspecialchars($ingredientName, ENT_QUOTES, 'UTF-8');
$prompt = <<<PROMPT $prompt = <<<PROMPT
Generate a recipe in Italian that uses "{$safeName}" as a main ingredient. Generate a recipe in {$langName} that uses "{$safeName}" as a main ingredient.
Return ONLY a JSON object, no markdown. Return ONLY a JSON object, no markdown.
Fields: Fields:
- title: string (Italian recipe name) - title: string (recipe name in {$langName})
- meal: null (do NOT categorize) - meal: null (do NOT categorize)
- persons: 2 - persons: 2
- prep_time: string or null - prep_time: string or null
- cook_time: string or null - cook_time: string or null
- ingredients: array of {"name":"...","qty":"...","qty_number":0.0,"unit":"g|ml|pz|conf|kg|l","from_pantry":true} - ingredients: array of {"name":"...","qty":"...","qty_number":0.0,"unit":"g|ml|pz|conf|kg|l","from_pantry":true}
"{$safeName}" MUST be the first ingredient; set from_pantry=true for ALL "{$safeName}" MUST be the first ingredient; set from_pantry=true for ALL
- steps: array of strings (step text only, no numbers) - steps: array of strings (step text only, no numbers, in {$langName})
- nutrition_note: string or null - nutrition_note: string or null
PROMPT; PROMPT;
+19 -2
View File
@@ -104,10 +104,17 @@ body {
letter-spacing: 0.5px; letter-spacing: 0.5px;
} }
.app-preloader-logo { .app-preloader-logo {
height: 120px; height: 160px;
width: auto; width: auto;
object-fit: contain; object-fit: contain;
filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4)); filter: drop-shadow(0 4px 16px rgba(74,222,128,0.2));
}
.app-preloader-version {
color: rgba(255,255,255,0.35);
font-size: 0.72rem;
font-family: monospace;
letter-spacing: 0.5px;
margin-top: -8px;
} }
.header-logo-icon { .header-logo-icon {
height: 28px; height: 28px;
@@ -1267,6 +1274,16 @@ body.server-offline .bottom-nav {
color: white; color: white;
} }
#btn-report-bug {
background: #f97316;
color: #fff;
border-color: #ea580c;
}
#btn-report-bug:hover {
background: #ea580c;
border-color: #c2410c;
}
.btn-secondary { .btn-secondary {
background: var(--bg-card); background: var(--bg-card);
color: var(--text); color: var(--text);
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 KiB

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 237 KiB

+110 -97
View File
@@ -2463,7 +2463,7 @@ window._kioskUpdateResult = function(result) {
status.style.background = 'rgba(239,68,68,0.1)'; status.style.background = 'rgba(239,68,68,0.1)';
status.style.border = '1px solid rgba(239,68,68,0.3)'; status.style.border = '1px solid rgba(239,68,68,0.3)';
status.style.color = ''; status.style.color = '';
status.innerHTML = `Errore: ${result.error}`; status.innerHTML = `${t('error.prefix')}: ${result.error}`;
return; return;
} }
@@ -3434,7 +3434,7 @@ function _renderNutritionSection(inventory) {
<div class="nutr-leg-row"> <div class="nutr-leg-row">
<span class="nutr-leg-dot" style="background:${s.color}"></span> <span class="nutr-leg-dot" style="background:${s.color}"></span>
<span class="nutr-leg-icon">${s.icon}</span> <span class="nutr-leg-icon">${s.icon}</span>
<span class="nutr-leg-name">${s.cat}</span> <span class="nutr-leg-name">${t('categories.' + s.cat) || s.cat}</span>
<span class="nutr-leg-pct">${s.pct}%</span> <span class="nutr-leg-pct">${s.pct}%</span>
</div>`).join('')} </div>`).join('')}
</div> </div>
@@ -3654,7 +3654,7 @@ async function loadDashboard() {
const locInfo = LOCATIONS[item.location] || { icon: '📦', label: item.location }; const locInfo = LOCATIONS[item.location] || { icon: '📦', label: item.location };
const qty = parseFloat(item.quantity); const qty = parseFloat(item.quantity);
const pkgSize = parseFloat(item.default_quantity); const pkgSize = parseFloat(item.default_quantity);
const unitLabels = { 'ml': 'ml', 'g': 'g', 'pz': 'pz' }; const unitLabels = { 'ml': 'ml', 'g': 'g', 'pz': t('units.pz') };
let qtyText = ''; let qtyText = '';
if (item.unit === 'conf') { if (item.unit === 'conf') {
@@ -3666,13 +3666,13 @@ async function loadDashboard() {
// Only show remainder if it rounds to at least 1 unit // Only show remainder if it rounds to at least 1 unit
const remainderText = remainderAmt >= 0.5 ? formatSubRemainder(remainderAmt, pkgUnit) : ''; const remainderText = remainderAmt >= 0.5 ? formatSubRemainder(remainderAmt, pkgUnit) : '';
if (wholeConf > 0 && remainderText) { if (wholeConf > 0 && remainderText) {
qtyText = `${wholeConf} conf${pkgLabel ? ` (da ${pkgSize}${pkgLabel})` : ''} + ${remainderText}`; qtyText = `${wholeConf} ${t('units.conf') || 'conf'}${pkgLabel ? ` (${t('units.from') || 'da'} ${pkgSize}${pkgLabel})` : ''} + ${remainderText}`;
} else if (wholeConf > 0) { } else if (wholeConf > 0) {
qtyText = `${wholeConf} conf${pkgLabel ? ` (da ${pkgSize}${pkgLabel})` : ''}`; qtyText = `${wholeConf} ${t('units.conf') || 'conf'}${pkgLabel ? ` (${t('units.from') || 'da'} ${pkgSize}${pkgLabel})` : ''}`;
} else if (remainderText) { } else if (remainderText) {
qtyText = remainderAmt >= 1 ? remainderText : t('inventory.qty_trace') || '< 1' + (pkgLabel || ''); qtyText = remainderAmt >= 1 ? remainderText : t('inventory.qty_trace') || '< 1' + (pkgLabel || '');
} else { } else {
qtyText = `${qty} conf`; qtyText = `${Math.round(qty * 10) / 10} ${t('units.conf') || 'conf'}`;
} }
} else { } else {
const unitLabel = unitLabels[item.unit] || item.unit || ''; const unitLabel = unitLabels[item.unit] || item.unit || '';
@@ -3770,7 +3770,7 @@ function quickRecipeSuggestion() {
// Navigate to chat and auto-send a prompt about expiring products // Navigate to chat and auto-send a prompt about expiring products
showPage('chat'); showPage('chat');
setTimeout(() => { setTimeout(() => {
document.getElementById('chat-input').value = 'Suggeriscimi una ricetta veloce PER UNA PERSONA usando i prodotti che scadono prima! Ignora i prodotti in freezer (hanno scadenze molto lunghe), concentrati su frigo e dispensa.'; document.getElementById('chat-input').value = t('chat.quick_recipe_prompt') || 'Suggeriscimi una ricetta veloce PER UNA PERSONA usando i prodotti che scadono prima! Ignora i prodotti in freezer (hanno scadenze molto lunghe), concentrati su frigo e dispensa.';
sendChatMessage(); sendChatMessage();
}, 500); }, 500);
} }
@@ -4348,7 +4348,7 @@ async function explainBannerAnomaly() {
} }
} catch (e) { } catch (e) {
detailEl.innerHTML = originalHtml; detailEl.innerHTML = originalHtml;
showToast('Errore AI', 'error'); showToast(t('error.generic'), 'error');
} }
} }
@@ -4432,7 +4432,7 @@ function bannerFinishAll() {
showToast(t('toast.finished_all').replace('{name}', item.name), 'success'); showToast(t('toast.finished_all').replace('{name}', item.name), 'success');
showLowStockBringPrompt(res, () => loadDashboard()); showLowStockBringPrompt(res, () => loadDashboard());
} else { } else {
showToast(res.error || 'Errore', 'error'); showToast(res.error || t('error.generic'), 'error');
} }
}).catch(() => showToast(t('error.connection'), 'error')); }).catch(() => showToast(t('error.connection'), 'error'));
} }
@@ -4637,8 +4637,8 @@ function _pzFractionLabel(n) {
function formatQuantity(qty, unit, defaultQty, packageUnit) { function formatQuantity(qty, unit, defaultQty, packageUnit) {
if (!qty && qty !== 0) return ''; if (!qty && qty !== 0) return '';
const n = parseFloat(qty); const n = parseFloat(qty);
const unitLabels = { 'pz': 'pz', 'g': 'g', 'ml': 'ml', 'conf': 'conf' }; const unitLabels = { 'pz': t('units.pz'), 'g': 'g', 'ml': 'ml', 'conf': t('units.conf') };
const label = unitLabels[unit] || unit || 'pz'; const label = unitLabels[unit] || unit || t('units.pz');
// Special handling for conf with partial packages // Special handling for conf with partial packages
if (unit === 'conf' && packageUnit && defaultQty > 0) { if (unit === 'conf' && packageUnit && defaultQty > 0) {
@@ -4647,11 +4647,11 @@ function formatQuantity(qty, unit, defaultQty, packageUnit) {
const fractionalConf = Math.round((n - wholeConf) * 1000) / 1000; const fractionalConf = Math.round((n - wholeConf) * 1000) / 1000;
if (fractionalConf < 0.01) { if (fractionalConf < 0.01) {
return `${wholeConf} conf <span class="conf-size-info">(da ${defaultQty}${pkgLabel})</span>`; return `${wholeConf} ${t('units.conf') || 'conf'} <span class="conf-size-info">(${t('units.from') || 'da'} ${defaultQty}${pkgLabel})</span>`;
} }
const remainderText = formatSubRemainder(fractionalConf * defaultQty, packageUnit); const remainderText = formatSubRemainder(fractionalConf * defaultQty, packageUnit);
if (wholeConf > 0) { if (wholeConf > 0) {
return `${wholeConf} conf <span class="conf-size-info">(da ${defaultQty}${pkgLabel})</span> + ${remainderText}`; return `${wholeConf} ${t('units.conf') || 'conf'} <span class="conf-size-info">(${t('units.from') || 'da'} ${defaultQty}${pkgLabel})</span> + ${remainderText}`;
} }
return remainderText; return remainderText;
} }
@@ -4667,8 +4667,8 @@ function formatQuantity(qty, unit, defaultQty, packageUnit) {
// Returns { mainQty: '10', unitLabel: 'conf', packageDetail: 'da 36g', fraction: '¼' } // Returns { mainQty: '10', unitLabel: 'conf', packageDetail: 'da 36g', fraction: '¼' }
function formatQuantityParts(qty, unit, defaultQty, packageUnit) { function formatQuantityParts(qty, unit, defaultQty, packageUnit) {
const n = parseFloat(qty) || 0; const n = parseFloat(qty) || 0;
const unitLabels = { 'pz': 'pz', 'g': 'g', 'ml': 'ml', 'conf': 'conf' }; const unitLabels = { 'pz': t('units.pz'), 'g': 'g', 'ml': 'ml', 'conf': t('units.conf') };
const label = unitLabels[unit] || unit || 'pz'; const label = unitLabels[unit] || unit || t('units.pz');
// Special handling for conf with partial packages // Special handling for conf with partial packages
if (unit === 'conf' && packageUnit && defaultQty > 0) { if (unit === 'conf' && packageUnit && defaultQty > 0) {
@@ -4677,11 +4677,11 @@ function formatQuantityParts(qty, unit, defaultQty, packageUnit) {
const fractionalConf = Math.round((n - wholeConf) * 1000) / 1000; const fractionalConf = Math.round((n - wholeConf) * 1000) / 1000;
if (fractionalConf < 0.01) { if (fractionalConf < 0.01) {
return { mainQty: `${wholeConf}`, unitLabel: 'conf', packageDetail: `da ${defaultQty}${pkgLabel}`, fraction: '' }; return { mainQty: `${wholeConf}`, unitLabel: t('units.conf') || 'conf', packageDetail: `${t('units.from') || 'da'} ${defaultQty}${pkgLabel}`, fraction: '' };
} }
const remainderText = formatSubRemainder(fractionalConf * defaultQty, packageUnit); const remainderText = formatSubRemainder(fractionalConf * defaultQty, packageUnit);
if (wholeConf > 0) { if (wholeConf > 0) {
return { mainQty: `${wholeConf}`, unitLabel: 'conf', packageDetail: `da ${defaultQty}${pkgLabel}`, fraction: `+ ${remainderText}` }; return { mainQty: `${wholeConf}`, unitLabel: t('units.conf') || 'conf', packageDetail: `${t('units.from') || 'da'} ${defaultQty}${pkgLabel}`, fraction: `+ ${remainderText}` };
} }
return { mainQty: remainderText, unitLabel: '', packageDetail: '', fraction: '' }; return { mainQty: remainderText, unitLabel: '', packageDetail: '', fraction: '' };
} }
@@ -4978,9 +4978,9 @@ function showItemDetail(inventoryId, productId) {
</div> </div>
</div> </div>
<div class="modal-actions"> <div class="modal-actions">
<button class="btn btn-danger flex-1" onclick="quickUse(${item.product_id}, '${item.location}')">📤 Usa</button> <button class="btn btn-danger flex-1" onclick="quickUse(${item.product_id}, '${item.location}')">📤 ${t('btn.use')}</button>
<button class="btn btn-primary flex-1" onclick="editInventoryItem(${inventoryId})"> Modifica</button> <button class="btn btn-primary flex-1" onclick="editInventoryItem(${inventoryId})"> ${t('btn.edit_item')}</button>
<button class="btn btn-accent flex-1" onclick="closeModal();generateRecipeForIngredient(${JSON.stringify(item.name)})">🍳 Ricetta</button> <button class="btn btn-accent flex-1" data-name="${escapeHtml(item.name)}" onclick="closeModal();generateRecipeForIngredient(this.dataset.name)">🍳 ${t('action.create_recipe_btn')}</button>
<button class="btn btn-secondary" onclick="deleteInventoryItem(${inventoryId})" style="padding:12px">🗑</button> <button class="btn btn-secondary" onclick="deleteInventoryItem(${inventoryId})" style="padding:12px">🗑</button>
</div> </div>
`; `;
@@ -5091,7 +5091,7 @@ function editInventoryItem(id) {
// Rebuild modal content for editing (don't close and reopen - just replace content) // Rebuild modal content for editing (don't close and reopen - just replace content)
document.getElementById('modal-content').innerHTML = ` document.getElementById('modal-content').innerHTML = `
<div class="modal-header"> <div class="modal-header">
<h3>Modifica ${escapeHtml(item.name)}</h3> <h3>${t('edit.title').replace('{name}', escapeHtml(item.name))}</h3>
<button class="modal-close" onclick="closeModal()"></button> <button class="modal-close" onclick="closeModal()"></button>
</div> </div>
<form class="form" onsubmit="submitEditInventory(event, ${id}, ${item.product_id})"> <form class="form" onsubmit="submitEditInventory(event, ${id}, ${item.product_id})">
@@ -5112,15 +5112,15 @@ function editInventoryItem(id) {
` : ''} ` : ''}
</div> </div>
<div class="form-group"> <div class="form-group">
<label>📏 Unità di misura</label> <label>${t('product.unit_label')}</label>
<select id="edit-unit" class="form-input" onchange="onEditUnitChange()"> <select id="edit-unit" class="form-input" onchange="onEditUnitChange()">
${['pz','g','ml','conf'].map(u => `<option value="${u}" ${(item.unit||'pz') === u ? 'selected' : ''}>${u === 'pz' ? 'pz (pezzi)' : u === 'g' ? 'g (grammi)' : u === 'ml' ? 'ml (millilitri)' : u === 'conf' ? 'conf (confezioni)' : u}</option>`).join('')} ${['pz','g','ml','conf'].map(u => `<option value="${u}" ${(item.unit||'pz') === u ? 'selected' : ''}>${u === 'pz' ? 'pz (' + t('units.pieces') + ')' : u === 'g' ? 'g (' + t('units.grams') + ')' : u === 'ml' ? 'ml (' + t('units.millilitres') + ')' : u === 'conf' ? 'conf (' + t('units.boxes') + ')' : u}</option>`).join('')}
</select> </select>
</div> </div>
<div class="form-group" id="edit-conf-size-group" style="display:${isConf ? 'block' : 'none'}"> <div class="form-group" id="edit-conf-size-group" style="display:${isConf ? 'block' : 'none'}">
<label>📦 Ogni confezione contiene:</label> <label>${t('product.conf_size_label')}</label>
<div class="conf-size-inputs"> <div class="conf-size-inputs">
<input type="number" id="edit-conf-size" class="form-input conf-size-input" min="1" step="any" value="${confSizeVal}" placeholder="es. 300"> <input type="number" id="edit-conf-size" class="form-input conf-size-input" min="1" step="any" value="${confSizeVal}" placeholder="${t('product.conf_size_placeholder')}">
<select id="edit-conf-unit" class="form-input conf-size-unit"> <select id="edit-conf-unit" class="form-input conf-size-unit">
${['g','ml'].map(u => `<option value="${u}" ${confUnitVal === u ? 'selected' : ''}>${u}</option>`).join('')} ${['g','ml'].map(u => `<option value="${u}" ${confUnitVal === u ? 'selected' : ''}>${u}</option>`).join('')}
</select> </select>
@@ -5183,7 +5183,7 @@ async function submitEditInventory(e, id, productId) {
await api('inventory_update', {}, 'POST', payload); await api('inventory_update', {}, 'POST', payload);
closeModal(); closeModal();
showToast('Aggiornato!', 'success'); showToast(t('toast.updated'), 'success');
if (_bannerEditPending) { if (_bannerEditPending) {
_bannerEditPending = false; _bannerEditPending = false;
// Mark the item as confirmed so it does NOT reappear in the banner // Mark the item as confirmed so it does NOT reappear in the banner
@@ -5661,12 +5661,12 @@ async function onBarcodeDetected(barcode) {
// Build rich notes with all available info // Build rich notes with all available info
const notesParts = []; const notesParts = [];
if (p.quantity_info) notesParts.push(`Peso: ${p.quantity_info}`); if (p.quantity_info) notesParts.push(`${t('product.weight_label')}: ${p.quantity_info}`);
if (p.nutriscore) notesParts.push(`Nutriscore: ${p.nutriscore.toUpperCase()}`); if (p.nutriscore) notesParts.push(`Nutriscore: ${p.nutriscore.toUpperCase()}`);
if (p.nova_group) notesParts.push(`NOVA: ${p.nova_group}`); if (p.nova_group) notesParts.push(`NOVA: ${p.nova_group}`);
if (p.ecoscore) notesParts.push(`Ecoscore: ${p.ecoscore.toUpperCase()}`); if (p.ecoscore) notesParts.push(`Ecoscore: ${p.ecoscore.toUpperCase()}`);
if (p.origin) notesParts.push(`Origine: ${p.origin}`); if (p.origin) notesParts.push(`${t('product.origin_label')}: ${p.origin}`);
if (p.labels) notesParts.push(`Etichette: ${p.labels}`); if (p.labels) notesParts.push(`${t('product.labels_label')}: ${p.labels}`);
// Save to local DB // Save to local DB
const saveResult = await api('product_save', {}, 'POST', { const saveResult = await api('product_save', {}, 'POST', {
@@ -6307,7 +6307,7 @@ function showProductAction() {
${currentProduct.weight_info ? `<p style="font-size:0.85rem;color:var(--text-light)">⚖️ ${escapeHtml(currentProduct.weight_info)}</p>` : ''} ${currentProduct.weight_info ? `<p style="font-size:0.85rem;color:var(--text-light)">⚖️ ${escapeHtml(currentProduct.weight_info)}</p>` : ''}
${currentProduct.barcode ? `<p style="font-size:0.75rem;color:var(--text-muted)">📊 ${currentProduct.barcode}</p>` : ''} ${currentProduct.barcode ? `<p style="font-size:0.75rem;color:var(--text-muted)">📊 ${currentProduct.barcode}</p>` : ''}
</div> </div>
<button type="button" class="btn-edit-inline" onclick="toggleActionEdit()" title="Modifica nome/marca"></button> <button type="button" class="btn-edit-inline" onclick="toggleActionEdit()" title="${t('product.edit_name_brand')}"></button>
`; `;
// Check if product needs editing (unknown name, missing info) // Check if product needs editing (unknown name, missing info)
@@ -6331,7 +6331,7 @@ function showProductAction() {
editInfoEl.innerHTML = ` editInfoEl.innerHTML = `
<div class="edit-unknown-card ${isUnknown ? 'highlight' : ''}"> <div class="edit-unknown-card ${isUnknown ? 'highlight' : ''}">
<h4>${isUnknown ? '⚠️ Prodotto non riconosciuto' : '✏️ Modifica informazioni'}</h4> <h4>${isUnknown ? '⚠️ ' + t('product.unknown_product') : '✏️ ' + t('product.edit_info')}</h4>
${isUnknown ? '<p class="edit-unknown-hint">Inserisci il nome e le informazioni del prodotto</p>' : ''} ${isUnknown ? '<p class="edit-unknown-hint">Inserisci il nome e le informazioni del prodotto</p>' : ''}
<div class="edit-unknown-form"> <div class="edit-unknown-form">
<div class="form-group"> <div class="form-group">
@@ -6339,13 +6339,13 @@ function showProductAction() {
<input type="text" id="edit-action-name" class="form-input" value="${escapeHtml(isUnknown ? '' : currentProduct.name)}" placeholder="Es: Latte intero, Pasta penne..." required> <input type="text" id="edit-action-name" class="form-input" value="${escapeHtml(isUnknown ? '' : currentProduct.name)}" placeholder="Es: Latte intero, Pasta penne..." required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>🏪 Marca</label> <label>${t('product.brand_label')}</label>
<input type="text" id="edit-action-brand" class="form-input" value="${escapeHtml(currentProduct.brand || '')}" placeholder="Es: Barilla, Mulino Bianco..."> <input type="text" id="edit-action-brand" class="form-input" value="${escapeHtml(currentProduct.brand || '')}" placeholder="Es: Barilla, Mulino Bianco...">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>📂 Categoria</label> <label>${t('product.category_label')}</label>
<select id="edit-action-category" class="form-input"> <select id="edit-action-category" class="form-input">
<option value="">-- Seleziona --</option> <option value="">${t('form.select_placeholder')}</option>
${categoryOptions} ${categoryOptions}
</select> </select>
</div> </div>
@@ -6445,7 +6445,7 @@ function showProductAction() {
<span class="btn-icon"></span> <span class="btn-icon"></span>
<span class="btn-text">${t('product.modify_details')}<br><small>${t('action.edit_sub')}</small></span> <span class="btn-text">${t('product.modify_details')}<br><small>${t('action.edit_sub')}</small></span>
</button> </button>
<button class="btn btn-recipe-from-ingredient" onclick="generateRecipeForIngredient(${JSON.stringify(currentProduct.name)})"> <button class="btn btn-recipe-from-ingredient" data-name="${escapeHtml(currentProduct.name)}" onclick="generateRecipeForIngredient(this.dataset.name)">
👨🍳 ${t('action.create_recipe_btn') || 'Crea una ricetta'} 👨🍳 ${t('action.create_recipe_btn') || 'Crea una ricetta'}
</button> </button>
`; `;
@@ -6457,7 +6457,7 @@ function showProductAction() {
catalogLink.style.cssText = 'text-align:center;margin-top:6px'; catalogLink.style.cssText = 'text-align:center;margin-top:6px';
btnsContainer.after(catalogLink); btnsContainer.after(catalogLink);
} }
catalogLink.innerHTML = `<button type="button" class="btn-link-small" onclick="editProductFromAction()">⚙️ Modifica scheda prodotto (nome, marca, categoria…)</button>`; catalogLink.innerHTML = `<button type="button" class="btn-link-small" onclick="editProductFromAction()">${t('product.edit_catalog')}</button>`;
} else { } else {
// Product NOT in inventory - show only AGGIUNGI // Product NOT in inventory - show only AGGIUNGI
statusBar.style.display = 'none'; statusBar.style.display = 'none';
@@ -6561,7 +6561,7 @@ function editProductFromAction() {
function openInventoryEdit() { function openInventoryEdit() {
const items = _actionInventoryItems; const items = _actionInventoryItems;
if (!items || items.length === 0) { if (!items || items.length === 0) {
showToast('Nessuna voce di inventario trovata', 'error'); showToast(t('error.no_inventory_entry') || 'Nessuna voce di inventario trovata', 'error');
return; return;
} }
if (items.length === 1) { if (items.length === 1) {
@@ -6572,10 +6572,10 @@ function openInventoryEdit() {
const contentEl = document.getElementById('modal-content'); const contentEl = document.getElementById('modal-content');
contentEl.innerHTML = ` contentEl.innerHTML = `
<div class="modal-header"> <div class="modal-header">
<h3> Quale modifica?</h3> <h3> ${t('edit.choose_location_title')}</h3>
<button class="modal-close" onclick="closeModal()"></button> <button class="modal-close" onclick="closeModal()"></button>
</div> </div>
<p style="font-size:0.9rem;color:var(--text-muted);margin:0 0 12px">Scegli la posizione da modificare:</p> <p style="font-size:0.9rem;color:var(--text-muted);margin:0 0 12px">${t('edit.choose_location_hint')}</p>
<div style="display:flex;flex-direction:column;gap:8px"> <div style="display:flex;flex-direction:column;gap:8px">
${items.map(inv => { ${items.map(inv => {
const locInfo = LOCATIONS[inv.location] || { icon: '📦', label: inv.location }; const locInfo = LOCATIONS[inv.location] || { icon: '📦', label: inv.location };
@@ -6610,7 +6610,7 @@ function editActionInventoryItem(inventoryId) {
document.getElementById('modal-content').innerHTML = ` document.getElementById('modal-content').innerHTML = `
<div class="modal-header"> <div class="modal-header">
<h3>Modifica ${escapeHtml(item.name || currentProduct.name)}</h3> <h3>${t('edit.title').replace('{name}', escapeHtml(item.name || currentProduct.name))}</h3>
<button class="modal-close" onclick="closeModal()"></button> <button class="modal-close" onclick="closeModal()"></button>
</div> </div>
<form class="form" onsubmit="submitActionEditInventory(event, ${inventoryId}, ${item.product_id})"> <form class="form" onsubmit="submitActionEditInventory(event, ${inventoryId}, ${item.product_id})">
@@ -6625,13 +6625,13 @@ function editActionInventoryItem(inventoryId) {
<div class="form-group"> <div class="form-group">
<label>${t('product.unit_label')}</label> <label>${t('product.unit_label')}</label>
<select id="action-edit-unit" class="form-input" onchange="onActionEditUnitChange()"> <select id="action-edit-unit" class="form-input" onchange="onActionEditUnitChange()">
${['pz','g','ml','conf'].map(u => `<option value="${u}" ${(item.unit||'pz') === u ? 'selected' : ''}>${u === 'pz' ? 'pz (pezzi)' : u === 'g' ? 'g (grammi)' : u === 'ml' ? 'ml (millilitri)' : u === 'conf' ? 'conf (confezioni)' : u}</option>`).join('')} ${['pz','g','ml','conf'].map(u => `<option value="${u}" ${(item.unit||'pz') === u ? 'selected' : ''}>${u === 'pz' ? 'pz (' + t('units.pieces') + ')' : u === 'g' ? 'g (' + t('units.grams') + ')' : u === 'ml' ? 'ml (' + t('units.millilitres') + ')' : u === 'conf' ? 'conf (' + t('units.boxes') + ')' : u}</option>`).join('')}
</select> </select>
</div> </div>
<div class="form-group" id="action-edit-conf-group" style="display:${isConf ? 'block' : 'none'}"> <div class="form-group" id="action-edit-conf-group" style="display:${isConf ? 'block' : 'none'}">
<label>📦 Ogni confezione contiene:</label> <label>${t('product.conf_size_label')}</label>
<div class="conf-size-inputs"> <div class="conf-size-inputs">
<input type="number" id="action-edit-conf-size" class="form-input conf-size-input" min="1" step="any" value="${confSizeVal}" placeholder="es. 300"> <input type="number" id="action-edit-conf-size" class="form-input conf-size-input" min="1" step="any" value="${confSizeVal}" placeholder="${t('product.conf_size_placeholder')}">
<select id="action-edit-conf-unit" class="form-input conf-size-unit"> <select id="action-edit-conf-unit" class="form-input conf-size-unit">
${['g','ml'].map(u => `<option value="${u}" ${confUnitVal === u ? 'selected' : ''}>${u}</option>`).join('')} ${['g','ml'].map(u => `<option value="${u}" ${confUnitVal === u ? 'selected' : ''}>${u}</option>`).join('')}
</select> </select>
@@ -6695,7 +6695,7 @@ async function submitActionEditInventory(e, id, productId) {
await api('inventory_update', {}, 'POST', payload); await api('inventory_update', {}, 'POST', payload);
closeModal(); closeModal();
showToast('Aggiornato!', 'success'); showToast(t('toast.updated'), 'success');
showProductAction(); // Refresh the action page showProductAction(); // Refresh the action page
} }
@@ -6874,7 +6874,7 @@ async function throwAll() {
showToast(t('toast.thrown_away', { name: currentProduct.name }), 'success'); showToast(t('toast.thrown_away', { name: currentProduct.name }), 'success');
showPage('dashboard'); showPage('dashboard');
} else { } else {
showToast(result.error || 'Errore', 'error'); showToast(result.error || t('error.generic'), 'error');
} }
} catch(e) { } catch(e) {
showLoading(false); showLoading(false);
@@ -6902,7 +6902,7 @@ async function throwPartial() {
showToast(t('toast.thrown_away_partial', { qty, unit: currentProduct.unit || 'pz', name: currentProduct.name }), 'success'); showToast(t('toast.thrown_away_partial', { qty, unit: currentProduct.unit || 'pz', name: currentProduct.name }), 'success');
showPage('dashboard'); showPage('dashboard');
} else { } else {
showToast(result.error || 'Errore', 'error'); showToast(result.error || t('error.generic'), 'error');
} }
} catch(e) { } catch(e) {
showLoading(false); showLoading(false);
@@ -7120,7 +7120,7 @@ function recalculateAddExpiry() {
if (window._historyExpiryDays) suffix = ' (da storico)'; if (window._historyExpiryDays) suffix = ' (da storico)';
else if (loc === 'freezer' && isVacuum) suffix = ' ' + t('add.suffix_freezer_vacuum'); else if (loc === 'freezer' && isVacuum) suffix = ' ' + t('add.suffix_freezer_vacuum');
else if (loc === 'freezer') suffix = ' (freezer)'; else if (loc === 'freezer') suffix = ' (freezer)';
else if (isVacuum) suffix = ' (sotto vuoto)'; else if (isVacuum) suffix = ' ' + t('add.suffix_vacuum');
const expiryInput = document.getElementById('add-expiry'); const expiryInput = document.getElementById('add-expiry');
const estimateEl = document.querySelector('.expiry-estimate-label'); const estimateEl = document.querySelector('.expiry-estimate-label');
@@ -7368,12 +7368,12 @@ function selectPurchaseType(btn, type) {
} else { } else {
detailDiv.innerHTML = ` detailDiv.innerHTML = `
<div class="form-group"> <div class="form-group">
<label>📅 Quando scade?</label> <label>${t('inventory.label_expiry')}</label>
<div class="expiry-input-row"> <div class="expiry-input-row">
<input type="date" id="add-expiry" class="form-input" value=""> <input type="date" id="add-expiry" class="form-input" value="">
<button type="button" class="btn btn-accent btn-scan-expiry" onclick="scanExpiryWithAI()" title="${t('add.scan_expiry_title')}">📷</button> <button type="button" class="btn btn-accent btn-scan-expiry" onclick="scanExpiryWithAI()" title="${t('add.scan_expiry_title')}">📷</button>
</div> </div>
<p class="form-hint">Inserisci la data di scadenza o scansionala</p> <p class="form-hint">${t('add.expiry_hint')}</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>${t('add.remaining_label')}</label> <label>${t('add.remaining_label')}</label>
@@ -7494,7 +7494,7 @@ async function submitAdd(e) {
let qtyInfo = ''; let qtyInfo = '';
if (result.total_qty) { if (result.total_qty) {
const u = result.unit || 'pz'; const u = result.unit || 'pz';
const unitLabels = { 'pz': 'pz', 'g': 'g', 'ml': 'ml', 'conf': 'conf' }; const unitLabels = { 'pz': t('units.pz'), 'g': 'g', 'ml': 'ml', 'conf': t('units.conf') };
const uLabel = unitLabels[u] || u; const uLabel = unitLabels[u] || u;
if (u === 'conf' && result.package_unit && result.default_quantity > 0) { if (u === 'conf' && result.package_unit && result.default_quantity > 0) {
const pkgLabel = unitLabels[result.package_unit] || result.package_unit; const pkgLabel = unitLabels[result.package_unit] || result.package_unit;
@@ -7547,7 +7547,7 @@ async function submitAdd(e) {
window._addExtraBatches = []; window._addExtraBatches = [];
} }
} else { } else {
showToast(result.error || 'Errore', 'error'); showToast(result.error || t('error.generic'), 'error');
} }
} catch (err) { } catch (err) {
showLoading(false); showLoading(false);
@@ -8082,9 +8082,9 @@ function _showVacuumPrompt(openedId, wasVacuumSealed) {
'width:calc(100% - 32px)', 'box-sizing:border-box', 'overflow:hidden' 'width:calc(100% - 32px)', 'box-sizing:border-box', 'overflow:hidden'
].join(';'); ].join(';');
bar.innerHTML = ` bar.innerHTML = `
<span style="flex:1;font-size:0.9rem;line-height:1.3">🔒 Messo <b>sotto vuoto</b>?</span> <span style="flex:1;font-size:0.9rem;line-height:1.3">${t('add.vacuum_question')}</span>
<button id="_vac-yes" style="background:#22c55e;color:#fff;border:none;border-radius:8px;padding:7px 14px;font-weight:700;cursor:pointer;white-space:nowrap"></button> <button id="_vac-yes" style="background:#22c55e;color:#fff;border:none;border-radius:8px;padding:7px 14px;font-weight:700;cursor:pointer;white-space:nowrap">${t('btn.yes_short')}</button>
<button id="_vac-no" style="background:#475569;color:#fff;border:none;border-radius:8px;padding:7px 14px;font-weight:700;cursor:pointer;white-space:nowrap">No</button> <button id="_vac-no" style="background:#475569;color:#fff;border:none;border-radius:8px;padding:7px 14px;font-weight:700;cursor:pointer;white-space:nowrap">${t('btn.no_short')}</button>
<div id="_vac-bar" style="position:absolute;bottom:0;left:0;height:3px;background:#60a5fa;border-radius:0;width:100%"></div> <div id="_vac-bar" style="position:absolute;bottom:0;left:0;height:3px;background:#60a5fa;border-radius:0;width:100%"></div>
`; `;
document.body.appendChild(bar); document.body.appendChild(bar);
@@ -8100,7 +8100,7 @@ function _showVacuumPrompt(openedId, wasVacuumSealed) {
if (rafH) cancelAnimationFrame(rafH); if (rafH) cancelAnimationFrame(rafH);
bar.remove(); bar.remove();
api('inventory_update', {}, 'POST', { id: openedId, vacuum_sealed: vacuum ? 1 : 0 }) api('inventory_update', {}, 'POST', { id: openedId, vacuum_sealed: vacuum ? 1 : 0 })
.then(() => { if (vacuum) showToast('🔒 Sotto vuoto registrato', 'success'); }) .then(() => { if (vacuum) showToast(t('add.vacuum_saved'), 'success'); })
.catch(() => {}); .catch(() => {});
} }
@@ -8322,7 +8322,7 @@ function showMoveAfterUseModal(product, fromLoc, remaining, openedId, openedVacu
const vacuumRow = ` const vacuumRow = `
<label style="display:flex;align-items:center;gap:8px;margin-top:12px;cursor:pointer"> <label style="display:flex;align-items:center;gap:8px;margin-top:12px;cursor:pointer">
<input type="checkbox" id="move-vacuum-check" ${wasVacuum ? 'checked' : ''}> <input type="checkbox" id="move-vacuum-check" ${wasVacuum ? 'checked' : ''}>
<span>🔒 Metti <b>sotto vuoto</b> il resto${wasVacuum ? ' (era già sigillato)' : ''}</span> <span>${t('move.vacuum_seal_rest')}${wasVacuum ? ' ' + t('move.was_sealed') : ''}</span>
</label>`; </label>`;
document.getElementById('modal-content').innerHTML = ` document.getElementById('modal-content').innerHTML = `
<div class="modal-header"> <div class="modal-header">
@@ -8354,7 +8354,7 @@ async function _saveVacuumAndStay(openedId) {
const isVacuum = document.getElementById('move-vacuum-check')?.checked ? 1 : 0; const isVacuum = document.getElementById('move-vacuum-check')?.checked ? 1 : 0;
try { try {
await api('inventory_update', {}, 'POST', { id: openedId, vacuum_sealed: isVacuum }); await api('inventory_update', {}, 'POST', { id: openedId, vacuum_sealed: isVacuum });
if (isVacuum) showToast('🔒 Sotto vuoto registrato', 'success'); if (isVacuum) showToast(t('add.vacuum_saved'), 'success');
} catch (_) {} } catch (_) {}
} }
showPage('dashboard'); showPage('dashboard');
@@ -8448,7 +8448,7 @@ async function _doSubmitUseAll() {
} }
showLowStockBringPrompt(result, () => showPage('dashboard')); showLowStockBringPrompt(result, () => showPage('dashboard'));
} else { } else {
showToast(result.error || 'Errore', 'error'); showToast(result.error || t('error.generic'), 'error');
} }
} catch (err) { } catch (err) {
showLoading(false); showLoading(false);
@@ -8534,7 +8534,7 @@ async function _submitUseAllAt(location, isOpenedOnly) {
} }
showLowStockBringPrompt(result, () => showPage('dashboard')); showLowStockBringPrompt(result, () => showPage('dashboard'));
} else { } else {
showToast(result.error || 'Errore', 'error'); showToast(result.error || t('error.generic'), 'error');
} }
} catch (err) { } catch (err) {
showLoading(false); showLoading(false);
@@ -8603,7 +8603,7 @@ async function submitUse(e) {
} else if (result.duplicate) { } else if (result.duplicate) {
// Silently ignore: this was a scale double-trigger, not a real error // Silently ignore: this was a scale double-trigger, not a real error
} else { } else {
showToast(result.error || 'Errore', 'error'); showToast(result.error || t('error.generic'), 'error');
} }
} catch (err) { } catch (err) {
showLoading(false); showLoading(false);
@@ -8693,7 +8693,7 @@ async function analyzeWithAI() {
if (!result.success) { if (!result.success) {
if (result.error === 'no_api_key') { if (result.error === 'no_api_key') {
resultDiv.innerHTML = `<p style="color:var(--warning)">⚠️ Chiave API Gemini non configurata.<br><small>Aggiungi GEMINI_API_KEY nel file .env sul server.</small></p>`; resultDiv.innerHTML = `<p style="color:var(--warning)">${t('ai.no_api_key').replace(/\n/g, '<br>')}</p>`;
} else if (/resource.?exhaust|quota|rate.?limit/i.test(result.error || '')) { } else if (/resource.?exhaust|quota|rate.?limit/i.test(result.error || '')) {
resultDiv.innerHTML = `<p style="color:var(--warning)">⏳ ${t('error.ai_quota')}</p> resultDiv.innerHTML = `<p style="color:var(--warning)">⏳ ${t('error.ai_quota')}</p>
<button class="btn btn-secondary full-width mt-2" onclick="retakePhotoAI()">${t('btn.retry')}</button>`; <button class="btn btn-secondary full-width mt-2" onclick="retakePhotoAI()">${t('btn.retry')}</button>`;
@@ -8830,11 +8830,11 @@ async function selectAIMatch(idx) {
const detected = detectUnitAndQuantity(p.quantity_info); const detected = detectUnitAndQuantity(p.quantity_info);
const notesParts = []; const notesParts = [];
if (p.quantity_info) notesParts.push(`Peso: ${p.quantity_info}`); if (p.quantity_info) notesParts.push(`${t('product.weight_label')}: ${p.quantity_info}`);
if (p.nutriscore) notesParts.push(`Nutriscore: ${p.nutriscore.toUpperCase()}`); if (p.nutriscore) notesParts.push(`Nutriscore: ${p.nutriscore.toUpperCase()}`);
if (p.nova_group) notesParts.push(`NOVA: ${p.nova_group}`); if (p.nova_group) notesParts.push(`NOVA: ${p.nova_group}`);
if (p.ecoscore) notesParts.push(`Ecoscore: ${p.ecoscore.toUpperCase()}`); if (p.ecoscore) notesParts.push(`Ecoscore: ${p.ecoscore.toUpperCase()}`);
if (p.origin) notesParts.push(`Origine: ${p.origin}`); if (p.origin) notesParts.push(`${t('product.origin_label')}: ${p.origin}`);
const saveResult = await api('product_save', {}, 'POST', { const saveResult = await api('product_save', {}, 'POST', {
barcode: match.barcode, barcode: match.barcode,
@@ -9040,7 +9040,7 @@ async function _pfAiAnalyze(base64) {
html += `</div>`; html += `</div>`;
if (matches.length > 0) { if (matches.length > 0) {
html += `<p style="font-size:0.82rem;color:var(--text-muted);margin-bottom:6px">Seleziona la variante esatta o usa i dati AI:</p>`; html += `<p style="font-size:0.82rem;color:var(--text-muted);margin-bottom:6px">${t('product.select_variant')}</p>`;
html += `<div class="ai-matches-list" style="max-height:160px;overflow-y:auto;margin-bottom:10px">`; html += `<div class="ai-matches-list" style="max-height:160px;overflow-y:auto;margin-bottom:10px">`;
matches.forEach((m, idx) => { matches.forEach((m, idx) => {
html += `<div class="ai-match-item" onclick="_pfAiFillFromMatch(${idx})">`; html += `<div class="ai-match-item" onclick="_pfAiFillFromMatch(${idx})">`;
@@ -9184,7 +9184,7 @@ async function selectProductForAction(productId) {
} }
} catch (err) { } catch (err) {
showLoading(false); showLoading(false);
showToast('Errore', 'error'); showToast(t('error.generic'), 'error');
} }
} }
@@ -10164,10 +10164,10 @@ async function migrateBringNames(btn) {
showToast(t('shopping.names_already_updated'), 'info'); showToast(t('shopping.names_already_updated'), 'info');
} }
} else { } else {
if (statusEl) statusEl.textContent = '❌ ' + (data.error || 'Errore'); if (statusEl) statusEl.textContent = '❌ ' + (data.error || t('error.unknown'));
} }
} catch(e) { } catch(e) {
if (statusEl) statusEl.textContent = '❌ Errore di connessione'; if (statusEl) statusEl.textContent = '❌ ' + t('scale.error_connect');
} }
if (btn) btn.disabled = false; if (btn) btn.disabled = false;
} }
@@ -10224,7 +10224,7 @@ async function addSmartToBring() {
// Reload to refresh badges // Reload to refresh badges
loadShoppingList(); loadShoppingList();
} else { } else {
showToast(result.error || 'Errore', 'error'); showToast(result.error || t('error.generic'), 'error');
} }
} catch (e) { } catch (e) {
showLoading(false); showLoading(false);
@@ -10997,7 +10997,7 @@ async function analyzeExpiryImage(dataUrl) {
// Close modal after delay // Close modal after delay
setTimeout(() => closeExpiryScanner(), 1500); setTimeout(() => closeExpiryScanner(), 1500);
} else if (result.error === 'no_api_key') { } else if (result.error === 'no_api_key') {
statusDiv.innerHTML = `<p style="color:var(--warning)">⚠️ Chiave API Gemini non configurata.<br><small>Aggiungi GEMINI_API_KEY nel file .env sul server.</small></p>`; statusDiv.innerHTML = `<p style="color:var(--warning)">${t('ai.no_api_key').replace(/\n/g, '<br>')}</p>`;
} else { } else {
statusDiv.innerHTML = `<p style="color:var(--danger)">❌ Non riesco a leggere la data. ${result.raw_text ? '<br><small>Letto: ' + escapeHtml(result.raw_text) + '</small>' : ''}</p> statusDiv.innerHTML = `<p style="color:var(--danger)">❌ Non riesco a leggere la data. ${result.raw_text ? '<br><small>Letto: ' + escapeHtml(result.raw_text) + '</small>' : ''}</p>
<button class="btn btn-secondary" onclick="retakeExpiry()" style="margin-top:8px">${t('btn.retry')}</button>`; <button class="btn btn-secondary" onclick="retakeExpiry()" style="margin-top:8px">${t('btn.retry')}</button>`;
@@ -11071,7 +11071,7 @@ const LOG_PAGE_SIZE = 50;
async function loadLog(more = false) { async function loadLog(more = false) {
if (!more) { if (!more) {
_logOffset = 0; _logOffset = 0;
document.getElementById('log-list').innerHTML = '<p style="text-align:center;color:var(--text-muted)">Caricamento...</p>'; document.getElementById('log-list').innerHTML = '<p style="text-align:center;color:var(--text-muted)">' + t('loading') + '</p>';
} }
try { try {
@@ -11722,7 +11722,7 @@ async function useRecipeIngredient(idx, productId, location, qtyNumber, btn, rec
// Build quantity controls // Build quantity controls
let qtySection = ''; let qtySection = '';
let defaultQtyValue = qtyNumber; let defaultQtyValue = Math.round(qtyNumber * 10) / 10;
if (isConf) { if (isConf) {
const totalConf = items.reduce((s, i) => s + parseFloat(i.quantity), 0); const totalConf = items.reduce((s, i) => s + parseFloat(i.quantity), 0);
@@ -11733,7 +11733,7 @@ async function useRecipeIngredient(idx, productId, location, qtyNumber, btn, rec
// qtyNumber from recipe is in sub-units (g, ml) // qtyNumber from recipe is in sub-units (g, ml)
const step = getSubUnitStep(pkgUnit); const step = getSubUnitStep(pkgUnit);
defaultQtyValue = qtyNumber; defaultQtyValue = (pkgUnit === 'g' || pkgUnit === 'ml') ? Math.round(qtyNumber) : Math.round(qtyNumber * 10) / 10;
qtySection = ` qtySection = `
<div class="use-unit-switch" style="display:flex;margin-bottom:8px"> <div class="use-unit-switch" style="display:flex;margin-bottom:8px">
@@ -11749,7 +11749,7 @@ async function useRecipeIngredient(idx, productId, location, qtyNumber, btn, rec
</div>`; </div>`;
} else { } else {
_recipeUseNormalUnit = unit; _recipeUseNormalUnit = unit;
const unitLabels = { 'pz': 'pz', 'g': 'g', 'ml': 'ml' }; const unitLabels = { 'pz': t('units.pz'), 'g': 'g', 'ml': 'ml' };
const unitLabel = unitLabels[unit] || unit; const unitLabel = unitLabels[unit] || unit;
const inputMin = '0.1'; const inputMin = '0.1';
qtySection = ` qtySection = `
@@ -11961,7 +11961,7 @@ function showRecipeMoveModal(productId, fromLoc, remaining, openedId, wasVacuum)
const vacuumRow = ` const vacuumRow = `
<label style="display:flex;align-items:center;gap:8px;margin-top:12px;cursor:pointer"> <label style="display:flex;align-items:center;gap:8px;margin-top:12px;cursor:pointer">
<input type="checkbox" id="move-vacuum-check" ${wasVacuum ? 'checked' : ''}> <input type="checkbox" id="move-vacuum-check" ${wasVacuum ? 'checked' : ''}>
<span>${wasVacuum ? t('move.vacuum_restore') : '🔒 Metti <b>sotto vuoto</b> il resto'}</span> <span>${wasVacuum ? t('move.vacuum_restore') : t('move.vacuum_seal_rest')}</span>
</label>`; </label>`;
document.getElementById('modal-content').innerHTML = ` document.getElementById('modal-content').innerHTML = `
<div class="modal-header"> <div class="modal-header">
@@ -12076,7 +12076,7 @@ function renderRecipe(r) {
html += `<h3>${t('recipes.ingredients_title')}</h3><ul class="recipe-ingredients">`; html += `<h3>${t('recipes.ingredients_title')}</h3><ul class="recipe-ingredients">`;
(r.ingredients || []).forEach((ing, idx) => { (r.ingredients || []).forEach((ing, idx) => {
if (ing.from_pantry && ing.product_id) { if (ing.from_pantry && ing.product_id) {
const qtyNum = ing.qty_number || 0; const qtyNum = Math.round((ing.qty_number || 0) * 10) / 10;
const loc = (ing.location || 'dispensa').replace(/'/g, "\\'"); const loc = (ing.location || 'dispensa').replace(/'/g, "\\'");
const alreadyUsed = ing.used === true; const alreadyUsed = ing.used === true;
html += `<li class="recipe-ingredient${alreadyUsed ? ' recipe-ing-used' : ''}" id="recipe-ing-${idx}">`; html += `<li class="recipe-ingredient${alreadyUsed ? ' recipe-ing-used' : ''}" id="recipe-ing-${idx}">`;
@@ -12438,7 +12438,7 @@ function renderCookingStep() {
const cookingLocLabels = Object.fromEntries(Object.entries(LOCATIONS).map(([k,v]) => [k, `${v.icon} ${v.label}`])); const cookingLocLabels = Object.fromEntries(Object.entries(LOCATIONS).map(([k,v]) => [k, `${v.icon} ${v.label}`]));
ingsEl.innerHTML = ings.map(ing => { ingsEl.innerHTML = ings.map(ing => {
const loc = (ing.location || 'dispensa').replace(/'/g, "\\'"); const loc = (ing.location || 'dispensa').replace(/'/g, "\\'");
const qtyNum = ing.qty_number || 0; const qtyNum = Math.round((ing.qty_number || 0) * 10) / 10;
// Build info chips: brand, location, expiry // Build info chips: brand, location, expiry
const chips = []; const chips = [];
if (ing.brand) chips.push(`<span class="cooking-ing-chip">${escapeHtml(ing.brand)}</span>`); if (ing.brand) chips.push(`<span class="cooking-ing-chip">${escapeHtml(ing.brand)}</span>`);
@@ -12566,12 +12566,12 @@ function _initBrowserTtsVoices(selectedVoice) {
} }
if (!window.speechSynthesis) { if (!window.speechSynthesis) {
sel.innerHTML = '<option value="">— Voce non supportata dal browser —</option>'; sel.innerHTML = `<option value="">— ${t('settings.tts.voice_not_supported')} —</option>`;
return; return;
} }
// Reset to loading state each time (settings page may be re-opened) // Reset to loading state each time (settings page may be re-opened)
sel.innerHTML = '<option value="">— Caricamento voci… —</option>'; sel.innerHTML = `<option value="">— ${t('settings.tts.voices_loading')} —</option>`;
const populate = () => { const populate = () => {
let voices = []; let voices = [];
@@ -12611,7 +12611,7 @@ function _initBrowserTtsVoices(selectedVoice) {
} else if (tries >= 50) { // 50 × 200ms = 10s } else if (tries >= 50) { // 50 × 200ms = 10s
clearInterval(interval); clearInterval(interval);
if (!window.speechSynthesis.getVoices().length) { if (!window.speechSynthesis.getVoices().length) {
sel.innerHTML = '<option value="">— Nessuna voce disponibile su questo dispositivo —</option>'; sel.innerHTML = `<option value="">— ${t('settings.tts.voices_none')} —</option>`;
} }
} }
}, 200); }, 200);
@@ -12697,23 +12697,23 @@ async function testTTS() {
tts_extra_fields: document.getElementById('setting-tts-extra-fields')?.value || '' tts_extra_fields: document.getElementById('setting-tts-extra-fields')?.value || ''
}; };
if (!formSettings.tts_url) { if (!formSettings.tts_url) {
if (statusEl) { statusEl.style.display = 'block'; statusEl.className = 'settings-status error'; statusEl.textContent = '⚠️ URL endpoint mancante.'; } if (statusEl) { statusEl.style.display = 'block'; statusEl.className = 'settings-status error'; statusEl.textContent = t('settings.tts.url_missing'); }
return; return;
} }
if (statusEl) { statusEl.style.display = 'block'; statusEl.className = 'settings-status'; statusEl.textContent = '⏳ Invio in corso…'; } if (statusEl) { statusEl.style.display = 'block'; statusEl.className = 'settings-status'; statusEl.textContent = t('settings.tts.test_sending'); }
try { try {
const req = _buildTtsRequest('Test vocale EverShelf', formSettings); const req = _buildTtsRequest('Test vocale EverShelf', formSettings);
const res = await _ttsViaProxy(req); const res = await _ttsViaProxy(req);
const data = await res.json().catch(() => ({})); const data = await res.json().catch(() => ({}));
const httpCode = data.status || res.status; const httpCode = data.status || res.status;
if (res.ok && httpCode >= 200 && httpCode < 300) { if (res.ok && httpCode >= 200 && httpCode < 300) {
if (statusEl) { statusEl.className = 'settings-status success'; statusEl.textContent = `✅ Risposta ${httpCode} — controlla che l'altoparlante abbia parlato.`; } if (statusEl) { statusEl.className = 'settings-status success'; statusEl.textContent = t('settings.tts.test_ok').replace('{code}', httpCode); }
} else { } else {
const errDetail = data.error || data.body || res.statusText; const errDetail = data.error || data.body || res.statusText;
if (statusEl) { statusEl.className = 'settings-status error'; statusEl.textContent = `⚠️ HTTP ${httpCode}: ${errDetail}`; } if (statusEl) { statusEl.className = 'settings-status error'; statusEl.textContent = `⚠️ HTTP ${httpCode}: ${errDetail}`; }
} }
} catch(e) { } catch(e) {
if (statusEl) { statusEl.className = 'settings-status error'; statusEl.textContent = `Errore: ${e.message}`; } if (statusEl) { statusEl.className = 'settings-status error'; statusEl.textContent = `${t('error.prefix')}: ${e.message}`; }
} }
} }
@@ -12825,7 +12825,7 @@ function _extractTimerLabel(text, stepNum) {
.replace(/\s+/g, ' ') .replace(/\s+/g, ' ')
.trim(); .trim();
if (!beforeTime) return `Passo ${stepNum + 1}`; if (!beforeTime) return t('cooking.step_fallback').replace('{n}', stepNum + 1);
const actionRules = [ const actionRules = [
{ re: /\b(rosolatur\w*|rosola\w*|soffrigg\w*)\b/i, label: 'Rosolatura' }, { re: /\b(rosolatur\w*|rosola\w*|soffrigg\w*)\b/i, label: 'Rosolatura' },
@@ -12875,11 +12875,11 @@ function _extractTimerLabel(text, stepNum) {
.filter(w => w.length > 2 && !/^\d+$/.test(w) && !fillers.has(w) && !applianceWords.has(w)) .filter(w => w.length > 2 && !/^\d+$/.test(w) && !fillers.has(w) && !applianceWords.has(w))
.slice(0, 3) .slice(0, 3)
.join(' '); .join(' ');
label = fallback || `Passo ${stepNum + 1}`; label = fallback || t('cooking.step_fallback').replace('{n}', stepNum + 1);
} }
label = label.replace(/\s+/g, ' ').trim(); label = label.replace(/\s+/g, ' ').trim();
if (!label) return `Passo ${stepNum + 1}`; if (!label) return t('cooking.step_fallback').replace('{n}', stepNum + 1);
// Keep timer chips compact and readable. // Keep timer chips compact and readable.
const maxLen = 30; const maxLen = 30;
@@ -13394,7 +13394,7 @@ async function chatTransferToRecipes(btn, replyText) {
}); });
if (!result || !result.success || !result.recipe) { if (!result || !result.success || !result.recipe) {
resetBtn(); resetBtn();
showToast('⚠️ ' + (result?.error || t('error.generic') || 'Errore'), 'error'); showToast('⚠️ ' + (result?.error || t('error.generic') || t('error.generic')), 'error');
return; return;
} }
const recipe = result.recipe; const recipe = result.recipe;
@@ -13417,7 +13417,7 @@ async function chatTransferToRecipes(btn, replyText) {
} catch (err) { } catch (err) {
console.error('[chatTransferToRecipes]', err); console.error('[chatTransferToRecipes]', err);
resetBtn(); resetBtn();
showToast('⚠️ ' + (err.message || t('error.connection') || 'Errore di connessione'), 'error'); showToast('⚠️ ' + (err.message || t('error.connection')), 'error');
} }
} }
@@ -13430,10 +13430,10 @@ async function generateRecipeForIngredient(ingredientName) {
const loadingMsg = document.getElementById('recipe-loading-msg'); const loadingMsg = document.getElementById('recipe-loading-msg');
if (loadingMsg) loadingMsg.textContent = '👨‍🍳 ' + (t('recipes.loading_msg') || 'Sto preparando la ricetta...'); if (loadingMsg) loadingMsg.textContent = '👨‍🍳 ' + (t('recipes.loading_msg') || 'Sto preparando la ricetta...');
try { try {
const result = await api('recipe_from_ingredient', {}, 'POST', { ingredient: ingredientName }); const result = await api('recipe_from_ingredient', {}, 'POST', { ingredient: ingredientName, lang: _currentLang });
if (!result || !result.success || !result.recipe) { if (!result || !result.success || !result.recipe) {
document.getElementById('recipe-overlay').style.display = 'none'; document.getElementById('recipe-overlay').style.display = 'none';
showToast('⚠️ ' + (result?.error || t('error.generic') || 'Errore'), 'error'); showToast('⚠️ ' + (result?.error || t('error.generic') || t('error.generic')), 'error');
return; return;
} }
const recipe = result.recipe; const recipe = result.recipe;
@@ -13447,7 +13447,7 @@ async function generateRecipeForIngredient(ingredientName) {
} catch (err) { } catch (err) {
console.error('[generateRecipeForIngredient]', err); console.error('[generateRecipeForIngredient]', err);
document.getElementById('recipe-overlay').style.display = 'none'; document.getElementById('recipe-overlay').style.display = 'none';
showToast('⚠️ ' + (t('error.connection') || 'Errore di connessione'), 'error'); showToast('⚠️ ' + t('error.connection'), 'error');
} }
} }
@@ -13481,7 +13481,8 @@ async function sendChatMessage() {
message: text, message: text,
history: chatHistory.slice(0, -1).slice(-20), // last 20 messages for context history: chatHistory.slice(0, -1).slice(-20), // last 20 messages for context
appliances: settings.appliances || [], appliances: settings.appliances || [],
dietary_restrictions: settings.dietary_restrictions || '' dietary_restrictions: settings.dietary_restrictions || '',
lang: _currentLang
}); });
// Remove typing indicator // Remove typing indicator
@@ -13502,7 +13503,7 @@ async function sendChatMessage() {
scrollChatBottom(); scrollChatBottom();
} }
} else { } else {
const errMsg = result.error === 'no_api_key' ? 'Configura la chiave API Gemini nelle impostazioni.' : (result.error || 'Errore nella risposta'); const errMsg = result.error === 'no_api_key' ? t('error.no_api_key') : (result.error || t('error.generic'));
appendChatBubble('gemini', `⚠️ ${escapeHtml(errMsg)}`); appendChatBubble('gemini', `⚠️ ${escapeHtml(errMsg)}`);
} }
} catch(err) { } catch(err) {
@@ -13807,7 +13808,7 @@ function _renderScreensaverNutrition() {
<div class="ss-pie3d" id="ss-pie-main" style="--pie-bg:${gradient}"></div> <div class="ss-pie3d" id="ss-pie-main" style="--pie-bg:${gradient}"></div>
<div class="ss-nutr-chart-label">${t('nutrition.products_n').replace('{n}', total)}</div> <div class="ss-nutr-chart-label">${t('nutrition.products_n').replace('{n}', total)}</div>
<div class="ss-nutr-legend"> <div class="ss-nutr-legend">
${top4.map(s => `<div class="ss-leg-row"><span style="background:${s.color}" class="ss-leg-dot"></span><span>${s.icon} ${s.cat}</span><span class="ss-leg-pct">${s.pct}%</span></div>`).join('')} ${top4.map(s => `<div class="ss-leg-row"><span style="background:${s.color}" class="ss-leg-dot"></span><span>${s.icon} ${t('categories.' + s.cat) || s.cat}</span><span class="ss-leg-pct">${s.pct}%</span></div>`).join('')}
</div> </div>
</div> </div>
<!-- Score donuts --> <!-- Score donuts -->
@@ -14324,6 +14325,7 @@ function initInactivityWatcher() {
} }
// ===== INITIALIZATION ===== // ===== INITIALIZATION =====
const _splashStart = Date.now();
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
// Load translations first, then initialize the app // Load translations first, then initialize the app
loadTranslations(_currentLang).then(() => { loadTranslations(_currentLang).then(() => {
@@ -14652,11 +14654,22 @@ async function _initApp() {
startHeartbeat(); startHeartbeat();
_injectKioskOverlay(); // kiosk X / refresh buttons (only when running inside Android WebView) _injectKioskOverlay(); // kiosk X / refresh buttons (only when running inside Android WebView)
// Hide preloader once the dashboard is rendered // Sync version label in preloader (in case HTML is stale)
const preloaderVer = document.getElementById('preloader-version');
if (preloaderVer) {
const ver = document.querySelector('.header-version')?.textContent?.trim() || '';
if (ver) preloaderVer.textContent = ver;
}
// Hide preloader — enforce minimum 3 s splash regardless of load speed
const preloader = document.getElementById('app-preloader'); const preloader = document.getElementById('app-preloader');
if (preloader) { if (preloader) {
preloader.classList.add('fade-out'); const elapsed = Date.now() - _splashStart;
setTimeout(() => preloader.remove(), 380); const minDelay = Math.max(0, 3000 - elapsed);
setTimeout(() => {
preloader.classList.add('fade-out');
setTimeout(() => preloader.remove(), 380);
}, minDelay);
} }
// Defer update check: fire 6 s after app is ready so it doesn't compete // Defer update check: fire 6 s after app is ready so it doesn't compete
+32 -31
View File
@@ -11,7 +11,7 @@
<title>EverShelf</title> <title>EverShelf</title>
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<link rel="icon" type="image/png" href="assets/img/logo/logo_icon.png"> <link rel="icon" type="image/png" href="assets/img/logo/logo_icon.png">
<link rel="stylesheet" href="assets/css/style.css?v=20260516a"> <link rel="stylesheet" href="assets/css/style.css?v=20260516b">
<!-- QuaggaJS for barcode scanning --> <!-- QuaggaJS for barcode scanning -->
<script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script>
<!-- @xenova/transformers: ES-module bootstrap that exposes a lazy category-classifier as window._categoryPipelinePromise --> <!-- @xenova/transformers: ES-module bootstrap that exposes a lazy category-classifier as window._categoryPipelinePromise -->
@@ -53,8 +53,9 @@
<!-- ===== APP PRELOADER (hidden by JS once _initApp completes) ===== --> <!-- ===== APP PRELOADER (hidden by JS once _initApp completes) ===== -->
<div id="app-preloader" aria-hidden="true"> <div id="app-preloader" aria-hidden="true">
<div class="app-preloader-inner"> <div class="app-preloader-inner">
<div class="app-preloader-spinner"></div>
<img src="assets/img/logo/logo.png" alt="EverShelf" class="app-preloader-logo" /> <img src="assets/img/logo/logo.png" alt="EverShelf" class="app-preloader-logo" />
<div class="app-preloader-spinner"></div>
<span class="app-preloader-version" id="preloader-version">v1.7.15</span>
</div> </div>
</div> </div>
@@ -67,7 +68,7 @@
<!-- Title — left-aligned; grows to fill space --> <!-- Title — left-aligned; grows to fill space -->
<div class="header-title-wrap"> <div class="header-title-wrap">
<h1 class="header-title" onclick="showPage('dashboard')"> <h1 class="header-title" onclick="showPage('dashboard')">
<img src="assets/img/logo/logo_icon.png" alt="" class="header-logo-icon" aria-hidden="true" /><span data-i18n="nav.title">EverShelf</span><span class="header-version">v1.7.14</span> <img src="assets/img/logo/logo_icon.png" alt="" class="header-logo-icon" aria-hidden="true" /><span data-i18n="nav.title">EverShelf</span><span class="header-version">v1.7.15</span>
</h1> </h1>
<!-- Update badge — shown alongside title, never replaces it --> <!-- Update badge — shown alongside title, never replaces it -->
<span class="header-update-badge" id="header-update-badge" style="display:none"></span> <span class="header-update-badge" id="header-update-badge" style="display:none"></span>
@@ -577,7 +578,7 @@
<div class="form-group"> <div class="form-group">
<label data-i18n="product.category_label">📂 Categoria</label> <label data-i18n="product.category_label">📂 Categoria</label>
<select id="pf-category" class="form-input" onchange="onCategoryChange(false)"> <select id="pf-category" class="form-input" onchange="onCategoryChange(false)">
<option value="">-- Seleziona --</option> <option value="" data-i18n="form.select_placeholder">-- Seleziona --</option>
<option value="latticini">🥛 Latticini</option> <option value="latticini">🥛 Latticini</option>
<option value="carne">🥩 Carne</option> <option value="carne">🥩 Carne</option>
<option value="pesce">🐟 Pesce</option> <option value="pesce">🐟 Pesce</option>
@@ -628,10 +629,10 @@
<div class="form-group"> <div class="form-group">
<label data-i18n="product.barcode_label">🔖 Barcode</label> <label data-i18n="product.barcode_label">🔖 Barcode</label>
<div class="expiry-input-row"> <div class="expiry-input-row">
<input type="text" id="pf-barcode" class="form-input" placeholder="Codice a barre (se disponibile)" inputmode="numeric"> <input type="text" id="pf-barcode" class="form-input" placeholder="Codice a barre (se disponibile)" inputmode="numeric" data-i18n-placeholder="product.barcode_placeholder">
<button type="button" class="btn btn-accent btn-scan-expiry" id="pf-barcode-scan-btn" onclick="scanBarcodeForForm()" title="Scansiona barcode">📷</button> <button type="button" class="btn btn-accent btn-scan-expiry" id="pf-barcode-scan-btn" onclick="scanBarcodeForForm()" title="Scansiona barcode">📷</button>
</div> </div>
<p class="form-hint" id="pf-barcode-hint" style="display:none">⚠️ Aggiungi il barcode così al prossimo acquisto basta scansionarlo!</p> <p class="form-hint" id="pf-barcode-hint" style="display:none" data-i18n="product.barcode_hint">⚠️ Aggiungi il barcode così al prossimo acquisto basta scansionarlo!</p>
</div> </div>
<input type="hidden" id="pf-image"> <input type="hidden" id="pf-image">
<div class="product-image-preview" id="pf-image-preview" style="display:none"> <div class="product-image-preview" id="pf-image-preview" style="display:none">
@@ -994,18 +995,18 @@
</div> </div>
</div> </div>
<div class="common-appliances mt-2"> <div class="common-appliances mt-2">
<p class="settings-hint">Aggiungi velocemente:</p> <p class="settings-hint" data-i18n="settings.appliances.quick_title">Aggiungi velocemente:</p>
<div class="appliance-quick-tags"> <div class="appliance-quick-tags">
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Forno')">🔥 Forno</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Forno')" data-i18n="settings.appliances.oven">🔥 Forno</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Microonde')">📡 Microonde</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Microonde')" data-i18n="settings.appliances.microwave">📡 Microonde</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Friggitrice ad aria')">🍟 Friggitrice ad aria</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Friggitrice ad aria')" data-i18n="settings.appliances.air_fryer">🍟 Friggitrice ad aria</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Macchina del pane')">🍞 Macchina pane</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Macchina del pane')" data-i18n="settings.appliances.bread_maker">🍞 Macchina pane</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Bimby/Moulinex Cookeo')">🤖 Bimby/Cookeo</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Bimby/Moulinex Cookeo')" data-i18n="settings.appliances.bimby">🤖 Bimby/Cookeo</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Planetaria')">🌀 Planetaria</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Planetaria')" data-i18n="settings.appliances.mixer">🌀 Planetaria</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Vaporiera')">♨️ Vaporiera</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Vaporiera')" data-i18n="settings.appliances.steamer">♨️ Vaporiera</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Pentola a pressione')">🫕 Pentola pressione</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Pentola a pressione')" data-i18n="settings.appliances.pressure_cooker">🫕 Pentola pressione</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Tostapane')">🍞 Tostapane</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Tostapane')" data-i18n="settings.appliances.toaster">🍞 Tostapane</button>
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Frullatore/Mixer')">🍹 Frullatore</button> <button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Frullatore/Mixer')" data-i18n="settings.appliances.blender">🍹 Frullatore</button>
</div> </div>
</div> </div>
</div> </div>
@@ -1030,21 +1031,21 @@
<div class="settings-panel" id="tab-security"> <div class="settings-panel" id="tab-security">
<div class="settings-card"> <div class="settings-card">
<h4 data-i18n="settings.security.token_title">🔑 Token Impostazioni</h4> <h4 data-i18n="settings.security.token_title">🔑 Token Impostazioni</h4>
<p class="settings-hint">Se <code>SETTINGS_TOKEN</code> è configurato nel <code>.env</code> server, inserisci qui il token prima di salvare le impostazioni. Lascia vuoto se non configurato.</p> <p class="settings-hint" data-i18n="settings.security.token_hint">Se <code>SETTINGS_TOKEN</code> è configurato nel <code>.env</code> server, inserisci qui il token prima di salvare le impostazioni. Lascia vuoto se non configurato.</p>
<div class="form-group"> <div class="form-group">
<label data-i18n="settings.security.token_label">Token di accesso</label> <label data-i18n="settings.security.token_label">Token di accesso</label>
<input type="password" id="setting-settings-token" class="form-input" placeholder="(vuoto = nessuna protezione)"> <input type="password" id="setting-settings-token" class="form-input" placeholder="(vuoto = nessuna protezione)" data-i18n-placeholder="settings.security.token_placeholder">
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-settings-token')" data-i18n="btn.toggle_password">👁️ Mostra/Nascondi</button> <button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-settings-token')" data-i18n="btn.toggle_password">👁️ Mostra/Nascondi</button>
</div> </div>
<p class="settings-hint" id="settings-token-status-hint" style="display:none;color:var(--accent)">🔒 Questo server richiede un token per salvare le impostazioni.</p> <p class="settings-hint" id="settings-token-status-hint" style="display:none;color:var(--accent)" data-i18n="settings.security.token_required_hint">🔒 Questo server richiede un token per salvare le impostazioni.</p>
</div> </div>
<div class="settings-card"> <div class="settings-card">
<h4 data-i18n="settings.security.title">🔒 Certificato HTTPS</h4> <h4 data-i18n="settings.security.title">🔒 Certificato HTTPS</h4>
<p class="settings-hint">Se il browser mostra l'errore "La connessione non è privata" (ERR_CERT_AUTHORITY_INVALID), devi installare il certificato CA nel dispositivo.</p> <p class="settings-hint" data-i18n="settings.security.hint">Se il browser mostra l'errore "La connessione non è privata" (ERR_CERT_AUTHORITY_INVALID), devi installare il certificato CA nel dispositivo.</p>
<div class="form-group"> <div class="form-group">
<a href="ca.crt" download="EverShelf_CA.crt" class="btn btn-large btn-accent full-width" style="text-align:center;text-decoration:none;display:block" data-i18n="settings.security.download_btn">📥 Scarica Certificato CA</a> <a href="ca.crt" download="EverShelf_CA.crt" class="btn btn-large btn-accent full-width" style="text-align:center;text-decoration:none;display:block" data-i18n="settings.security.download_btn">📥 Scarica Certificato CA</a>
</div> </div>
<div class="settings-hint" style="margin-top:12px;line-height:1.6"> <div class="settings-hint" style="margin-top:12px;line-height:1.6" data-i18n-html="settings.security.cert_instructions">
<strong>Istruzioni per Chrome (Android):</strong><br> <strong>Istruzioni per Chrome (Android):</strong><br>
1. Scarica il certificato qui sopra<br> 1. Scarica il certificato qui sopra<br>
2. Vai in <em>Impostazioni → Sicurezza e privacy → Altre impostazioni di sicurezza → Installa da archivio dispositivo</em><br> 2. Vai in <em>Impostazioni → Sicurezza e privacy → Altre impostazioni di sicurezza → Installa da archivio dispositivo</em><br>
@@ -1088,11 +1089,11 @@
<label data-i18n="settings.tts.voice_label">🗣️ Voce</label> <label data-i18n="settings.tts.voice_label">🗣️ Voce</label>
<div style="display:flex;gap:8px;align-items:center"> <div style="display:flex;gap:8px;align-items:center">
<select id="setting-tts-voice" class="form-input" style="flex:1"> <select id="setting-tts-voice" class="form-input" style="flex:1">
<option value="">— Caricamento voci… —</option> <option value="" data-i18n="settings.tts.voices_loading">— Caricamento voci… —</option>
</select> </select>
<button type="button" class="btn btn-secondary" style="padding:8px 12px;white-space:nowrap;flex-shrink:0" onclick="_initBrowserTtsVoices(document.getElementById('setting-tts-voice').value)"></button> <button type="button" class="btn btn-secondary" style="padding:8px 12px;white-space:nowrap;flex-shrink:0" onclick="_initBrowserTtsVoices(document.getElementById('setting-tts-voice').value)"></button>
</div> </div>
<p class="settings-hint">Le voci disponibili dipendono dal sistema operativo e dal browser. Su macOS/iOS è disponibile la voce <strong>Paola</strong> (italiano). Premi ↺ se la lista non si carica.</p> <p class="settings-hint" data-i18n="settings.tts.voices_hint">Le voci disponibili dipendono dal sistema operativo e dal browser. Su macOS/iOS è disponibile la voce <strong>Paola</strong> (italiano). Premi ↺ se la lista non si carica.</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<label><span data-i18n="settings.tts.rate_label">⚡ Velocità</span>: <span id="tts-rate-label">1.0</span>×</label> <label><span data-i18n="settings.tts.rate_label">⚡ Velocità</span>: <span id="tts-rate-label">1.0</span>×</label>
@@ -1158,7 +1159,7 @@
<div class="form-group"> <div class="form-group">
<label data-i18n="settings.tts.extra_fields_label"> Campi extra (JSON)</label> <label data-i18n="settings.tts.extra_fields_label"> Campi extra (JSON)</label>
<textarea id="setting-tts-extra-fields" class="form-input" rows="3" placeholder='{"entity_id": "media_player.living_room"}'></textarea> <textarea id="setting-tts-extra-fields" class="form-input" rows="3" placeholder='{"entity_id": "media_player.living_room"}'></textarea>
<p class="settings-hint">Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.</p> <p class="settings-hint" data-i18n="settings.tts.extra_fields_hint">Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.</p>
</div> </div>
</div><!-- /tts-server-section --> </div><!-- /tts-server-section -->
@@ -1174,9 +1175,9 @@
<!-- Kiosk-mode panel: replace WebSocket config with native reconfigure button --> <!-- Kiosk-mode panel: replace WebSocket config with native reconfigure button -->
<div id="scale-kiosk-panel" style="display:none;background:rgba(16,185,129,0.07);border:1px solid rgba(16,185,129,0.25);border-radius:10px;padding:14px;margin-bottom:16px"> <div id="scale-kiosk-panel" style="display:none;background:rgba(16,185,129,0.07);border:1px solid rgba(16,185,129,0.25);border-radius:10px;padding:14px;margin-bottom:16px">
<p style="margin:0 0 6px;font-weight:600">📡 Bilancia BLE integrata nel Kiosk</p> <p style="margin:0 0 6px;font-weight:600" data-i18n="settings.scale.kiosk_title">📡 Bilancia BLE integrata nel Kiosk</p>
<p class="settings-hint" style="margin-bottom:12px">La bilancia è gestita direttamente dal Gateway BLE interno al kiosk. Per abbinare un nuovo dispositivo usa il wizard di configurazione.</p> <p class="settings-hint" style="margin-bottom:12px" data-i18n="settings.scale.kiosk_hint">La bilancia è gestita direttamente dal Gateway BLE interno al kiosk. Per abbinare un nuovo dispositivo usa il wizard di configurazione.</p>
<button class="btn btn-secondary full-width" onclick="_kioskReconfigureScale()">🔄 Riconfigura bilancia BLE</button> <button class="btn btn-secondary full-width" onclick="_kioskReconfigureScale()" data-i18n="settings.scale.kiosk_reconfigure">🔄 Riconfigura bilancia BLE</button>
<!-- shown when kiosk APK is too old to have reconfigureScale() --> <!-- shown when kiosk APK is too old to have reconfigureScale() -->
<div id="kiosk-needs-update-notice" style="display:none;margin-top:10px;padding:8px 12px;background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.35);border-radius:8px;font-size:0.83rem"> <div id="kiosk-needs-update-notice" style="display:none;margin-top:10px;padding:8px 12px;background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.35);border-radius:8px;font-size:0.83rem">
<span data-i18n="settings.kiosk.needs_update">⚠️ Il kiosk installato non supporta questa funzione. <span data-i18n="settings.kiosk.needs_update">⚠️ Il kiosk installato non supporta questa funzione.
@@ -1238,7 +1239,7 @@
</div> </div>
<!-- Protocol info --> <!-- Protocol info -->
<div class="settings-hint" style="margin-top:16px;padding:10px;background:var(--bg-secondary,#f8fafc);border-radius:8px"> <div class="settings-hint" style="margin-top:16px;padding:10px;background:var(--bg-secondary,#f8fafc);border-radius:8px" data-i18n-html="settings.scale.ble_protocols">
<p style="margin:0 0 6px;font-weight:600">🔌 Protocolli BLE supportati:</p> <p style="margin:0 0 6px;font-weight:600">🔌 Protocolli BLE supportati:</p>
<ul style="margin:0 0 0 16px;padding:0;font-size:0.8rem"> <ul style="margin:0 0 0 16px;padding:0;font-size:0.8rem">
<li>Bluetooth SIG Weight Scale (0x181D)</li> <li>Bluetooth SIG Weight Scale (0x181D)</li>
@@ -1274,7 +1275,7 @@
</label> </label>
</div> </div>
<div class="form-group" id="screensaver-timeout-row" style="margin-top:10px"> <div class="form-group" id="screensaver-timeout-row" style="margin-top:10px">
<label for="setting-screensaver-timeout" style="font-size:0.85rem;font-weight:600;color:var(--text-secondary)">⏱️ Avvia dopo</label> <label for="setting-screensaver-timeout" style="font-size:0.85rem;font-weight:600;color:var(--text-secondary)" data-i18n="settings.screensaver.start_after">⏱️ Avvia dopo</label>
<select id="setting-screensaver-timeout" class="form-control" style="margin-top:6px;max-width:200px"> <select id="setting-screensaver-timeout" class="form-control" style="margin-top:6px;max-width:200px">
<option value="1" data-i18n="settings.screensaver.timeout_1">1 minuto</option> <option value="1" data-i18n="settings.screensaver.timeout_1">1 minuto</option>
<option value="2" data-i18n="settings.screensaver.timeout_2">2 minuti</option> <option value="2" data-i18n="settings.screensaver.timeout_2">2 minuti</option>
@@ -1559,6 +1560,6 @@
</div> </div>
</div> </div>
<script src="assets/js/app.js?v=20260516a"></script> <script src="assets/js/app.js?v=20260516b"></script>
</body> </body>
</html> </html>
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "EverShelf", "name": "EverShelf",
"short_name": "EverShelf", "short_name": "EverShelf",
"description": "Gestione completa della dispensa di casa con scansione barcode", "description": "Gestione completa della dispensa di casa con scansione barcode",
"version": "1.7.14", "version": "1.7.15",
"start_url": "/evershelf/", "start_url": "/evershelf/",
"display": "standalone", "display": "standalone",
"background_color": "#f0f4e8", "background_color": "#f0f4e8",
+55 -14
View File
@@ -20,6 +20,8 @@
"add": "✅ Hinzufügen", "add": "✅ Hinzufügen",
"delete": "Löschen", "delete": "Löschen",
"edit": "✏️ Bearbeiten", "edit": "✏️ Bearbeiten",
"use": "Verwenden",
"edit_item": "Bearbeiten",
"search": "🔍 Suchen", "search": "🔍 Suchen",
"go": "✅ Los", "go": "✅ Los",
"toggle_password": "👁️ Anzeigen/Ausblenden", "toggle_password": "👁️ Anzeigen/Ausblenden",
@@ -29,7 +31,12 @@
"restart": "↺ Neustart", "restart": "↺ Neustart",
"reset_default": "↺ Standard wiederherstellen", "reset_default": "↺ Standard wiederherstellen",
"save_info": "💾 Info speichern", "save_info": "💾 Info speichern",
"retry": "🔄 Erneut versuchen" "retry": "🔄 Erneut versuchen",
"yes_short": "Ja",
"no_short": "Nein"
},
"form": {
"select_placeholder": "-- Auswählen --"
}, },
"locations": { "locations": {
"dispensa": "Vorratskammer", "dispensa": "Vorratskammer",
@@ -64,7 +71,9 @@
"pieces": "Stück", "pieces": "Stück",
"grams": "Gramm", "grams": "Gramm",
"box": "Packung", "box": "Packung",
"boxes": "Packungen" "boxes": "Packungen",
"millilitres": "Milliliter",
"from": "von"
}, },
"shopping_sections": { "shopping_sections": {
"frutta_verdura": "Obst & Gemüse", "frutta_verdura": "Obst & Gemüse",
@@ -216,7 +225,7 @@
"throw_btn": "🗑️ ENTSORGEN", "throw_btn": "🗑️ ENTSORGEN",
"throw_sub": "wegwerfen", "throw_sub": "wegwerfen",
"edit_sub": "Ablauf, Ort…", "edit_sub": "Ablauf, Ort…",
"create_recipe_btn": "Rezept damit erstellen" "create_recipe_btn": "Rezept"
}, },
"add": { "add": {
"title": "Zum Vorrat hinzufügen", "title": "Zum Vorrat hinzufügen",
@@ -241,7 +250,9 @@
"scan_expiry_title": "📷 Ablaufdatum scannen", "scan_expiry_title": "📷 Ablaufdatum scannen",
"product_added": "✅ {name} hinzugefügt!{qty}", "product_added": "✅ {name} hinzugefügt!{qty}",
"suffix_freezer_vacuum": "(Tiefkühler + vakuumversiegelt)", "suffix_freezer_vacuum": "(Tiefkühler + vakuumversiegelt)",
"history_badge_tip": "Durchschnitt aus {n} früheren Einträgen" "history_badge_tip": "Durchschnitt aus {n} früheren Einträgen",
"vacuum_question": "Vakuumiert?",
"vacuum_saved": "🔒 Als vakuumiert gespeichert"
}, },
"use": { "use": {
"title": "Verwenden / Verbrauchen", "title": "Verwenden / Verbrauchen",
@@ -313,7 +324,13 @@
"edit_info": "✏️ Informationen bearbeiten", "edit_info": "✏️ Informationen bearbeiten",
"modify_details": "BEARBEITEN\nAblauf, Ort…", "modify_details": "BEARBEITEN\nAblauf, Ort…",
"already_in_pantry": "📋 Bereits im Vorratsschrank", "already_in_pantry": "📋 Bereits im Vorratsschrank",
"no_barcode": "Kein Barcode" "no_barcode": "Kein Barcode",
"unknown_product": "Unbekanntes Produkt",
"edit_name_brand": "Name/Marke bearbeiten",
"weight_label": "Gewicht",
"origin_label": "Herkunft",
"labels_label": "Etiketten",
"select_variant": "Genaue Variante auswählen oder KI-Daten nutzen:"
}, },
"products": { "products": {
"title": "📦 Alle Produkte", "title": "📦 Alle Produkte",
@@ -503,7 +520,8 @@
"transfer_to_recipes": "Zu Rezepten hinzufügen", "transfer_to_recipes": "Zu Rezepten hinzufügen",
"transferring": "Übertrage...", "transferring": "Übertrage...",
"transferred": "Zu Rezepten hinzugefügt!", "transferred": "Zu Rezepten hinzugefügt!",
"open_recipe": "Rezept öffnen" "open_recipe": "Rezept öffnen",
"quick_recipe_prompt": "Schlage mir ein schnelles Rezept FÜR EINE PERSON vor, das die Produkte mit dem nächsten Ablaufdatum verwendet! Ignoriere Tiefkühlprodukte, konzentriere dich auf Kühlschrank und Vorratsschrank."
}, },
"cooking": { "cooking": {
"close": "Schließen", "close": "Schließen",
@@ -520,7 +538,8 @@
"timer_warning_tts": "Achtung! {label}: noch 10 Sekunden!", "timer_warning_tts": "Achtung! {label}: noch 10 Sekunden!",
"recipe_done_tts": "Rezept abgeschlossen! Guten Appetit!", "recipe_done_tts": "Rezept abgeschlossen! Guten Appetit!",
"expires_chip": "läuft ab {date}", "expires_chip": "läuft ab {date}",
"finish": "✅ Fertig" "finish": "✅ Fertig",
"step_fallback": "Schritt {n}"
}, },
"settings": { "settings": {
"title": "⚙️ Einstellungen", "title": "⚙️ Einstellungen",
@@ -631,7 +650,11 @@
"hint": "Wenn der Browser den Fehler \"Verbindung nicht sicher\" (ERR_CERT_AUTHORITY_INVALID) zeigt, installiere das CA-Zertifikat auf dem Gerät.", "hint": "Wenn der Browser den Fehler \"Verbindung nicht sicher\" (ERR_CERT_AUTHORITY_INVALID) zeigt, installiere das CA-Zertifikat auf dem Gerät.",
"download_btn": "📥 CA-Zertifikat herunterladen", "download_btn": "📥 CA-Zertifikat herunterladen",
"token_title": "🔑 Einstellungs-Token", "token_title": "🔑 Einstellungs-Token",
"token_label": "Zugriffstoken" "token_label": "Zugriffstoken",
"token_hint": "Falls `SETTINGS_TOKEN` in der Server-`.env` konfiguriert ist, gib hier den Token ein, bevor du die Einstellungen speicherst. Leer lassen, wenn nicht konfiguriert.",
"token_placeholder": "(leer = kein Schutz)",
"token_required_hint": "🔒 Dieser Server benötigt einen Token zum Speichern der Einstellungen.",
"cert_instructions": "<strong>Anleitung für Chrome (Android):</strong><br>1. Zertifikat oben herunterladen<br>2. Gehe zu <em>Einstellungen &rarr; Sicherheit &amp; Datenschutz &rarr; Weitere Sicherheitseinstellungen &rarr; Vom Gerätespeicher installieren</em><br>3. Wähle die heruntergeladene <em>EverShelf_CA.crt</em> Datei<br>4. Wähle \"CA\" und bestätige<br>5. Chrome neu starten<br><br><strong>Anleitung für Chrome (PC):</strong><br>1. Zertifikat oben herunterladen<br>2. Gehe zu <em>chrome://settings/certificates</em> (oder Einstellungen &rarr; Datenschutz und Sicherheit &rarr; Sicherheit &rarr; Zertifikate verwalten)<br>3. Tab \"Zertifizierungsstellen\" &rarr; Importieren &rarr; Datei auswählen<br>4. Häkchen bei \"Dieser Zertifizierungsstelle für die Identifikation von Webseiten vertrauen\"<br>5. Chrome neu starten"
}, },
"tts": { "tts": {
"title": "🔊 Sprache & TTS", "title": "🔊 Sprache & TTS",
@@ -658,7 +681,14 @@
"extra_fields_label": " Zusätzliche Felder (JSON)", "extra_fields_label": " Zusätzliche Felder (JSON)",
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}", "extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
"extra_fields_hint": "Zusätzliche Felder im Payload, im JSON-Format. Leer lassen wenn nicht benötigt.", "extra_fields_hint": "Zusätzliche Felder im Payload, im JSON-Format. Leer lassen wenn nicht benötigt.",
"test_btn": "🔊 Testansage senden" "test_btn": "🔊 Testansage senden",
"voices_loading": "Stimmen werden geladen…",
"voice_not_supported": "Stimme vom Browser nicht unterstützt",
"voices_none": "Keine Stimmen auf diesem Gerät verfügbar",
"voices_hint": "Verfügbare Stimmen hängen vom Betriebssystem und Browser ab. Auf macOS/iOS ist die Stimme Paola (Italienisch) verfügbar. Drücken Sie ↺ wenn die Liste nicht lädt.",
"url_missing": "⚠️ Endpunkt-URL fehlt.",
"test_sending": "⏳ Wird gesendet…",
"test_ok": "✅ Antwort {code} — prüfe ob der Lautsprecher gesprochen hat."
}, },
"language": { "language": {
"title": "🌐 Sprache", "title": "🌐 Sprache",
@@ -676,7 +706,8 @@
"timeout_10": "10 Minuten", "timeout_10": "10 Minuten",
"timeout_15": "15 Minuten", "timeout_15": "15 Minuten",
"timeout_30": "30 Minuten", "timeout_30": "30 Minuten",
"timeout_60": "1 Stunde" "timeout_60": "1 Stunde",
"start_after": "⏱️ Starten nach"
}, },
"scale": { "scale": {
"title": "⚖️ Smart-Waage", "title": "⚖️ Smart-Waage",
@@ -691,7 +722,11 @@
"download_hint": "Android-App als Brücke zwischen BLE-Waage und EverShelf.", "download_hint": "Android-App als Brücke zwischen BLE-Waage und EverShelf.",
"download_sub": "Quellcode: evershelf-scale-gateway/ im Projektstamm", "download_sub": "Quellcode: evershelf-scale-gateway/ im Projektstamm",
"live_weight": "Echtzeit-Gewicht", "live_weight": "Echtzeit-Gewicht",
"auto_reconnect": "🔁 Verbindung: automatisch" "auto_reconnect": "🔁 Verbindung: automatisch",
"kiosk_title": "📡 BLE-Waage im Kiosk integriert",
"kiosk_hint": "Die Waage wird direkt vom internen BLE-Gateway des Kiosks verwaltet. Um ein neues Gerät zu koppeln, verwende den Konfigurationsassistenten.",
"kiosk_reconfigure": "🔄 BLE-Waage neu konfigurieren",
"ble_protocols": "<p style=\"margin:0 0 6px;font-weight:600\">🔌 Unterstützte BLE-Protokolle:</p><ul style=\"margin:0 0 0 16px;padding:0;font-size:0.8rem\"><li>Bluetooth SIG Weight Scale (0x181D)</li><li>Bluetooth SIG Body Composition (0x181B) &mdash; Gewicht, Fett, BMI</li><li>Xiaomi Mi Body Composition Scale 2</li><li>Generisch &mdash; automatische Heuristik für 100+ Modelle</li></ul>"
}, },
"kiosk": { "kiosk": {
"hint": "Verwandeln Sie ein Android-Tablet in ein EverShelf-Panel mit integriertem BLE-Waagen-Gateway.", "hint": "Verwandeln Sie ein Android-Tablet in ein EverShelf-Panel mit integriertem BLE-Waagen-Gateway.",
@@ -838,7 +873,10 @@
"select_items": "Wähle mindestens ein Produkt aus", "select_items": "Wähle mindestens ein Produkt aus",
"server_offline": "Serververbindung unterbrochen", "server_offline": "Serververbindung unterbrochen",
"server_restored": "Serververbindung wiederhergestellt", "server_restored": "Serververbindung wiederhergestellt",
"server_retry": "Erneut versuchen" "server_retry": "Erneut versuchen",
"unknown": "Unbekannter Fehler",
"prefix": "Fehler",
"no_inventory_entry": "Kein Inventareintrag gefunden"
}, },
"confirm": { "confirm": {
"remove_item": "Möchtest du dieses Produkt wirklich aus dem Bestand entfernen?", "remove_item": "Möchtest du dieses Produkt wirklich aus dem Bestand entfernen?",
@@ -854,7 +892,9 @@
"edit": { "edit": {
"title": "{name} bearbeiten", "title": "{name} bearbeiten",
"unknown_hint": "Produktname und Informationen eingeben", "unknown_hint": "Produktname und Informationen eingeben",
"label_name": "🏷️ Produktname" "label_name": "🏷️ Produktname",
"choose_location_title": "Welchen Ort?",
"choose_location_hint": "Wähle den zu bearbeitenden Ort:"
}, },
"screensaver": { "screensaver": {
"recipe_btn": "Rezepte", "recipe_btn": "Rezepte",
@@ -951,7 +991,8 @@
"thing_rest": "den Rest", "thing_rest": "den Rest",
"stay_btn": "Nein, bleibt in {location}", "stay_btn": "Nein, bleibt in {location}",
"moved_toast": "📦 Offene Packung bewegt nach {location}", "moved_toast": "📦 Offene Packung bewegt nach {location}",
"vacuum_restore": "🫙 Vakuum wiederherstellen" "vacuum_restore": "🫙 Vakuum wiederherstellen",
"vacuum_seal_rest": "🔒 Rest vakuumieren"
}, },
"nova": { "nova": {
"1": "Unverarbeitet", "1": "Unverarbeitet",
+57 -15
View File
@@ -20,6 +20,8 @@
"add": "✅ Add", "add": "✅ Add",
"delete": "Delete", "delete": "Delete",
"edit": "✏️ Edit", "edit": "✏️ Edit",
"use": "Use",
"edit_item": "Edit",
"search": "🔍 Search", "search": "🔍 Search",
"go": "✅ Go", "go": "✅ Go",
"toggle_password": "👁️ Show/Hide", "toggle_password": "👁️ Show/Hide",
@@ -29,7 +31,12 @@
"restart": "↺ Restart", "restart": "↺ Restart",
"reset_default": "↺ Reset to default", "reset_default": "↺ Reset to default",
"save_info": "💾 Save information", "save_info": "💾 Save information",
"retry": "🔄 Retry" "retry": "🔄 Retry",
"yes_short": "Yes",
"no_short": "No"
},
"form": {
"select_placeholder": "-- Select --"
}, },
"locations": { "locations": {
"dispensa": "Pantry", "dispensa": "Pantry",
@@ -64,7 +71,9 @@
"pieces": "Pieces", "pieces": "Pieces",
"grams": "Grams", "grams": "Grams",
"box": "Package", "box": "Package",
"boxes": "Packages" "boxes": "Packages",
"millilitres": "Millilitres",
"from": "of"
}, },
"shopping_sections": { "shopping_sections": {
"frutta_verdura": "Fruits & Vegetables", "frutta_verdura": "Fruits & Vegetables",
@@ -216,7 +225,7 @@
"throw_btn": "🗑️ DISCARD", "throw_btn": "🗑️ DISCARD",
"throw_sub": "throw away", "throw_sub": "throw away",
"edit_sub": "expiry, location…", "edit_sub": "expiry, location…",
"create_recipe_btn": "Create a recipe with this" "create_recipe_btn": "Recipe"
}, },
"add": { "add": {
"title": "Add to Pantry", "title": "Add to Pantry",
@@ -241,7 +250,9 @@
"scan_expiry_title": "📷 Scan Expiry Date", "scan_expiry_title": "📷 Scan Expiry Date",
"product_added": "✅ {name} added!{qty}", "product_added": "✅ {name} added!{qty}",
"suffix_freezer_vacuum": "(freezer + vacuum sealed)", "suffix_freezer_vacuum": "(freezer + vacuum sealed)",
"history_badge_tip": "Average from {n} previous entries" "history_badge_tip": "Average from {n} previous entries",
"vacuum_question": "Vacuum sealed?",
"vacuum_saved": "🔒 Vacuum sealed!"
}, },
"use": { "use": {
"title": "Use / Consume", "title": "Use / Consume",
@@ -313,7 +324,13 @@
"edit_info": "✏️ Edit information", "edit_info": "✏️ Edit information",
"modify_details": "EDIT\nexpiry, location…", "modify_details": "EDIT\nexpiry, location…",
"already_in_pantry": "📋 Already in pantry", "already_in_pantry": "📋 Already in pantry",
"no_barcode": "No barcode" "no_barcode": "No barcode",
"unknown_product": "Unrecognized product",
"edit_name_brand": "Edit name/brand",
"weight_label": "Weight",
"origin_label": "Origin",
"labels_label": "Labels",
"select_variant": "Select the exact variant or use AI data:"
}, },
"products": { "products": {
"title": "📦 All Products", "title": "📦 All Products",
@@ -483,7 +500,8 @@
"undo_success": "↩ Operation undone for {name}", "undo_success": "↩ Operation undone for {name}",
"already_undone": "Operation already undone", "already_undone": "Operation already undone",
"too_old": "Cannot undo operations older than 24 hours", "too_old": "Cannot undo operations older than 24 hours",
"undo_error": "Error during undo" "undo_error": "Error during undo",
"recipe_prefix": "Recipe"
}, },
"chat": { "chat": {
"title": "Gemini Chef", "title": "Gemini Chef",
@@ -503,7 +521,8 @@
"transfer_to_recipes": "Transfer to Recipes", "transfer_to_recipes": "Transfer to Recipes",
"transferring": "Transferring...", "transferring": "Transferring...",
"transferred": "Added to Recipes!", "transferred": "Added to Recipes!",
"open_recipe": "Open recipe" "open_recipe": "Open recipe",
"quick_recipe_prompt": "Suggest a quick recipe FOR ONE PERSON using the products that expire first! Ignore freezer items, focus on fridge and pantry."
}, },
"cooking": { "cooking": {
"close": "Close", "close": "Close",
@@ -520,7 +539,8 @@
"timer_warning_tts": "Heads up! {label}: 10 seconds left!", "timer_warning_tts": "Heads up! {label}: 10 seconds left!",
"recipe_done_tts": "Recipe complete! Enjoy your meal!", "recipe_done_tts": "Recipe complete! Enjoy your meal!",
"expires_chip": "exp. {date}", "expires_chip": "exp. {date}",
"finish": "✅ Finish" "finish": "✅ Finish",
"step_fallback": "Step {n}"
}, },
"settings": { "settings": {
"title": "⚙️ Settings", "title": "⚙️ Settings",
@@ -631,7 +651,11 @@
"hint": "If the browser shows the error \"Your connection is not private\" (ERR_CERT_AUTHORITY_INVALID), you need to install the CA certificate on the device.", "hint": "If the browser shows the error \"Your connection is not private\" (ERR_CERT_AUTHORITY_INVALID), you need to install the CA certificate on the device.",
"download_btn": "📥 Download CA Certificate", "download_btn": "📥 Download CA Certificate",
"token_title": "🔑 Settings Token", "token_title": "🔑 Settings Token",
"token_label": "Access token" "token_label": "Access token",
"token_hint": "If `SETTINGS_TOKEN` is configured in the server's `.env`, enter the token here before saving settings. Leave empty if not configured.",
"token_placeholder": "(empty = no protection)",
"token_required_hint": "🔒 This server requires a token to save settings.",
"cert_instructions": "<strong>Instructions for Chrome (Android):</strong><br>1. Download the certificate above<br>2. Go to <em>Settings &rarr; Security &amp; Privacy &rarr; More security settings &rarr; Install from device storage</em><br>3. Select the downloaded <em>EverShelf_CA.crt</em> file<br>4. Choose \"CA\" and confirm<br>5. Restart Chrome<br><br><strong>Instructions for Chrome (PC):</strong><br>1. Download the certificate above<br>2. Go to <em>chrome://settings/certificates</em> (or Settings &rarr; Privacy and security &rarr; Security &rarr; Manage certificates)<br>3. Tab \"Authorities\" &rarr; Import &rarr; select the file<br>4. Check \"Trust this certificate for identifying websites\"<br>5. Restart Chrome"
}, },
"tts": { "tts": {
"title": "🔊 Voice & TTS", "title": "🔊 Voice & TTS",
@@ -658,7 +682,14 @@
"extra_fields_label": " Extra fields (JSON)", "extra_fields_label": " Extra fields (JSON)",
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}", "extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
"extra_fields_hint": "Additional fields to include in the payload, in JSON format. Leave empty if not needed.", "extra_fields_hint": "Additional fields to include in the payload, in JSON format. Leave empty if not needed.",
"test_btn": "🔊 Send Test Voice" "test_btn": "🔊 Send Test Voice",
"voices_loading": "Loading voices…",
"voice_not_supported": "Voice not supported by this browser",
"voices_none": "No voices available on this device",
"voices_hint": "Available voices depend on the OS and browser. On macOS/iOS the Paola (Italian) voice is available. Press ↺ if the list does not load.",
"url_missing": "⚠️ Endpoint URL missing.",
"test_sending": "⏳ Sending…",
"test_ok": "✅ Response {code} — check that the speaker has spoken."
}, },
"language": { "language": {
"title": "🌐 Language", "title": "🌐 Language",
@@ -676,7 +707,8 @@
"timeout_10": "10 minutes", "timeout_10": "10 minutes",
"timeout_15": "15 minutes", "timeout_15": "15 minutes",
"timeout_30": "30 minutes", "timeout_30": "30 minutes",
"timeout_60": "1 hour" "timeout_60": "1 hour",
"start_after": "⏱️ Start after"
}, },
"scale": { "scale": {
"title": "⚖️ Smart Scale", "title": "⚖️ Smart Scale",
@@ -691,7 +723,11 @@
"download_hint": "Android app that bridges your BLE scale and EverShelf.", "download_hint": "Android app that bridges your BLE scale and EverShelf.",
"download_sub": "Source: evershelf-scale-gateway/ in the project root", "download_sub": "Source: evershelf-scale-gateway/ in the project root",
"live_weight": "real-time weight", "live_weight": "real-time weight",
"auto_reconnect": "🔁 Reconnect: automatic" "auto_reconnect": "🔁 Reconnect: automatic",
"kiosk_title": "📡 BLE Scale integrated in Kiosk",
"kiosk_hint": "The scale is directly managed by the internal BLE Gateway of the kiosk. To pair a new device, use the configuration wizard.",
"kiosk_reconfigure": "🔄 Reconfigure BLE Scale",
"ble_protocols": "<p style=\"margin:0 0 6px;font-weight:600\">🔌 Supported BLE protocols:</p><ul style=\"margin:0 0 0 16px;padding:0;font-size:0.8rem\"><li>Bluetooth SIG Weight Scale (0x181D)</li><li>Bluetooth SIG Body Composition (0x181B) &mdash; weight, fat, BMI</li><li>Xiaomi Mi Body Composition Scale 2</li><li>Generic &mdash; automatic heuristic for 100+ models</li></ul>"
}, },
"kiosk": { "kiosk": {
"hint": "Turn an Android tablet into an always-on EverShelf panel with built-in BLE scale gateway.", "hint": "Turn an Android tablet into an always-on EverShelf panel with built-in BLE scale gateway.",
@@ -838,7 +874,10 @@
"select_items": "Select at least one product", "select_items": "Select at least one product",
"server_offline": "Server connection lost", "server_offline": "Server connection lost",
"server_restored": "Server connection restored", "server_restored": "Server connection restored",
"server_retry": "Retry" "server_retry": "Retry",
"unknown": "Unknown error",
"prefix": "Error",
"no_inventory_entry": "No inventory entry found"
}, },
"confirm": { "confirm": {
"remove_item": "Do you really want to remove this product from inventory?", "remove_item": "Do you really want to remove this product from inventory?",
@@ -854,7 +893,9 @@
"edit": { "edit": {
"title": "Edit {name}", "title": "Edit {name}",
"unknown_hint": "Enter the product name and information", "unknown_hint": "Enter the product name and information",
"label_name": "🏷️ Product name" "label_name": "🏷️ Product name",
"choose_location_title": "Which location?",
"choose_location_hint": "Choose the location to edit:"
}, },
"screensaver": { "screensaver": {
"recipe_btn": "Recipes", "recipe_btn": "Recipes",
@@ -951,7 +992,8 @@
"thing_rest": "rest", "thing_rest": "rest",
"stay_btn": "No, stay in {location}", "stay_btn": "No, stay in {location}",
"moved_toast": "📦 Opened package moved to {location}", "moved_toast": "📦 Opened package moved to {location}",
"vacuum_restore": "🫙 Restore vacuum sealed" "vacuum_restore": "🫙 Restore vacuum sealed",
"vacuum_seal_rest": "🔒 Vacuum seal the rest"
}, },
"nova": { "nova": {
"1": "Unprocessed", "1": "Unprocessed",
+57 -15
View File
@@ -20,6 +20,8 @@
"add": "✅ Aggiungi", "add": "✅ Aggiungi",
"delete": "Elimina", "delete": "Elimina",
"edit": "✏️ Modifica", "edit": "✏️ Modifica",
"use": "Usa",
"edit_item": "Modifica",
"search": "🔍 Cerca", "search": "🔍 Cerca",
"go": "✅ Vai", "go": "✅ Vai",
"toggle_password": "👁️ Mostra/Nascondi", "toggle_password": "👁️ Mostra/Nascondi",
@@ -29,7 +31,12 @@
"restart": "↺ Ricomincia", "restart": "↺ Ricomincia",
"reset_default": "↺ Ripristina default", "reset_default": "↺ Ripristina default",
"save_info": "💾 Salva informazioni", "save_info": "💾 Salva informazioni",
"retry": "🔄 Riprova" "retry": "🔄 Riprova",
"yes_short": "Sì",
"no_short": "No"
},
"form": {
"select_placeholder": "-- Seleziona --"
}, },
"locations": { "locations": {
"dispensa": "Dispensa", "dispensa": "Dispensa",
@@ -64,7 +71,9 @@
"pieces": "Pezzi", "pieces": "Pezzi",
"grams": "Grammi", "grams": "Grammi",
"box": "Confezione", "box": "Confezione",
"boxes": "Confezioni" "boxes": "Confezioni",
"millilitres": "Millilitri",
"from": "da"
}, },
"shopping_sections": { "shopping_sections": {
"frutta_verdura": "Frutta & Verdura", "frutta_verdura": "Frutta & Verdura",
@@ -216,7 +225,7 @@
"throw_btn": "🗑️ BUTTA", "throw_btn": "🗑️ BUTTA",
"throw_sub": "butta il prodotto", "throw_sub": "butta il prodotto",
"edit_sub": "scadenza, luogo…", "edit_sub": "scadenza, luogo…",
"create_recipe_btn": "Crea una ricetta con questo" "create_recipe_btn": "Ricetta"
}, },
"add": { "add": {
"title": "Aggiungi alla Dispensa", "title": "Aggiungi alla Dispensa",
@@ -241,7 +250,9 @@
"scan_expiry_title": "📷 Scansiona Data Scadenza", "scan_expiry_title": "📷 Scansiona Data Scadenza",
"product_added": "✅ {name} aggiunto!{qty}", "product_added": "✅ {name} aggiunto!{qty}",
"suffix_freezer_vacuum": "(freezer + sotto vuoto)", "suffix_freezer_vacuum": "(freezer + sotto vuoto)",
"history_badge_tip": "Media da {n} inserimenti precedenti" "history_badge_tip": "Media da {n} inserimenti precedenti",
"vacuum_question": "Messo sotto vuoto?",
"vacuum_saved": "🔒 Sotto vuoto registrato"
}, },
"use": { "use": {
"title": "Usa / Consuma", "title": "Usa / Consuma",
@@ -313,7 +324,13 @@
"edit_info": "✏️ Modifica informazioni", "edit_info": "✏️ Modifica informazioni",
"modify_details": "MODIFICA\nscadenza, luogo…", "modify_details": "MODIFICA\nscadenza, luogo…",
"already_in_pantry": "📋 Già in dispensa", "already_in_pantry": "📋 Già in dispensa",
"no_barcode": "Senza barcode" "no_barcode": "Senza barcode",
"unknown_product": "Prodotto non riconosciuto",
"edit_name_brand": "Modifica nome/marca",
"weight_label": "Peso",
"origin_label": "Origine",
"labels_label": "Etichette",
"select_variant": "Seleziona la variante esatta o usa i dati AI:"
}, },
"products": { "products": {
"title": "📦 Tutti i Prodotti", "title": "📦 Tutti i Prodotti",
@@ -483,7 +500,8 @@
"undo_success": "↩ Operazione annullata per {name}", "undo_success": "↩ Operazione annullata per {name}",
"already_undone": "Operazione già annullata", "already_undone": "Operazione già annullata",
"too_old": "Non è possibile annullare operazioni più vecchie di 24 ore", "too_old": "Non è possibile annullare operazioni più vecchie di 24 ore",
"undo_error": "Errore durante l'annullamento" "undo_error": "Errore durante l'annullamento",
"recipe_prefix": "Ricetta"
}, },
"chat": { "chat": {
"title": "Gemini Chef", "title": "Gemini Chef",
@@ -503,7 +521,8 @@
"transfer_to_recipes": "Trasferisci a Ricette", "transfer_to_recipes": "Trasferisci a Ricette",
"transferring": "Trasferimento in corso...", "transferring": "Trasferimento in corso...",
"transferred": "Aggiunta alle Ricette!", "transferred": "Aggiunta alle Ricette!",
"open_recipe": "Apri la ricetta" "open_recipe": "Apri la ricetta",
"quick_recipe_prompt": "Suggeriscimi una ricetta veloce PER UNA PERSONA usando i prodotti che scadono prima! Ignora i prodotti in freezer, concentrati su frigo e dispensa."
}, },
"cooking": { "cooking": {
"close": "Chiudi", "close": "Chiudi",
@@ -520,7 +539,8 @@
"timer_warning_tts": "Attenzione! {label}: mancano 10 secondi!", "timer_warning_tts": "Attenzione! {label}: mancano 10 secondi!",
"recipe_done_tts": "Ricetta completata! Buon appetito!", "recipe_done_tts": "Ricetta completata! Buon appetito!",
"expires_chip": "scade {date}", "expires_chip": "scade {date}",
"finish": "✅ Fine" "finish": "✅ Fine",
"step_fallback": "Passo {n}"
}, },
"settings": { "settings": {
"title": "⚙️ Configurazione", "title": "⚙️ Configurazione",
@@ -631,7 +651,11 @@
"hint": "Se il browser mostra l'errore \"La connessione non è privata\" (ERR_CERT_AUTHORITY_INVALID), devi installare il certificato CA nel dispositivo.", "hint": "Se il browser mostra l'errore \"La connessione non è privata\" (ERR_CERT_AUTHORITY_INVALID), devi installare il certificato CA nel dispositivo.",
"download_btn": "📥 Scarica Certificato CA", "download_btn": "📥 Scarica Certificato CA",
"token_title": "🔑 Token Impostazioni", "token_title": "🔑 Token Impostazioni",
"token_label": "Token di accesso" "token_label": "Token di accesso",
"token_hint": "Se `SETTINGS_TOKEN` è configurato nel `.env` server, inserisci qui il token prima di salvare le impostazioni. Lascia vuoto se non configurato.",
"token_placeholder": "(vuoto = nessuna protezione)",
"token_required_hint": "🔒 Questo server richiede un token per salvare le impostazioni.",
"cert_instructions": "<strong>Istruzioni per Chrome (Android):</strong><br>1. Scarica il certificato qui sopra<br>2. Vai in <em>Impostazioni &rarr; Sicurezza e privacy &rarr; Altre impostazioni di sicurezza &rarr; Installa da archivio dispositivo</em><br>3. Seleziona il file <em>EverShelf_CA.crt</em> scaricato<br>4. Scegli \"CA\" e conferma<br>5. Riavvia Chrome<br><br><strong>Istruzioni per Chrome (PC):</strong><br>1. Scarica il certificato qui sopra<br>2. Vai in <em>chrome://settings/certificates</em> (o Impostazioni &rarr; Privacy e sicurezza &rarr; Sicurezza &rarr; Gestisci certificati)<br>3. Tab \"Autorità\" &rarr; Importa &rarr; seleziona il file<br>4. Spunta \"Considera attendibile per identificare siti web\"<br>5. Riavvia Chrome"
}, },
"tts": { "tts": {
"title": "🔊 Voce & TTS", "title": "🔊 Voce & TTS",
@@ -658,7 +682,14 @@
"extra_fields_label": " Campi extra (JSON)", "extra_fields_label": " Campi extra (JSON)",
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}", "extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
"extra_fields_hint": "Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.", "extra_fields_hint": "Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.",
"test_btn": "🔊 Invia Test Vocale" "test_btn": "🔊 Invia Test Vocale",
"voices_loading": "Caricamento voci…",
"voice_not_supported": "Voce non supportata dal browser",
"voices_none": "Nessuna voce disponibile su questo dispositivo",
"voices_hint": "Le voci disponibili dipendono dal sistema operativo e dal browser. Su macOS/iOS è disponibile la voce Paola (italiano). Premi ↺ se la lista non si carica.",
"url_missing": "⚠️ URL endpoint mancante.",
"test_sending": "⏳ Invio in corso…",
"test_ok": "✅ Risposta {code} — controlla che l'altoparlante abbia parlato."
}, },
"language": { "language": {
"title": "🌐 Lingua / Language", "title": "🌐 Lingua / Language",
@@ -676,7 +707,8 @@
"timeout_10": "10 minuti", "timeout_10": "10 minuti",
"timeout_15": "15 minuti", "timeout_15": "15 minuti",
"timeout_30": "30 minuti", "timeout_30": "30 minuti",
"timeout_60": "1 ora" "timeout_60": "1 ora",
"start_after": "⏱️ Avvia dopo"
}, },
"scale": { "scale": {
"title": "⚖️ Bilancia Smart", "title": "⚖️ Bilancia Smart",
@@ -691,7 +723,11 @@
"download_hint": "App Android che fa da ponte tra la bilancia BLE e questo sito.", "download_hint": "App Android che fa da ponte tra la bilancia BLE e questo sito.",
"download_sub": "Sorgente: evershelf-scale-gateway/ nella root del progetto", "download_sub": "Sorgente: evershelf-scale-gateway/ nella root del progetto",
"live_weight": "peso in tempo reale", "live_weight": "peso in tempo reale",
"auto_reconnect": "🔁 Riconnessione: automatica" "auto_reconnect": "🔁 Riconnessione: automatica",
"kiosk_title": "📡 Bilancia BLE integrata nel Kiosk",
"kiosk_hint": "La bilancia è gestita direttamente dal Gateway BLE interno al kiosk. Per abbinare un nuovo dispositivo usa il wizard di configurazione.",
"kiosk_reconfigure": "🔄 Riconfigura bilancia BLE",
"ble_protocols": "<p style=\"margin:0 0 6px;font-weight:600\">🔌 Protocolli BLE supportati:</p><ul style=\"margin:0 0 0 16px;padding:0;font-size:0.8rem\"><li>Bluetooth SIG Weight Scale (0x181D)</li><li>Bluetooth SIG Body Composition (0x181B) &mdash; peso, grasso, BMI</li><li>Xiaomi Mi Body Composition Scale 2</li><li>Generico &mdash; heuristica automatica su 100+ modelli</li></ul>"
}, },
"kiosk": { "kiosk": {
"hint": "Trasforma un tablet Android in un pannello EverShelf sempre acceso, con bilancia BLE integrata.", "hint": "Trasforma un tablet Android in un pannello EverShelf sempre acceso, con bilancia BLE integrata.",
@@ -838,7 +874,10 @@
"select_items": "Seleziona almeno un prodotto", "select_items": "Seleziona almeno un prodotto",
"server_offline": "Connessione al server persa", "server_offline": "Connessione al server persa",
"server_restored": "Connessione al server ripristinata", "server_restored": "Connessione al server ripristinata",
"server_retry": "Riprova" "server_retry": "Riprova",
"unknown": "Errore sconosciuto",
"prefix": "Errore",
"no_inventory_entry": "Nessuna voce di inventario trovata"
}, },
"confirm": { "confirm": {
"remove_item": "Vuoi davvero rimuovere questo prodotto dall'inventario?", "remove_item": "Vuoi davvero rimuovere questo prodotto dall'inventario?",
@@ -854,7 +893,9 @@
"edit": { "edit": {
"title": "Modifica {name}", "title": "Modifica {name}",
"unknown_hint": "Inserisci il nome e le informazioni del prodotto", "unknown_hint": "Inserisci il nome e le informazioni del prodotto",
"label_name": "🏷️ Nome prodotto" "label_name": "🏷️ Nome prodotto",
"choose_location_title": "Quale modifica?",
"choose_location_hint": "Scegli la posizione da modificare:"
}, },
"screensaver": { "screensaver": {
"recipe_btn": "Ricette", "recipe_btn": "Ricette",
@@ -951,7 +992,8 @@
"thing_rest": "il resto", "thing_rest": "il resto",
"stay_btn": "No, resta in {location}", "stay_btn": "No, resta in {location}",
"moved_toast": "📦 Confezione aperta spostata in {location}", "moved_toast": "📦 Confezione aperta spostata in {location}",
"vacuum_restore": "🫙 Torna sotto vuoto" "vacuum_restore": "🫙 Torna sotto vuoto",
"vacuum_seal_rest": "🔒 Metti sotto vuoto il resto"
}, },
"nova": { "nova": {
"1": "Non trasformato", "1": "Non trasformato",