$tlLoader->tl('concordance', 'concordance', 'concordance_checker'), 'intro' => $tlLoader->tl('concordance', 'concordance', 'intro'), 'one_line_per_entry' => $tlLoader->tl('concordance', 'concordance', 'one_line_per_entry'), 'submit' => $tlLoader->tl('concordance', 'concordance', 'submit'), 'passed' => $tlLoader->tl('concordance', 'concordance', 'passed'), 'not_yet_matched' => $tlLoader->tl('concordance', 'concordance', 'not_yet_matched'), 'input' => $tlLoader->tl('concordance', 'concordance', 'input'), 'generate_code_snippet' => $tlLoader->tl('concordance', 'concordance', 'generate_code_snippet'), ]; foreach (ConcordanceChecker::getLists() as $list) { $output[$list] = $tlLoader->tl('concordance', 'concordance', $list); } return MD_STD::json_encode($output); } /** * Generates the json for a translation file. * * @param string $lang Language. * * @return array */ function generateTranslationFilesForMatchOptions(string $lang):array { $tlLoader = new MDTlLoader("mdConc", $lang); $output = []; foreach (ConcordanceChecker::getLists() as $list) { $options = []; foreach ((new ConcordanceChecker($list))->getMatchOptions($lang) as $value) { $options[(string)$value['id']] = $value['name']; } $output[$list] = MD_STD::json_encode($options); } return $output; } /** * Generate index.htm. * * @return string */ function generateAppShell():string { return ' Concordance checker :: museum-digital '; } const ALLOWED_LANGS = ['de', 'en']; const SERVED_ROOT = __DIR__ . '/public/'; const SERVED_JSON_ROOT = __DIR__ . '/public/static/json/'; if (!is_dir(SERVED_JSON_ROOT)) { echo "Will generate JSON root directory (" . SERVED_JSON_ROOT . ")" . PHP_EOL; MD_STD::mkdir(SERVED_JSON_ROOT); } foreach (ALLOWED_LANGS as $lang) { echo "Will generate JSON list of translations for language: " . $lang . PHP_EOL; file_put_contents(SERVED_JSON_ROOT . 'tls.' . $lang . '.json', generateTranslationFile($lang)); foreach (generateTranslationFilesForMatchOptions($lang) as $list => $tls) { file_put_contents(SERVED_JSON_ROOT . 'tls.' . $list . '.' . $lang . '.json', $tls); } } echo "Will generate app shell" . PHP_EOL; file_put_contents(SERVED_ROOT . 'index.htm', generateAppShell()); echo "Will minify CSS" . PHP_EOL; exec("minify \\ -o " . escapeshellarg(__DIR__ . '/public/static/css/qa.min.css') . '\\ ' . escapeshellarg(__DIR__ . '/public/static/css/editMenu.css') . '\\ ' . escapeshellarg(__DIR__ . '/public/static/css/dialogue.css') . '\\ ' . escapeshellarg(__DIR__ . '/public/static/css/qa.css')); echo "Will minify JS" . PHP_EOL; exec("minify \\ -o " . escapeshellarg(__DIR__ . '/public/static/js/qa.min.js') . '\ ' . escapeshellarg(__DIR__ . '/public/static/js/qa.js'));