Fix issue with translation request file builder script

pull/2487/head
Yannick Warnier 9 years ago
parent a923f00c06
commit 26ab5b1a6f
  1. 11
      tests/scripts/build_translation_request_file.php

@ -22,10 +22,11 @@ if (is_file($file)) {
$referenceTerms = array_merge($referenceTerms, SubLanguageManager::get_all_language_variable_in_file($file,true));
}
// get only the array keys (the language variables defined in language files)
$definedTerms = array_flip(array_keys($referenceTerms));
$definedTerms = array_keys($referenceTerms);
//print_r($definedTerms);
//$referenceTerms = null;
// now get all terms found in all PHP files of Chamilo (this takes some time and memory)
// now get all terms found in the destination language files of Chamilo (this takes some time and memory)
$missingTerms = array();
$nonMissingTerms = array();
$l = strlen(api_get_path(SYS_PATH));
@ -33,15 +34,17 @@ $file = $path . $language . '/trad4all.inc.php';
if (is_file($file)) {
$nonMissingTerms = array_merge($nonMissingTerms, SubLanguageManager::get_all_language_variable_in_file($file,true));
}
$nonMissingTerms = array_flip(array_keys($nonMissingTerms));
$nonMissingTerms = array_keys($nonMissingTerms);
//print_r($nonMissingTerms);
$missingTerms = array_diff($definedTerms, $nonMissingTerms);
//print_r($missingTerms);
echo "<table border='1'>\n";
echo "<tr><th>Count</th><th>Term</th><th>English</th><th>German</th></tr>";
$i = 1;
$countWords = 0;
foreach ($missingTerms as $term => $value) {
foreach ($missingTerms as $key => $term) {
if (isset($referenceTerms[$term])) {
$trimmed = trim($referenceTerms[$term],';" ');
$countWords += str_word_count($trimmed);

Loading…
Cancel
Save