Changeset 2178 in subversion
- Timestamp:
- Dec 18, 2008 1:04:51 PM (4 years ago)
- Location:
- trunk/translator
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/translator/func.php
r2173 r2178 43 43 if ($fp && !$err && ($fl = @fopen(LANGDIR."$lang_prefix$file", 'w'))) 44 44 { 45 // echo '<div class="console">Update from SVN: '.$lang_dir.$file.'</div>';45 echo '<!-- Update from SVN: ' . $lang_dir.$file . "-->\n"; 46 46 while (!feof($fp)) 47 47 { … … 131 131 } 132 132 133 function count_lines($ filename)133 function count_lines($lang, $file) 134 134 { 135 135 $count = 0; 136 136 $lines = array(); 137 137 138 if (file_exists($filename))138 if ($filename = update_from_svn($lang, $file)) 139 139 $lines = file($filename); 140 140 … … 147 147 } 148 148 149 function localization_stats() 150 { 149 function localization_stats($force = false) 150 { 151 $cachefile = LANGDIR . 'langstats.txt'; 151 152 // use saved file (cache) 152 if (file_exists('langstats.txt'))153 if (filemtime('langstats.txt') + 60*60*2 > time())154 return file_get_contents( 'langstats.txt');155 156 $us_count = count_lines( LANGDIR.'/'.ORIGINAL.'/'.LABELS);157 $us_count += count_lines( LANGDIR.'/'.ORIGINAL.'/'.MESSAGES);158 159 include(LANGDIR .'/index.inc');153 if (!$force && file_exists($cachefile)) 154 if (filemtime($cachefile) + 60*60*12 > time()) 155 return file_get_contents($cachefile); 156 157 $us_count = count_lines(ORIGINAL, LABELS); 158 $us_count += count_lines(ORIGINAL, MESSAGES); 159 160 include(LANGDIR . 'index.inc'); 160 161 161 162 $i = 0; … … 165 166 continue; 166 167 167 $count = count_lines( LANGDIR.'/'.$l_key.'/'.LABELS);168 $count += count_lines( LANGDIR.'/'.$l_key.'/'.MESSAGES);168 $count = count_lines($l_key, LABELS); 169 $count += count_lines($l_key, MESSAGES); 169 170 $percent = ($count * 100) / $us_count; 170 171 … … 185 186 186 187 // save to cache file 187 file_put_contents( 'langstats.txt', $result);188 file_put_contents($cachefile, $result); 188 189 189 190 return $result; -
trunk/translator/index.php
r2173 r2178 116 116 echo "\n</form></div>"; 117 117 } 118 else 119 120 echo '<div align="center">'.localization_stats().'</div>'; 118 else if (empty($file)) 119 { 120 echo '<h4>Current completeness status</h4>'; 121 echo '<div>'.localization_stats().'</div>'; 122 } 121 123 122 124 ?> -
trunk/translator/styles.css
r2173 r2178 104 104 width: 300px; 105 105 border-collapse: collapse; 106 border: 1px # 999solid;106 border: 1px #bbb solid; 107 107 } 108 108 … … 120 120 121 121 td.zebra { 122 background-color: silver;122 background-color: #eaeaea; 123 123 } 124 124
Note: See TracChangeset
for help on using the changeset viewer.
