$installVarList = array(); foreach ($languageVarList as $var) { $installVarList[$var] = $var; } // generate english file // - get vars from english install lang file // - merge the two // - generate new language file $_lang = array(); $englishLangFile = get_path('rootSys') . 'claroline/lang/english/install.lang.php'; if (file_exists($englishLangFile)) { include $englishLangFile; } $completeInstallVarList = array_merge($installVarList, $_lang); $output = '<?php' . "\n"; foreach ($completeInstallVarList as $key => $value) { $output .= build_translation_line_file($key, $value); } $output .= '?>'; // write to file file_put_contents($englishLangFile, $output); echo "<p>Total variables: " . $total_var_count . "</p>"; // end time $endtime = get_time(); $totaltime = $endtime - $starttime; echo "<p><em>Execution time: {$totaltime}</em></p>\n"; } else { echo '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=generate">' . 'Generate it, it will overwrite previous /lang/english/install.lang.php file' . '</a>'; } // display footer include get_path('incRepositorySys') . '/claro_init_footer.inc.php';
} // build language files if (count($languageVarList) > 0) { echo "<ol>\n"; foreach ($languageVarList as $thisLanguageFilename => $thisLangVarList) { echo "<li>"; // add extension to file $languageFile = $thisLanguageFilename . '.lang.php'; echo "Create file: " . $languagePath . "/" . $languageFile; // open in write access language file $fileHandle = fopen($languageFile, 'w') or die("FILE OPEN FAILED: " . __LINE__); if ($fileHandle && count($thisLangVarList)) { // write php header fwrite($fileHandle, '<?php' . "\n"); foreach ($thisLangVarList as $thisLangVar) { $string = build_translation_line_file($thisLangVar['name'], $thisLangVar['content']); fwrite($fileHandle, $string) or die("FILE WRITE FAILED: " . __LINE__); } // write php footer fwrite($fileHandle, "?>"); } fclose($fileHandle) or die("FILE CLOSE FAILED: " . __LINE__); echo "</li>\n"; } echo "</ol>\n"; } } } // get end time $endtime = get_time(); $totaltime = $endtime - $starttime;
die("QUERY FAILED: " . __LINE__); } // build language files fclose($fileHandle) or die("FILE CLOSE FAILED: " . __LINE__); echo '<p><a href="' . $urlAppend . '/claroline/lang/' . LANG_EMPTY_FILENAME . '">Download it</a></p>'; //-- INSTALL $sqlInstall = "SELECT DISTINCT u.varName\n FROM " . $tbl_used_lang . " u\n WHERE u.sourceFile LIKE '%/install/%'\n ORDER BY u.varName"; $installVarList = claro_sql_query_fetch_all_rows($sqlInstall); if (is_array($installVarList)) { echo '<p>Create file: ' . $path_lang . '/' . LANG_EMPTY_INSTALL_FILENAME . '</p>' . "\n"; $fileHandle = fopen(LANG_EMPTY_INSTALL_FILENAME, 'w') or die("FILE OPEN FAILED: " . __LINE__); if ($fileHandle) { fwrite($fileHandle, "<?php \n"); if (!empty($installVarList)) { foreach ($installVarList as $installVar) { $string = build_translation_line_file($installVar['varName'], ''); fwrite($fileHandle, $string) or die("FILE WRITE FAILED: " . __LINE__); } } fwrite($fileHandle, "?>"); } } else { die("QUERY FAILED: " . __LINE__); } // build language files fclose($fileHandle) or die("FILE CLOSE FAILED: " . __LINE__); echo '<p><a href="' . $urlAppend . '/claroline/lang/' . LANG_EMPTY_INSTALL_FILENAME . '">Download it</a></p>'; // get end time $endtime = get_time(); $totaltime = $endtime - $starttime; echo "<p><em>Execution time: {$totaltime}</em></p>\n" . '<a href="' . $urlTranslation . '"><< Back</a>' . "\n";
} else { echo '<li><em>Not found :</em> ' . $old_value . '</li>' . "\n"; } } echo '</ol>' . "\n"; // Write new file if ($nb_update > 0) { echo '<ul>'; echo '<li>Save file : ' . $path_lang . "/" . $language . "/" . LANG_COMPLETE_FILENAME . '</li>'; $fileHandle = fopen($path_lang . "/" . $language . "/" . LANG_COMPLETE_FILENAME, 'w') or die("FILE OPEN FAILED: " . __LINE__); // build language files if ($fileHandle && count($language_list) > 0) { fwrite($fileHandle, "<?php \n"); ksort($language_list); foreach ($language_list as $varName => $varContent) { $string = build_translation_line_file($varName, $varContent); fwrite($fileHandle, $string) or die("FILE WRITE FAILED: " . __LINE__); } fwrite($fileHandle, "?>"); } fclose($fileHandle) or die("FILE CLOSE FAILED: " . __LINE__); echo '</ul>'; } echo '</li>' . "\n"; } // end foreach languages echo '</ul>'; } // if isset($language) // get end time $endtime = get_time();