Files
dockerank2/fix_all_translations.php
2026-09-01 07:49:48 -03:00

34 lines
1.1 KiB
PHP
Executable File

<?php
$langs = ['pt_BR', 'en', 'es'];
foreach ($langs as $lang) {
$allTranslations = [];
// Load all PHP translation files
$files = [
"/app/lang/$lang/auth.php",
"/app/lang/$lang/dashboard.php",
"/app/lang/$lang/legal.php",
"/app/lang/$lang/messages.php",
"/app/lang/$lang/welcome.php",
];
foreach ($files as $file) {
if (file_exists($file)) {
$translations = include $file;
$allTranslations = array_merge($allTranslations, $translations);
}
}
// For auth keys, also add auth. prefixed versions
if (file_exists("/app/lang/$lang/auth.php")) {
$authTranslations = include "/app/lang/$lang/auth.php";
foreach ($authTranslations as $key => $value) {
$allTranslations["auth.$key"] = $value;
}
}
$json = json_encode($allTranslations, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
file_put_contents("/app/lang/$lang.json", $json);
echo "Fixed $lang.json with " . count($allTranslations) . " translations" . PHP_EOL;
}