<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

// Test Spanish locale
app()->setLocale('es');
echo "Locale: " . app()->getLocale() . "\n\n";

// Try to translate a key
$key = 'app/register.verification.title';
$translation = __($key);

echo "Translation of '$key':\n";
echo "Result: $translation\n\n";

if ($translation === $key) {
    echo "❌ TRANSLATION FAILED - returned key itself\n";
    echo "This means Spanish translations are NOT being loaded!\n\n";

    // Check if file exists
    $file = base_path('lang/es/app/register.php');
    echo "File exists: " . (file_exists($file) ? 'YES' : 'NO') . "\n";
    echo "File path: $file\n";

    if (file_exists($file)) {
        $data = include($file);
        echo "File returns array: " . (is_array($data) ? 'YES' : 'NO') . "\n";
        echo "Key exists in array: " . (isset($data['verification.title']) ? 'YES' : 'NO') . "\n";
    }
} else {
    echo "✓ Translation worked!\n";
}

// Test Romanian for comparison
echo "\n--- ROMANIAN TEST ---\n";
app()->setLocale('ro');
$translation = __($key);
echo "RO Translation: $translation\n";
