#!/bin/bash

echo "=== TRANSLATING ALL LANGUAGES SEQUENTIALLY ==="
echo ""

echo "Starting Dutch (nl) translation..."
php artisan ai-translator:translate-json --source=en --locale=nl --non-interactive --chunk=100
echo ""
echo "Dutch complete! Waiting 10 seconds before next language..."
sleep 10

echo ""
echo "Starting German (de) translation..."
php artisan ai-translator:translate-json --source=en --locale=de --non-interactive --chunk=100
echo ""
echo "German complete! Waiting 10 seconds before next language..."
sleep 10

echo ""
echo "Starting Spanish (es) translation..."
php artisan ai-translator:translate-json --source=en --locale=es --non-interactive --chunk=100
echo ""
echo "Spanish complete! Waiting 10 seconds before next language..."
sleep 10

echo ""
echo "Starting French (fr) translation..."
php artisan ai-translator:translate-json --source=en --locale=fr --non-interactive --chunk=100
echo ""

echo ""
echo "=== ALL TRANSLATIONS COMPLETE ==="
echo ""

# Show final counts
echo "Final key counts:"
php -r "
\$en = json_decode(file_get_contents('resources/lang/en.json'), true);
\$nl = json_decode(file_get_contents('resources/lang/nl.json'), true);
\$de = json_decode(file_get_contents('resources/lang/de.json'), true);
\$es = json_decode(file_get_contents('resources/lang/es.json'), true);
\$fr = json_decode(file_get_contents('resources/lang/fr.json'), true);

echo \"  en: \" . count(\$en) . \" keys\n\";
echo \"  nl: \" . count(\$nl) . \" keys\n\";
echo \"  de: \" . count(\$de) . \" keys\n\";
echo \"  es: \" . count(\$es) . \" keys\n\";
echo \"  fr: \" . count(\$fr) . \" keys\n\";
"
