<?php

echo "=== FINAL TRANSLATION VERIFICATION ===\n\n";

$langs = ['en', 'nl', 'de', 'es', 'fr'];

foreach ($langs as $lang) {
    $file = "resources/lang/{$lang}.json";
    $data = json_decode(file_get_contents($file), true);
    $count = count($data);

    if ($lang !== 'en') {
        $untranslated = 0;
        foreach ($data as $key => $value) {
            if ($key === $value) {
                $untranslated++;
            }
        }
        $translated = $count - $untranslated;
        $percentage = round(($translated / $count) * 100, 1);
        echo sprintf("%-4s: %4d keys  |  %4d translated (%5.1f%%)  |  %3d remaining\n",
            strtoupper($lang), $count, $translated, $percentage, $untranslated);
    } else {
        echo sprintf("%-4s: %4d keys  (source)\n", strtoupper($lang), $count);
    }
}

echo "\n✓ All languages have been synchronized!\n";
