aboutsummaryrefslogtreecommitdiffstats
path: root/langs/diff.php
diff options
context:
space:
mode:
authorFilip Komar <filip@mageia.org>2014-01-12 21:32:30 +0000
committerFilip Komar <filip@mageia.org>2014-01-12 21:32:30 +0000
commit3a2f4b84559d12dcf2e73fdf97d14337876e069c (patch)
treea80aaaf51292c2ceee45892077f783185765198d /langs/diff.php
parent417e1cd2e0fbb4b231391f4b1b53a78ddbd889da (diff)
downloadwww-3a2f4b84559d12dcf2e73fdf97d14337876e069c.tar
www-3a2f4b84559d12dcf2e73fdf97d14337876e069c.tar.gz
www-3a2f4b84559d12dcf2e73fdf97d14337876e069c.tar.bz2
www-3a2f4b84559d12dcf2e73fdf97d14337876e069c.tar.xz
www-3a2f4b84559d12dcf2e73fdf97d14337876e069c.zip
l10n report can be limited to only one resource + better management of untranslated lines in constitution
Diffstat (limited to 'langs/diff.php')
-rw-r--r--langs/diff.php42
1 files changed, 36 insertions, 6 deletions
diff --git a/langs/diff.php b/langs/diff.php
index 117d38a9e..cdaf6b8f2 100644
--- a/langs/diff.php
+++ b/langs/diff.php
@@ -4,6 +4,8 @@
* against matching file in language 'l', if it exists.
*/
+define('APP_ROOT', realpath(__DIR__ . '/..'));
+
$source_file = isset($_GET['s']) ? strip_tags(trim($_GET['s'])) : null;
$target_lang = isset($_GET['l']) ? strip_tags(trim($_GET['l'])) : null;
@@ -61,9 +63,21 @@ $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 first</h2>';
+ $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>. ';
+
+ $constitution_results = aproximate_number_of_untranslated_constitution_lines(APP_ROOT, 'en');
+ $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'];
+ $num_of_untranslated_lines = $lang_constitution_results['aproximate_number_of_untranslated_lines'];
+ 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
+ }
}
$num_of_untranslated_strings = 0;
@@ -73,7 +87,7 @@ if($license) {
$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 .= '<h2 style="color: red;">Please translate license into ' . $langs[$target_lang] . ' first</h2>';
+ $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
}
@@ -87,14 +101,30 @@ $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>';
-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 <a href="http://gitweb.mageia.org/software/drakx/tree/perl-install/share/po/' . $target_lang . '.po">license file</a> (in git)') as $type => $name) {
+$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>';
- $prefix = (($type == 'untranslated_sentences_in_license') ? 'msgid: ' : ';');
+ if ($type == 'untranslated_lines_in_constitution') {
+ $prefix = '';
+ } else if ($type == 'untranslated_sentences_in_license') {
+ $prefix = 'msgid: ';
+ } else {
+ $prefix = ';';
+ }
foreach ($diff[$type] as $l)
- $s .= sprintf("%s%s\n\n", $prefix, htmlspecialchars($l));
+ $s .= sprintf("%s%s\n\n", $prefix, rtrim(htmlspecialchars($l)));
$s .= '</pre>';
}
}
@@ -113,7 +143,7 @@ header('Content-Type: text/html;charset=utf-8');
</style>
</head>
<body>
- <?php echo $s; $test_1 = TRUE; $test = strip_tags($test_1); echo '1. test: ' . $test; ?>
+ <?php echo $s; ?>
<hr>
</body>
</html>