#!/usr/bin/env node /** * Add data-i18n attributes to implementer.html based on translation keys * This script performs strategic replacements to add i18n attributes */ const fs = require('fs'); const path = require('path'); const HTML_FILE = path.join(__dirname, '../public/implementer.html'); console.log('Adding data-i18n attributes to implementer.html...\n'); let html = fs.readFileSync(HTML_FILE, 'utf8'); let changeCount = 0; // Architecture section const architectureReplacements = [ { from: '

System Architecture

', to: '

System Architecture

' }, { from: '

Six Core Services

', to: '

Six Core Services

' }, { from: 'BoundaryEnforcer (Tractatus 12.1-12.7)', to: 'BoundaryEnforcer (Tractatus 12.1-12.7)' }, { from: 'InstructionPersistenceClassifier', to: 'InstructionPersistenceClassifier' }, { from: 'CrossReferenceValidator', to: 'CrossReferenceValidator' }, { from: 'ContextPressureMonitor', to: 'ContextPressureMonitor' }, { from: 'MetacognitiveVerifier', to: 'MetacognitiveVerifier' }, { from: 'PluralisticDeliberationOrchestrator', to: 'PluralisticDeliberationOrchestrator' }, { from: '

Service Interaction Flow

', to: '

Service Interaction Flow

' }, { from: 'alt="Tractatus Framework Architecture: Shows how 6 governance services interact in sequence"', to: 'data-i18n-alt="architecture.main_flow_alt" alt="Tractatus Framework Architecture: Shows how 6 governance services interact in sequence"' }, { from: '

Service Trigger Conditions

', to: '

Service Trigger Conditions

' }, { from: 'alt="Service Trigger Decision Tree: When each framework service activates"', to: 'data-i18n-alt="architecture.trigger_tree_alt" alt="Service Trigger Decision Tree: When each framework service activates"' }, { from: '

System Architecture

\n

High-level overview showing how the 6 governance services integrate with your application and data layer.

', to: '

System Architecture

\n

High-level overview showing how the 6 governance services integrate with your application and data layer.

' }, { from: 'alt="Tractatus System Architecture: Component interaction and data flow"', to: 'data-i18n-alt="architecture.system_arch_alt" alt="Tractatus System Architecture: Component interaction and data flow"' }, { from: 'aria-label="Download architecture main flow diagram as SVG">', to: 'data-i18n-aria-label="architecture.download_svg_aria" aria-label="Download architecture main flow diagram as SVG">' }, { from: 'aria-label="Download service trigger decision tree as SVG">', to: 'data-i18n-aria-label="architecture.download_trigger_svg_aria" aria-label="Download service trigger decision tree as SVG">' }, { from: 'aria-label="Download system architecture diagram as SVG">', to: 'data-i18n-aria-label="architecture.download_system_svg_aria" aria-label="Download system architecture diagram as SVG">' }, // Download SVG text in buttons { from: '>Download SVG', to: '>Download SVG' } ]; // Apply architecture replacements architectureReplacements.forEach(({ from, to }) => { if (html.includes(from)) { html = html.replace(from, to); changeCount++; } }); console.log(`✓ Applied ${changeCount} replacements\n`); // Write updated HTML fs.writeFileSync(HTML_FILE, html, 'utf8'); console.log(`✅ Updated ${HTML_FILE}\n`); console.log(`Added ${changeCount} data-i18n attributes to Architecture section\n`);