<?php
$domain  = 'ai-translator-for-elementor-and-polylang';
$locales = ['de_DE','es_ES','fr_FR','it_IT','nl_NL','pl_PL','pt_BR','ru_RU','uk'];

foreach ($locales as $locale) {
    $f = __DIR__ . "/{$domain}-{$locale}.po";
    if (!file_exists($f)) { echo "SKIP $locale\n"; continue; }
    $c   = file_get_contents($f);
    $new = preg_replace('/\nmsgid "Original textu2026"\nmsgstr "[^"]*"\n/', "\n", $c);
    if ($new !== $c) {
        file_put_contents($f, $new);
        echo "[$locale] Removed corrupt u2026 entry\n";
    } else {
        echo "[$locale] Clean\n";
    }
}

echo "\nRecompiling .mo files...\n";
require_once __DIR__ . '/generate-mo-files.php';
echo "Done!\n";
