From 268da1986e106fd8763beea61bfe0fff75ee97ee Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Sun, 5 Jan 2014 16:01:51 +0000 Subject: some usability improvements --- langs/diff.php | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'langs/diff.php') diff --git a/langs/diff.php b/langs/diff.php index 948243cbf..9e5484a2f 100644 --- a/langs/diff.php +++ b/langs/diff.php @@ -26,15 +26,25 @@ if (!file_exists($target_file)) { } if($source_file =='en/about/constitution.en.lang') { - $constitution = true; + $constitution = true; } else { - $constitution = false; + $constitution = false; } if($source_file =='en/about/license.en.lang') { - $license = true; + $license = true; } else { - $license = false; + $license = false; +} + +if ($source_file == '../_nav/langs/en.lang') { + $file = substr(_lang_file_switch($source_file, $target_lang), 14); + $note = ' NOTE: THIS IS TRANSLATION OF NAVIGATION SO LOCATION FOR COMMIT IS DIFFERENT!'; + $commit = 'web/www/trunk/_nav/langs/' . $file . ' and for now to the web/nav/langs/' . $file . ' too'; +} else { + $file = _lang_file_switch($source_file, $target_lang); + $note = ''; + $commit = 'web/www/trunk/langs/' . $file . ''; } $source_file = realpath($source_file); @@ -45,7 +55,6 @@ if (false === strstr($source_file, '/langs/') || die('no sorry'); } - $diff = _lang_diff($source_file, $target_file); $s = '« back to langs report'; @@ -53,25 +62,38 @@ $s .= sprintf('

Differences between %s source and %s target

', substr($source_file, strpos($source_file, '/langs/')+7), $target_lang); if($constitution) { - $s .= '

Please translate constitution first

'; - $s .= '

You can find it in svn. '; + $s .= '

Please translate constitution first

'; + $s .= '

You can find it in svn. '; } +$num_of_untranslated_strings = 0; if($license) { - $s .= '

Please translate license first

'; - $s .= sprintf('

You can find it in git (file %s.po). ', $target_lang); // git doesn't work yet on https + require_once('../en/about/license/license.php'); + $license_numbers = array_pop(read_license_from_vcs($target_lang)); + $num_of_untranslated_strings = $license_numbers["untran"]; // number of all license sentences + $diff['untranslated_sentences_in_license'] = $license_numbers['untranslated_sentences']; // add untranslated license sentences + $s .= '

Please translate license into ' . $langs[$target_lang] . ' first

'; + $s .= sprintf('

You can find it in git. ', $target_lang); // git doesn't work yet on https } if($constitution || $license) { - $s .= 'Please read page on wiki for more information about that.

'; + $s .= 'Please read page on wiki for more information about that.

'; } -foreach (array('missing' => 'missing strings', 'notrans' => 'untranslated strings', 'extra' => 'unused (old) strings', 'dup_str' => 'duplicate strings') as $type => $name) { + +$s .= '

After translation:

+ '; + +foreach (array('missing' => 'missing strings', 'notrans' => 'untranslated strings', 'extra' => 'unused (old) strings', 'dup_str' => 'duplicate strings', 'untranslated_sentences_in_license' => 'untranslated msgid strings in ' . $num_of_untranslated_strings . ' sentences in separate license file (in git)') as $type => $name) { if (count($diff[$type]) > 0) { $s .= sprintf('

%d %s:

', count($diff[$type]), $name); $s .= '
';
+        $prefix = (($type == 'untranslated_sentences_in_license') ? 'msgid: ' : ';');
         foreach ($diff[$type] as $l)
-            $s .= sprintf(";%s\n\n", htmlspecialchars($l));
+            $s .= sprintf("%s%s\n\n", $prefix, htmlspecialchars($l));
         $s .= '
'; } } @@ -83,6 +105,8 @@ header('Content-Type: text/html;charset=utf-8'); + Differences between %s source and %s target', + substr($source_file, strpos($source_file, '/langs/')+7), $target_lang); ?> -- cgit v1.2.1