// Quick test script to validate translations
const fs = require('fs');

// Load and parse translations manually
const translationsCode = fs.readFileSync('translations.js', 'utf8');

// Extract just the translations object
const translationsMatch = translationsCode.match(/const translations = ({[\s\S]*?});/);
if (!translationsMatch) {
    console.error('Could not parse translations');
    process.exit(1);
}

const translations = eval(`(${translationsMatch[1]})`);

// Test key translations exist
const testKeys = [
    'title', 'tagline', 'welcome-title', 'welcome-text',
    'ai-teacher', 'scientific-explanation', 'type-thoughts-placeholder', 
    'send-button', 'the-answer', 'reveal-answer', 'getting-answer',
    'great-thinking-fallback', 'thinking-about-answer', 'hmm'
];

console.log('🧪 Testing translation completeness...\n');

let allGood = true;

testKeys.forEach(key => {
    const enExists = translations.en[key] !== undefined;
    const deExists = translations.de[key] !== undefined;
    
    if (!enExists || !deExists) {
        console.log(`❌ Missing translation for '${key}': EN=${enExists}, DE=${deExists}`);
        allGood = false;
    } else {
        console.log(`✅ '${key}': EN="${translations.en[key]}" | DE="${translations.de[key]}"`);
    }
});

if (allGood) {
    console.log('\n🎉 All translations complete!');
} else {
    console.log('\n⚠️ Some translations are missing');
}
