[FIX] i18n funzionante + bug audit.html + help system

- common.js: aggiunto i18nKey a navItems, data-i18n su sezioni e voci
  sidebar → toggle IT/EN ora traduce la navigazione in tempo reale
- Tutte e 10 le pagine HTML: aggiunto data-i18n="*.title" agli h2
  (dashboard, assessment, risks, incidents, policies, supply-chain,
  training, assets, reports, settings)
- FIX BUG: sidebar puntava ad audit.html (inesistente) → corretto
  in reports.html
- HelpSystem: funziona correttamente in tutte le 10 pagine
  (content-header-actions presente, init() chiamato)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
DevEnv nis2-agile 2026-02-20 11:17:04 +01:00
parent a53b4beb37
commit 0e78ec24c1
11 changed files with 30 additions and 28 deletions

View File

@ -14,7 +14,7 @@
<!-- Main Content -->
<main class="main-content">
<header class="content-header">
<h2>Gap Analysis</h2>
<h2 data-i18n="assessment.title">Gap Analysis NIS2</h2>
<div class="content-header-actions">
<button class="btn btn-outline btn-sm" id="btn-ai-analyze" style="display:none;" onclick="aiAnalyze()">
<svg viewBox="0 0 20 20" fill="currentColor" width="16" height="16"><path d="M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zm7-10a1 1 0 01.967.744L14.146 7.2 17.5 8.512a1 1 0 010 1.836l-3.354 1.311-1.18 4.456a1 1 0 01-1.932 0L9.854 11.66 6.5 10.348a1 1 0 010-1.836l3.354-1.311 1.18-4.456A1 1 0 0112 2z"/></svg>

View File

@ -261,7 +261,7 @@
<main class="main-content">
<header class="content-header">
<h2>Inventario Asset</h2>
<h2 data-i18n="assets.title">Inventario Asset</h2>
<div class="content-header-actions">
<span class="text-muted" style="font-size:0.8rem; margin-right:8px;">Art. 21.2.i NIS2</span>
<button class="btn btn-primary" onclick="showCreateAssetModal()">+ Nuovo Asset</button>

View File

@ -14,7 +14,7 @@
<!-- Main Content -->
<main class="main-content">
<header class="content-header">
<h2>Dashboard</h2>
<h2 data-i18n="dashboard.title">Dashboard</h2>
<div class="content-header-actions">
<span class="text-muted" id="header-date"></span>
</div>

View File

@ -262,7 +262,7 @@
<main class="main-content">
<header class="content-header">
<h2>Gestione Incidenti</h2>
<h2 data-i18n="incidents.title">Gestione Incidenti</h2>
<div class="content-header-actions">
<button class="btn btn-primary" onclick="showCreateIncidentModal()">+ Nuovo Incidente</button>
</div>

View File

@ -183,33 +183,33 @@ function loadSidebar() {
const navItems = [
{
label: 'Principale',
label: 'Principale', i18nKey: 'nav.main',
items: [
{ name: 'Dashboard', href: 'dashboard.html', icon: iconGrid() },
{ name: 'Gap Analysis', href: 'assessment.html', icon: iconClipboardCheck() },
{ name: 'Dashboard', href: 'dashboard.html', icon: iconGrid(), i18nKey: 'nav.dashboard' },
{ name: 'Gap Analysis', href: 'assessment.html', icon: iconClipboardCheck(), i18nKey: 'nav.gap_analysis' },
]
},
{
label: 'Gestione',
label: 'Gestione', i18nKey: 'nav.management',
items: [
{ name: 'Rischi', href: 'risks.html', icon: iconShieldExclamation() },
{ name: 'Incidenti', href: 'incidents.html', icon: iconBell() },
{ name: 'Policy', href: 'policies.html', icon: iconDocumentText() },
{ name: 'Supply Chain', href: 'supply-chain.html', icon: iconLink() },
{ name: 'Rischi', href: 'risks.html', icon: iconShieldExclamation(), i18nKey: 'nav.risks' },
{ name: 'Incidenti', href: 'incidents.html', icon: iconBell(), i18nKey: 'nav.incidents' },
{ name: 'Policy', href: 'policies.html', icon: iconDocumentText(), i18nKey: 'nav.policies' },
{ name: 'Supply Chain', href: 'supply-chain.html', icon: iconLink(), i18nKey: 'nav.supply_chain' },
]
},
{
label: 'Operativo',
label: 'Operativo', i18nKey: 'nav.operations',
items: [
{ name: 'Formazione', href: 'training.html', icon: iconAcademicCap() },
{ name: 'Asset', href: 'assets.html', icon: iconServer() },
{ name: 'Audit & Report', href: 'audit.html', icon: iconChartBar() },
{ name: 'Formazione', href: 'training.html', icon: iconAcademicCap(), i18nKey: 'nav.training' },
{ name: 'Asset', href: 'assets.html', icon: iconServer(), i18nKey: 'nav.assets' },
{ name: 'Audit & Report',href: 'reports.html', icon: iconChartBar(), i18nKey: 'nav.audit' },
]
},
{
label: 'Sistema',
label: 'Sistema', i18nKey: 'nav.system',
items: [
{ name: 'Impostazioni', href: 'settings.html', icon: iconCog() },
{ name: 'Impostazioni', href: 'settings.html', icon: iconCog(), i18nKey: 'nav.settings' },
{ name: 'Architettura', href: 'architecture.html', icon: iconCubeTransparent() },
]
}
@ -236,10 +236,12 @@ function loadSidebar() {
// Nav sections
navHTML += '<nav class="sidebar-nav">';
for (const section of navItems) {
navHTML += `<div class="sidebar-nav-label">${section.label}</div>`;
const sectionI18n = section.i18nKey ? ` data-i18n="${section.i18nKey}"` : '';
navHTML += `<div class="sidebar-nav-label"${sectionI18n}>${section.label}</div>`;
for (const item of section.items) {
const isActive = currentPage === item.href ? 'active' : '';
navHTML += `<a href="${item.href}" class="${isActive}">${item.icon}<span>${item.name}</span></a>`;
const spanI18n = item.i18nKey ? ` data-i18n="${item.i18nKey}"` : '';
navHTML += `<a href="${item.href}" class="${isActive}">${item.icon}<span${spanI18n}>${item.name}</span></a>`;
}
}
navHTML += '</nav>';
@ -248,8 +250,8 @@ function loadSidebar() {
navHTML += `
<div class="sidebar-footer">
<div class="sidebar-lang-toggle" id="sidebar-lang-toggle">
<button class="lang-btn ${_getSavedLang() === 'it' ? 'active' : ''}" onclick="switchLang('it')" title="Italiano">IT</button>
<button class="lang-btn ${_getSavedLang() === 'en' ? 'active' : ''}" onclick="switchLang('en')" title="English">EN</button>
<button class="lang-btn ${_getSavedLang() === 'it' ? 'active' : ''}" onclick="switchLang('it')" title="Italiano" aria-label="Italiano">IT</button>
<button class="lang-btn ${_getSavedLang() === 'en' ? 'active' : ''}" onclick="switchLang('en')" title="English" aria-label="English">EN</button>
</div>
<div class="sidebar-user">
<div class="sidebar-user-avatar" id="sidebar-user-avatar">--</div>

View File

@ -242,7 +242,7 @@
<main class="main-content">
<header class="content-header">
<h2>Policy</h2>
<h2 data-i18n="policies.title">Gestione Policy</h2>
<div class="content-header-actions">
<button class="btn btn-outline" onclick="openAIGenerateModal()">
<svg viewBox="0 0 20 20" fill="currentColor" width="16" height="16"><path d="M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zm7-10a1 1 0 01.967.744L14.146 7.2 17.5 8.512a1 1 0 010 1.836l-3.354 1.311-1.18 4.456a1 1 0 01-1.932 0L9.854 11.66 6.5 10.348a1 1 0 010-1.836l3.354-1.311 1.18-4.456A1 1 0 0112 2z"/></svg>

View File

@ -346,7 +346,7 @@
<main class="main-content">
<header class="content-header">
<h2>Audit e Report</h2>
<h2 data-i18n="audit.title">Audit &amp; Report</h2>
<div class="content-header-actions">
<button class="btn btn-primary" onclick="generateReport()">Genera Report</button>
</div>

View File

@ -301,7 +301,7 @@
<main class="main-content">
<header class="content-header">
<h2>Gestione Rischi</h2>
<h2 data-i18n="risks.title">Gestione Rischi</h2>
<div class="content-header-actions">
<div class="view-toggle" id="view-toggle">
<button class="active" onclick="switchView('table')">Tabella</button>

View File

@ -199,7 +199,7 @@
<main class="main-content">
<header class="content-header">
<h2>Impostazioni</h2>
<h2 data-i18n="settings.title">Impostazioni</h2>
<div class="content-header-actions">
<span class="text-muted" id="header-org-name"></span>
</div>

View File

@ -368,7 +368,7 @@
<main class="main-content">
<header class="content-header">
<h2>Supply Chain</h2>
<h2 data-i18n="supply_chain.title">Sicurezza Supply Chain</h2>
<div class="content-header-actions">
<button class="btn btn-primary" onclick="openCreateModal()">+ Nuovo Fornitore</button>
</div>

View File

@ -224,7 +224,7 @@
<main class="main-content">
<header class="content-header">
<h2>Formazione</h2>
<h2 data-i18n="training.title">Formazione e Awareness</h2>
<div class="content-header-actions">
<span class="text-muted" style="font-size:0.8rem; margin-right:8px;">Art. 20 NIS2</span>
<button class="btn btn-primary" onclick="showCreateCourseModal()">+ Nuovo Corso</button>