From 1f05d88c4203e7cdf8e8330e8c4a497bd10fcf89 Mon Sep 17 00:00:00 2001 From: Nicolas Bouilleaud <nico@bou.io> Date: Thu, 18 Apr 2019 16:23:32 +0200 Subject: [PATCH] Remove old buildland / compare --- buildlang.php | 46 ---------------------------------- compare.php | 68 --------------------------------------------------- 2 files changed, 114 deletions(-) delete mode 100644 buildlang.php delete mode 100644 compare.php diff --git a/buildlang.php b/buildlang.php deleted file mode 100644 index 9677f405..00000000 --- a/buildlang.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -include_once __DIR__ . '/app/inc/init.php'; -?> -<html> -<head> - <meta charset="utf-8"/> -</head> -<body><pre><?php - - $goodLang = $_GET['good']; - $otherLang = $_GET['other']; - - $good = json_decode(file_get_contents(__DIR__ . '/locale/' . $goodLang . '.json'), true); - $other = json_decode(file_get_contents(__DIR__ . '/locale/' . $otherLang . '.json'), true); - - foreach ($good as $sectionName => $section) { - foreach ($section as $key => $value) { - $good[$sectionName][$key] = getFromOther($other, $key, $value, $otherLang); - } - } - - echo json_encode($good, JSON_PRETTY_PRINT | ~(JSON_ERROR_UTF8 | JSON_HEX_QUOT | JSON_HEX_APOS)); - - function getFromOther($other, $goodKey, $default, $otherLang) { - foreach ($other as $sectionName => $section) { - foreach ($section as $key => $value) { - if ( - strtolower($key) === strtolower($goodKey) || - strtolower(trim($key)) === strtolower($goodKey) || - strtolower(substr($key, 0, strlen($key) - 1)) === 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> diff --git a/compare.php b/compare.php deleted file mode 100644 index aaa70676..00000000 --- a/compare.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -include_once __DIR__ . '/app/inc/init.php'; -?> -<html> -<head> - <meta charset="utf-8"/> -</head> -<body><pre><?php - - $goodLang = $_GET['good']; - $testLang = $_GET['test']; - - $good = json_decode(file_get_contents(__DIR__ . '/locale/' . $goodLang . '.json'), true); - $test = json_decode(file_get_contents(__DIR__ . '/locale/' . $testLang . '.json'), true); - - $diffSection = false; - - foreach ($good as $sectionName => $section) { - if (!isset($test[$sectionName])) { - echo '- section: ' . $sectionName . "\n"; - $diffSection = true; - } - } - foreach ($test as $sectionName => $section) { - if (!isset($good[$sectionName])) { - echo '+ section: ' . $sectionName . "\n"; - $diffSection = true; - } - } - - if (!$diffSection and array_keys($good)!==array_keys($test)) { - var_dump(array_keys($good)); - var_dump(array_keys($test)); - } else { - echo 'All sections are in two langs.' . "\n"; - } - - $diff = []; - - foreach ($good as $sectionName => $section) { - $diffSection = false; - foreach($section as $key=>$value) { - if (!isset($test[$sectionName][$key])) { - $diff[$sectionName]['-'][] = $key; - $diffSection = true; - } - } - - if (!$diffSection and array_keys($good[$sectionName]) !== array_keys($test[$sectionName])) { - $diff[$sectionName]['order_good'] = array_keys($good[$sectionName]); - $diff[$sectionName]['order_test'] = array_keys($test[$sectionName]); - } - } - - foreach ($test as $sectionName => $section) { - foreach($section as $key=>$value) { - if (!isset($good[$sectionName][$key])) { - $diff[$sectionName]['+'][] = $key; - } - } - } - if (count($diff) > 0) { - var_dump($diff); - } - ?> -</pre> -</body> -</html> -- GitLab