aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--en/about/license/license.php4
-rw-r--r--langs/diff.php48
-rw-r--r--langs/missing.php33
3 files changed, 70 insertions, 15 deletions
diff --git a/en/about/license/license.php b/en/about/license/license.php
index f52f35d25..61431c067 100644
--- a/en/about/license/license.php
+++ b/en/about/license/license.php
@@ -41,6 +41,7 @@ function read_license_from_vcs($locale) {
$num_of_untranslated_sentences = 0;
$num_of_sentences_for_translation = 0;
+ $untranslated_sentences = array();
$search = array('\\"', '\n', ' ');
$replace = array('"','<br>', ' ');
foreach($license_strings as $value) {
@@ -50,10 +51,11 @@ function read_license_from_vcs($locale) {
$license_string = $po_file[$value[0]]["msgstr"][0];
} else {
$num_of_untranslated_sentences += $count;
+ $untranslated_sentences[] = $value[0];
$license_string = $value[0];
}
$license_string = str_replace('%s', (isset($value[2]) ? $value[2] : ''), $license_string);
- $prepared_license_strings[] = array(str_replace($search, $replace, $license_string), (isset($value[1]) ? $value[1] : 'p'), 'untran' => $num_of_untranslated_sentences, 'all' => $num_of_sentences_for_translation);
+ $prepared_license_strings[] = array(str_replace($search, $replace, $license_string), (isset($value[1]) ? $value[1] : 'p'), 'untran' => $num_of_untranslated_sentences, 'all' => $num_of_sentences_for_translation, 'untranslated_sentences' => $untranslated_sentences);
}
return $prepared_license_strings;
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 = '<span style="color: red; font-weight: bold"> NOTE: THIS IS TRANSLATION OF NAVIGATION SO LOCATION FOR COMMIT IS DIFFERENT!</span>';
+ $commit = '<a href="//svnweb.mageia.org/web/www/trunk/_nav/langs/' . $file . '?view=markup">web/www/trunk/_nav/langs/' . $file . '</a> and for now to the <a href="//svnweb.mageia.org/web/nav/langs/' . $file . '?view=markup">web/nav/langs/' . $file . '</a> too';
+} else {
+ $file = _lang_file_switch($source_file, $target_lang);
+ $note = '';
+ $commit = '<a href="//svnweb.mageia.org/web/www/trunk/langs/' . $file . '?view=markup">web/www/trunk/langs/' . $file . '</a>';
}
$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 = '<a href="report.php">&laquo; back to langs report</a>';
@@ -53,25 +62,38 @@ $s .= sprintf('<h1>Differences between %s source and %s target</h1>',
substr($source_file, strpos($source_file, '/langs/')+7), $target_lang);
if($constitution) {
- $s .= '<h2 style="color: red;">Please translate constitution first</h2>';
- $s .= '<p>You can find it in <a href="//svnweb.mageia.org/org/constitution/">svn</a>. ';
+ $s .= '<h2 style="color: red;">Please translate constitution first</h2>';
+ $s .= '<p>You can find it in <a href="//svnweb.mageia.org/org/constitution/">svn</a>. ';
}
+$num_of_untranslated_strings = 0;
if($license) {
- $s .= '<h2 style="color: red;">Please translate license first</h2>';
- $s .= sprintf('<p>You can find it in <a href="http://gitweb.mageia.org/software/drakx/tree/perl-install/share/po/">git</a> (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 .= '<h2 style="color: red;">Please translate license 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
}
if($constitution || $license) {
- $s .= 'Please read <a href="https://wiki.mageia.org/en/Internationalisation_Team_%28i18n%29#Special_cases_of_web_pages">page on wiki for more information</a> about that.</p>';
+ $s .= 'Please read <a href="https://wiki.mageia.org/en/Internationalisation_Team_%28i18n%29#Special_cases_of_web_pages">page on wiki for more information</a> about that.</p>';
}
-foreach (array('missing' => 'missing strings', 'notrans' => 'untranslated strings', 'extra' => 'unused (old) strings', 'dup_str' => 'duplicate strings') as $type => $name) {
+
+$s .= '<p>After translation:</p>
+ <ul>
+ <li>if you have a SVN account, you may commit updated file directly in <code>' . $commit . '</code>. ' . $note . '</li>
+ <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) {
if (count($diff[$type]) > 0) {
$s .= sprintf('<h2>%d %s:</h2>', count($diff[$type]), $name);
$s .= '<pre>';
+ $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 .= '</pre>';
}
}
@@ -83,6 +105,8 @@ header('Content-Type: text/html;charset=utf-8');
<head>
<meta charset="utf-8">
<meta name="robot" content="noindex,nofollow,nosnippet">
+ <?php echo sprintf('<title>Differences between %s source and %s target</title>',
+ substr($source_file, strpos($source_file, '/langs/')+7), $target_lang); ?>
<style>
pre { background: #eee; padding: 0.6em; }
</style>
diff --git a/langs/missing.php b/langs/missing.php
index 0514be1c3..44016693a 100644
--- a/langs/missing.php
+++ b/langs/missing.php
@@ -12,6 +12,18 @@ if (is_null($s)) {
include 'lib.php';
+if($s =='en/about/constitution.en.lang') {
+ $constitution = true;
+} else {
+ $constitution = false;
+}
+
+if($s =='en/about/license.en.lang') {
+ $license = true;
+} else {
+ $license = false;
+}
+
if ($s == '../_nav/langs/en.lang') {
$file = substr(_lang_file_switch($s, $l), 14);
$note = '<span style="color: red; font-weight: bold"> NOTE: THIS IS TRANSLATION OF NAVIGATION SO LOCATION FOR COMMIT IS DIFFERENT!</span>';
@@ -24,18 +36,35 @@ if ($s == '../_nav/langs/en.lang') {
$iframe = '//www.mageia.org/langs/'.$s;
}
+$constitution_or_license = '';
+if($constitution) {
+ $constitution_or_license .= '<h2 style="color: red;">Please translate constitution first</h2>';
+ $constitution_or_license .= '<p>You can find it in <a href="//svnweb.mageia.org/org/constitution/">svn</a>. ';
+}
+
+$num_of_untranslated_strings = 0;
+if($license) {
+ $constitution_or_license .= '<h2 style="color: red;">Please translate license into ' . $langs[$target_lang] . ' first</h2>';
+ $constitution_or_license .= 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
+}
+
+if($constitution || $license) {
+ $constitution_or_license .= 'Please read <a href="https://wiki.mageia.org/en/Internationalisation_Team_%28i18n%29#Special_cases_of_web_pages">page on wiki for more information</a> about that.</p><p>Then:</p>';
+}
+
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex,nofollow,nosnippet">
+ <title>Missing language file</title>
</head>
<body>
<p><a href="report.php">&laquo; back to the report page</a></p>
-
+<h1>Missing language file</h1>
<p>So, <code><?php echo $file ?></code> language file is missing in <?php echo $langs[$l], ' (<code>', $l, '</code>)' ?>. What can you do to help us?</p>
-
+<?php echo $constitution_or_license; ?>
<ol>
<li>Copy the source file from the frame below in a text editor and rename it <code><?php echo $file?></code>.<?php echo $note ?></li>
<li>Replace and translate the strings that are just after the lines starting with a ";". Be careful to always keep your translated text on a single line.</li>