Changeset 4644 for branches/2.0
- Timestamp:
- Jan 10, 2010, 12:26:45 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/tools/translation_analysis.php
r4638 r4644 56 56 ); 57 57 58 $output = '';58 $output_missing = ''; 59 59 foreach ($missing_keys as $key) 60 60 { 61 $print_key = str_replace("'", '\\\'', $key); 62 $print_value = str_replace("'", '\\\'', $metalang[ $page['ref_default_values'] ][$file][$key]); 63 $output.= '$'."lang['".$print_key."'] = '".$print_value."';\n"; 61 $output_missing.= get_line_to_translate($file, $key); 64 62 } 65 63 66 if ('' != $output) 64 // strings not "really" translated? 65 $output_duplicated = ''; 66 foreach (array_keys($metalang[$language][$file]) as $key) 67 67 { 68 $exceptions = array('Level 0'); 69 if (in_array($key, $exceptions)) 70 { 71 continue; 72 } 73 74 $local_value = $metalang[$language][$file][$key]; 75 $ref_value = $metalang[ $page['ref_default_values'] ][$file][$key]; 76 if ($local_value == $ref_value) 77 { 78 $output_duplicated.= get_line_to_translate($file, $key); 79 } 80 } 81 82 if ('' != $output_missing or '' != $output_duplicated) 83 { 84 $output = ''; 85 if ('' != $output_missing) 86 { 87 $output.= "// missing translations\n".$output_missing; 88 } 89 if ('' != $output_duplicated) 90 { 91 $output.= "\n// untranslated yet\n".$output_duplicated; 92 } 68 93 echo '<h3>'.$file.'.lang.php</h3>'; 69 94 echo '<textarea style="width:100%;height:150px;">'.$output.'</textarea>'; … … 93 118 return $metalang; 94 119 } 120 121 function get_line_to_translate($file, $key) 122 { 123 global $metalang, $page; 124 125 $print_key = str_replace("'", '\\\'', $key); 126 $print_value = str_replace("'", '\\\'', $metalang[ $page['ref_default_values'] ][$file][$key]); 127 return '$'."lang['".$print_key."'] = '".$print_value."';\n"; 128 } 95 129 ?>
Note: See TracChangeset
for help on using the changeset viewer.