[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
co-authored by Claude Sonnet 4.6
parent a53b4beb37
commit 0e78ec24c1
11 changed files with 30 additions and 28 deletions
+20 -18
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>