From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- scripts/langdiff.php | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 scripts/langdiff.php (limited to 'scripts/langdiff.php') diff --git a/scripts/langdiff.php b/scripts/langdiff.php new file mode 100644 index 0000000..f004b54 --- /dev/null +++ b/scripts/langdiff.php @@ -0,0 +1,192 @@ +perms('manage_project')) { + Flyspray::show_error(28); +} + +ob_start(); + +?> + +Diff report for language ',$lang,'',"\n"; + echo '

The following translation keys are missing in the translation:

'; + echo ''; + $i = 0; + foreach ($orig_language as $key => $val) { + if (!isset($translation[$key])) { + echo '',"\n"; + $i++; + } + + } + echo '
',$key,''.htmlspecialchars($val).'
'; + if ( $i > 0 ){ + echo '

',$i,' out of ',sizeof($language),' keys to translate.

'; + } + echo '

The following translation keys should be deleted from the translation:

'; + echo ''; + $i = 0; + foreach ($translation as $key => $val) { + if ( !isset($orig_language[$key])) { + echo '',"\n"; + $i++; + } + } + echo '
',$key,'
\'',$val,'\'
'; + if ( $i > 0 ){ + echo '

'.$i.' entries can be removed from this translation.

'; + } else{ + echo '

None

'; + } + echo '

Direct comparision between english and '.htmlspecialchars($lang).'

'; + echo ' + + + + + + + + '; + $i = 0; + foreach ($orig_language as $key => $val) { + if (!isset($translation[$key])) { + echo ''."\n"; + }else{ + echo ' + + + + '."\n"; + } + $i++; + } + echo '
translation keyen'.htmlspecialchars($lang).'
',$key,''.htmlspecialchars($val).'
',$key,''.htmlspecialchars($val).''.htmlspecialchars($translation[$key]).'
'; +} else { + # TODO show all existing translations overview and selection + # 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') ) { + # 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); + asort($workfiles); + echo ' + + '; + foreach($langfiles as $lang){ + unset($translation); + require('lang/'.$lang); # file $language variable + $i=0; $empty=0; + foreach ($orig_language as $key => $val) { + if (!isset($translation[$key])) { + $i++; + }else{ + if($val==''){ + $empty++; + } + } + } + $progress=floor(($max-$i)*100/$max*10)/10; + if($lang!='en.php'){ + echo ' + + + + +'; + }else{ + echo ''; + } + } + foreach($workfiles as $workfile){ + echo ' + + + + '; + } + closedir($handle); + echo '
'.L('file').''.L('progress').'
'.$lang.' +'.$progress.' % + +'.L('translate').' '.substr($lang,0,-4).'
en.phpis reference and fallbackTranslate '.substr($lang,0,-4).'
'.$workfile.''.L('translate').' '.substr($workfile,1,-9).'
'; + } +} + +$content = ob_get_contents(); +ob_end_clean(); + +$page->uses('content'); +$page->pushTpl('admin.translation.tpl'); + +?> -- cgit v1.2.3-54-g00ecf