Skip to content

Commit

Permalink
Merge pull request flyspray#453 from Flyspray/workontranslator
Browse files Browse the repository at this point in the history
small work on builtin translator
  • Loading branch information
peterdd committed Oct 26, 2015
2 parents ec6e4fc + 4e1d31f commit ec7bcfa
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 122 deletions.
41 changes: 35 additions & 6 deletions scripts/langdiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@

}
echo '</table>';
if ( $i > 0 )
if ( $i > 0 ){
echo '<p>',$i,' out of ',sizeof($language),' keys to translate.</p>';
}
echo '<h2>The following translation keys should be deleted from the translation:</h2>';
echo '<table cellspacing="0">';
$i = 0;
Expand All @@ -82,6 +83,11 @@
}
}
echo '</table>';
if ( $i > 0 ){
echo '<p>'.$i.' entries can be removed from this translation.</p>';
} else{
echo '<p><i class="fa fa-check fa-2x"></i> None</p>';
}
echo '<h2><a name="compare"></a>Direct comparision between english and '.htmlspecialchars($lang).'</h2>';
echo '<table>
<colgroup></colgroup>
Expand Down Expand Up @@ -111,15 +117,32 @@
# readdir
$english=$language;
$max=count($english);
$langfiles=array();
$workfiles=array();
if ($handle = opendir('lang')) {
$languages=array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file!='.langdiff.php' && $file!='.langedit.php' && !(substr($file,-4)=='.bak') && !(substr($file,-5)=='.safe') ) {
$langfiles[]=$file;
if ($file != "."
&& $file != ".."
&& $file!='.langdiff.php'
&& $file!='.langedit.php'
&& !(substr($file,-4)=='.bak')
&& !(substr($file,-5)=='.safe') ) {
# if a .$lang.php.work file but no $lang.php exists yet
if( substr($file,-5)=='.work'){
if(!is_file('lang/'.substr($file,1,-5)) ){
$workfiles[]=$file;
}
} else{
$langfiles[]=$file;
}
}
}
asort($langfiles);
echo '<table class="overview"><thead><tr><th>File</th><th>Progress</th><th> </th></tr></thead>';
asort($workfiles);
echo '<table class="overview">
<thead><tr><th>'.L('file').'</th><th>'.L('progress').'</th><th> </th></tr></thead>
<tbody>';
foreach($langfiles as $lang){
unset($translation);
require('lang/'.$lang); # file $language variable
Expand Down Expand Up @@ -148,8 +171,15 @@
echo '<tr><td>en.php</td><td>is reference and fallback</td><td><a class="button" href="?do=langedit&lang='.substr($lang,0,-4).'">Translate '.substr($lang,0,-4).'</a></td></tr>';
}
}
foreach($workfiles as $workfile){
echo '<tr>
<td><a href="?do=langdiff&lang='.substr($workfile,1,-9).'">'.$workfile.'</a></td>
<td></td>
<td><a class="button" href="?do=langedit&lang='.substr($workfile,1,-9).'">'.L('translate').' '.substr($workfile,1,-9).'</a></td>
</tr>';
}
closedir($handle);
echo '</table>';
echo '</tbody></table>';
}
}

Expand All @@ -160,4 +190,3 @@
$page->pushTpl('admin.translation.tpl');

?>

Loading

0 comments on commit ec7bcfa

Please sign in to comment.