#!/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: '
High-level overview showing how the 6 governance services integrate with your application and data layer.
', to: '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`);