diff options
author | filip <filip.komar@gmail.com> | 2014-08-01 22:41:44 +0200 |
---|---|---|
committer | filip <filip.komar@gmail.com> | 2014-08-01 22:44:12 +0200 |
commit | d7a6abb861c0afe10ac535d131e6e77bc50b9a0c (patch) | |
tree | 776fe1059d4d287fe99e322a3a3c84d5d52b594e /langs | |
parent | da85b57f05665d4dba87bed97111c58fb49960c0 (diff) | |
download | www-d7a6abb861c0afe10ac535d131e6e77bc50b9a0c.tar www-d7a6abb861c0afe10ac535d131e6e77bc50b9a0c.tar.gz www-d7a6abb861c0afe10ac535d131e6e77bc50b9a0c.tar.bz2 www-d7a6abb861c0afe10ac535d131e6e77bc50b9a0c.tar.xz www-d7a6abb861c0afe10ac535d131e6e77bc50b9a0c.zip |
transition of diff.php to gettext only, move from svn to git, minor improvements
Diffstat (limited to 'langs')
-rw-r--r-- | langs/diff.php | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/langs/diff.php b/langs/diff.php index 251cd87f0..f86038f41 100644 --- a/langs/diff.php +++ b/langs/diff.php @@ -19,15 +19,8 @@ if (!file_exists($source_file)) { die('no source'); } -if (strrpos($source_file, '.pot')) { - $gettext = true; - $resource = _extract_resource($source_file); - $target_file = _po_file_switch($source_file, $target_lang); -} else { - $gettext = false; - $resource = _extract_resource($source_file, '.en.lang'); - $target_file = _lang_file_switch($source_file, $target_lang); -} +$resource = _extract_resource($source_file); +$target_file = _po_file_switch($source_file, $target_lang); if (!file_exists($target_file)) { die('no target'); @@ -48,11 +41,11 @@ if($resource =='about/license') { if (false !== strstr($source_file, '../_nav/langs/en.')) { $file = substr($target_file, 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'; + $commit = '<a href="http://gitweb.mageia.org/web/nav/tree/langs/' . $file . '">/langs/' . $file . '</a>'; } else { $file = $target_file; $note = ''; - $commit = '<a href="//svnweb.mageia.org/web/www/trunk/langs/' . $file . '?view=markup">web/www/trunk/langs/' . $file . '</a>'; + $commit = '<a href="http://gitweb.mageia.org/web/www/tree/langs/' . $file . '">/langs/' . $file . '</a>'; } $source_file_path = realpath($source_file); @@ -63,11 +56,7 @@ if (false === strstr($source_file_path, '/langs/') || die('no sorry'); } -if ($gettext) { - $diff = _po_diff($target_lang, $resource); -} else { - $diff = _lang_diff($source_file_path, $target_file_path); -} +$diff = _po_diff($target_lang, $resource); $issues = array( 'missing' => 'missing strings', @@ -81,17 +70,23 @@ $s = '<a href="report.php?l=' . $target_lang . '">« back to the report pag $s .= sprintf('<h1>Differences between %s source and %s target</h1>', $source_file, $target_lang); +$s .= '<p>You can translate most of our web page resources online in <a href="http://www.transifex.com/organization/MageiaLinux/dashboard/all_resources/' . $target_lang . '/#1/?c=Webpages">Transifex</a>.'; +$s .= ' More info in our <a href="https://wiki.mageia.org/en/Internationalisation_Team_%28i18n%29#Website_translation">Wiki</a>.</p>'; + +$additional_file = ''; + 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>. '; + $s .= '<p>You can find it in <a href="http://gitweb.mageia.org/web/www/tree/en/about/constitution/">git</a>. '; $constitution_results = aproximate_number_of_untranslated_constitution_lines(G_APP_ROOT, 'en'); $unique_lines_in_eng_constitution = $constitution_results['unique_lines_in_constitution']; $lang_constitution_results = aproximate_number_of_untranslated_constitution_lines(G_APP_ROOT, $target_lang, $unique_lines_in_eng_constitution); $constitution_readable = $lang_constitution_results['constitution_readable']; $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)'; + $dest_constitution = sprintf('%s/%s_%s.md"', 'href="http://gitweb.mageia.org/web/www/tree/en/about/constitution', 'mageia.org_statutes', ($constitution_readable ? $target_lang : 'en')); + $issues['untranslated_lines_in_constitution'] = 'of all untranslated lines in separate <a ' . $dest_constitution . '>constitution md format file</a>'; + $additional_file = "\t\t<li>same goes for <a $dest_constitution>constitution</a></li>"; } if($license) { @@ -102,32 +97,39 @@ 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)'; + $issues['untranslated_sentences_in_license'] = 'untranslated msgid strings in ' . $num_of_untranslated_strings . ' license sentences as part of a separate <a href="http://gitweb.mageia.org/software/drakx/tree/perl-install/share/po/' . $target_lang . '.po">drakx file</a> (look below line 4 500)'; } 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 .= '<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>'; +$s .= '<p>After translation:</p>'; +$s .= "\t<ul>"; +$s .= "\t\t<li>if you're in <a href=\"http://people.mageia.org/g/mga-i18n-committers.html\">mga-i18n-committers group</a>,"; +$s .= " you may commit updated po file directly in <code>$commit</code>$note</li>"; +$s .= "\t\t<li>or attach it to a mail to <a href=\"https://ml.mageia.org/l/info/i18n-discuss\">Mageia localization team</a> (<code>mageia-i18n</code>, <a href=\"irc://irc.freenode.net/#mageia-i18n\">#mageia-i18n</a> on Freenode).</li>"; +$s .= $additional_file; +$s .= "\t</ul>"; +$new_line = "\n\n"; foreach ($issues as $type => $name) { if (isset($diff[$type]) && count($diff[$type]) > 0) { - $s .= sprintf('<h2>%d %s:</h2>', count($diff[$type]), $name); - $s .= '<pre>'; + $filename = ' in ' . $commit; // $file if ($type == 'untranslated_lines_in_constitution') { $prefix = ''; + $new_line = "\n"; + $filename = ''; } else if ($type == 'untranslated_sentences_in_license') { $prefix = 'msgid: '; + $filename = ''; } else { $prefix = ';'; } + $s .= sprintf('<h2>%d %s%s:</h2>', count($diff[$type]), $name, $filename); + $s .= '<pre>'; foreach ($diff[$type] as $l) - $s .= sprintf("%s%s\n\n", $prefix, rtrim(htmlspecialchars($l))); + $s .= sprintf("%s%s%s", $prefix, rtrim(htmlspecialchars($l)), $new_line); // cut at 200: substr(rtrim(htmlspecialchars($l)), 0, 200) $s .= '</pre>'; } } |