feat: add automated scripts and JSON datasets for managing and translating site content
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
$trPath = __DIR__.'/lang/tr';
|
||||
$enPath = __DIR__.'/lang/en';
|
||||
|
||||
$trFiles = scandir($trPath);
|
||||
$enFiles = scandir($enPath);
|
||||
|
||||
$missingFiles = array_diff($trFiles, $enFiles);
|
||||
if (!empty($missingFiles)) {
|
||||
echo "Missing files in lang/en: " . implode(', ', $missingFiles) . "\n";
|
||||
} else {
|
||||
echo "All language files exist in both directories.\n";
|
||||
}
|
||||
|
||||
foreach ($trFiles as $file) {
|
||||
if ($file === '.' || $file === '..') continue;
|
||||
if (pathinfo($file, PATHINFO_EXTENSION) !== 'php') continue;
|
||||
|
||||
$trData = include($trPath.'/'.$file);
|
||||
$enData = [];
|
||||
if (file_exists($enPath.'/'.$file)) {
|
||||
$enData = include($enPath.'/'.$file);
|
||||
}
|
||||
|
||||
$missingKeys = [];
|
||||
foreach ($trData as $key => $val) {
|
||||
if (!isset($enData[$key])) {
|
||||
$missingKeys[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($missingKeys)) {
|
||||
echo "File: $file has missing keys in EN: " . implode(', ', $missingKeys) . "\n";
|
||||
}
|
||||
}
|
||||
echo "Static translation key check completed.\n";
|
||||
Reference in New Issue
Block a user