aboutsummaryrefslogtreecommitdiffstats
path: root/langs/diff.php
diff options
context:
space:
mode:
authorFilip Komar <filip@mageia.org>2014-01-13 17:51:23 +0000
committerFilip Komar <filip@mageia.org>2014-01-13 17:51:23 +0000
commit623ce3a295aae5d1258567c2a2db151a3d621976 (patch)
treea78f9694e0e64689698cdbb0050f41a2f2f09a66 /langs/diff.php
parent8f3c87ce1aa7c6ea2b110901688a0d79f82029ca (diff)
downloadwww-623ce3a295aae5d1258567c2a2db151a3d621976.tar
www-623ce3a295aae5d1258567c2a2db151a3d621976.tar.gz
www-623ce3a295aae5d1258567c2a2db151a3d621976.tar.bz2
www-623ce3a295aae5d1258567c2a2db151a3d621976.tar.xz
www-623ce3a295aae5d1258567c2a2db151a3d621976.zip
some code optimisation
Diffstat (limited to 'langs/diff.php')
-rw-r--r--langs/diff.php30
1 files changed, 11 insertions, 19 deletions
diff --git a/langs/diff.php b/langs/diff.php
index c7a2cb368..f7e87839f 100644
--- a/langs/diff.php
+++ b/langs/diff.php
@@ -59,11 +59,17 @@ if (false === strstr($source_file, '/langs/') ||
$diff = _lang_diff($source_file, $target_file);
+$issues = array(
+ 'missing' => 'missing strings',
+ 'notrans' => 'untranslated strings',
+ 'extra' => 'unused (old) strings',
+ 'dup_str' => 'duplicate strings',
+);
+
$s = '<a href="report.php">&laquo; back to langs report</a>';
$s .= sprintf('<h1>Differences between %s source and %s target</h1>',
substr($source_file, strpos($source_file, '/langs/')+7), $target_lang);
-$diff['untranslated_lines_in_constitution'] = array();
if($constitution) {
$s .= '<h2 style="color: red;">Please translate constitution fully into ' . $langs[$target_lang] . ' first</h2>';
$s .= '<p>You can find it in <a href="//svnweb.mageia.org/org/constitution/">svn</a>. ';
@@ -72,15 +78,11 @@ if($constitution) {
$unique_lines_in_eng_constitution = $constitution_results['unique_lines_in_constitution'];
$lang_constitution_results = aproximate_number_of_untranslated_constitution_lines(APP_ROOT, $target_lang, $unique_lines_in_eng_constitution);
$constitution_readable = $lang_constitution_results['constitution_readable'];
- if ($constitution_readable) {
- $diff['untranslated_lines_in_constitution'] = $lang_constitution_results['untranslated_lines_in_constitution']; // add untranslated license sentences
- } else {
- $diff['untranslated_lines_in_constitution'] = $lang_constitution_results['untranslated_lines_in_constitution']; // add untranslated license sentences
- }
+ $diff['untranslated_lines_in_constitution'] = $lang_constitution_results['untranslated_lines_in_constitution']; // add untranslated license sentences
+ $dest_constitution = sprintf('%s/%s_%s.md', 'href="//svnweb.mageia.org/web/www/trunk/en/about/constitution', 'mageia.org_statutes', ($constitution_readable ? $target_lang : 'en'));
+ $issues['untranslated_lines_in_constitution'] = 'of all untranslated lines in <a ' . $dest_constitution . '">constitution</a> (in svn)';
}
-$num_of_untranslated_strings = 0;
-$diff['untranslated_sentences_in_license'] = array();
if($license) {
require_once('../en/about/license/license.php');
$license_numbers = array_pop(read_license_from_vcs($target_lang));
@@ -88,6 +90,7 @@ if($license) {
$diff['untranslated_sentences_in_license'] = $license_numbers['untranslated_sentences']; // add untranslated license sentences
$s .= '<h2 style="color: red;">Please translate license fully into ' . $langs[$target_lang] . ' first</h2>';
$s .= sprintf('<p>You can find it in <a href="http://gitweb.mageia.org/software/drakx/tree/perl-install/share/po/%s.po">git</a>. ', $target_lang); // git doesn't work yet on https
+ $issues['untranslated_sentences_in_license'] = 'untranslated msgid strings in ' . $num_of_untranslated_strings . ' sentences in separate <a href="http://gitweb.mageia.org/software/drakx/tree/perl-install/share/po/' . $target_lang . '.po">license file</a> (in git)';
}
if($constitution || $license) {
@@ -100,18 +103,7 @@ $s .= '<p>After translation:</p>
<li>or attach it to a mail to Mageia localization team (<code>mageia-i18n</code>, <a href="irc://irc.freenode.net/#mageia-i18n">#mageia-i18n</a> on Freenode).</li>
</ul>';
-$dest_constitution = sprintf('%s/%s_%s.md', 'href="//svnweb.mageia.org/web/www/trunk/en/about/constitution', 'mageia.org_statutes', ($constitution_readable ? $target_lang : 'en'));
-
-$issues = array(
- 'missing' => 'missing strings',
- 'notrans' => 'untranslated strings',
- 'extra' => 'unused (old) strings',
- 'dup_str' => 'duplicate strings',
- 'untranslated_lines_in_constitution' => 'of all untranslated lines in <a ' . $dest_constitution . '">constitution</a> (in svn)',
- 'untranslated_sentences_in_license' => 'untranslated msgid strings in ' . $num_of_untranslated_strings . ' sentences in separate <a href="http://gitweb.mageia.org/software/drakx/tree/perl-install/share/po/' . $target_lang . '.po">license file</a> (in git)',
-);
foreach ($issues as $type => $name) {
-
if (count($diff[$type]) > 0) {
$s .= sprintf('<h2>%d %s:</h2>', count($diff[$type]), $name);
$s .= '<pre>';