2015-08-31 08:56:26 +02:00
|
|
|
<?php
|
|
|
|
include_once __DIR__ . '/app/inc/init.php';
|
|
|
|
?>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8"/>
|
|
|
|
</head>
|
|
|
|
<body><pre><?php
|
|
|
|
|
|
|
|
$goodLang = $_GET['good'];
|
|
|
|
$otherLang = $_GET['other'];
|
|
|
|
|
2021-12-20 17:46:50 +01:00
|
|
|
$good = json_decode(file_get_contents(__DIR__ . '/locale/' . $goodLang . '.json'), true, 512, JSON_THROW_ON_ERROR);
|
|
|
|
$other = json_decode(file_get_contents(__DIR__ . '/locale/' . $otherLang . '.json'), true, 512, JSON_THROW_ON_ERROR);
|
2015-08-31 08:56:26 +02:00
|
|
|
|
|
|
|
foreach ($good as $sectionName => $section) {
|
|
|
|
foreach ($section as $key => $value) {
|
|
|
|
$good[$sectionName][$key] = getFromOther($other, $key, $value, $otherLang);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-20 17:46:50 +01:00
|
|
|
echo json_encode($good, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | ~(JSON_ERROR_UTF8 | JSON_HEX_QUOT | JSON_HEX_APOS));
|
2015-08-31 08:56:26 +02:00
|
|
|
|
2021-12-20 17:46:50 +01:00
|
|
|
function getFromOther($other, $goodKey, $default, $otherLang): string {
|
2015-08-31 08:56:26 +02:00
|
|
|
foreach ($other as $sectionName => $section) {
|
|
|
|
foreach ($section as $key => $value) {
|
|
|
|
if (
|
|
|
|
strtolower($key) === strtolower($goodKey) ||
|
2021-12-20 17:46:50 +01:00
|
|
|
stripos($key, strtolower($goodKey)) === 0 ||
|
2015-08-31 08:56:26 +02:00
|
|
|
strtolower(trim($key)) === strtolower($goodKey) ||
|
|
|
|
strtolower(trim(substr(trim($key), 0, strlen($key) - 1))) === strtolower($goodKey)
|
|
|
|
) {
|
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '[-]' . $goodKey . "\n";
|
|
|
|
|
|
|
|
return strtoupper($otherLang) . '_' . $default;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|