From 0332537f327fad8a76e80c85c996d99c09e30e20 Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Sat, 9 Feb 2013 12:17:13 +0000 Subject: navigation added to translation report --- langs/lib.php | 3 ++- langs/missing.php | 21 ++++++++++++++++----- langs/report.php | 40 +++++++++++++++++++++++++++++++++------- 3 files changed, 51 insertions(+), 13 deletions(-) (limited to 'langs') diff --git a/langs/lib.php b/langs/lib.php index d4293c008..716404fd7 100644 --- a/langs/lib.php +++ b/langs/lib.php @@ -100,7 +100,8 @@ if ( ! function_exists('glob_recursive')) function _lang_file_switch($s, $l) { - return $l . substr(str_replace('.en.lang', '.' . $l . '.lang', $s), 2); + $s = str_replace('en.lang', $l . '.lang', $s); + return str_replace('en/', $l . '/', $s); } function get_lang_references() diff --git a/langs/missing.php b/langs/missing.php index 72f22bc2c..387c84651 100644 --- a/langs/missing.php +++ b/langs/missing.php @@ -12,6 +12,17 @@ if (is_null($s)) { include 'lib.php'; +if ($s == '../_nav/langs/en.lang') { + $file = substr(_lang_file_switch($s, $l), 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'; + $iframe = 'http://www.mageia.org/_nav/langs/en.lang'; +} else { + $file = _lang_file_switch($s, $l); + $note = ''; + $commit = 'web/www/trunk/langs/' . $file; + $iframe = 'http://www.mageia.org/langs/'.$s; +} ?> @@ -23,14 +34,14 @@ include 'lib.php';

« back to the report page

-

So, language file is missing in ', $l, ')' ?>. What can you do to help us?

+

So, language file is missing in ', $l, ')' ?>. What can you do to help us?

    -
  1. Copy the source file from the frame below in a text editor and rename it .
  2. +
  3. Copy the source file from the frame below in a text editor and rename it .
  4. 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.
  5. Then:
      -
    • if you have a SVN account, you may commit it directly in web/www/trunk/langs/' . _lang_file_switch($s, $l)?>;
    • +
    • if you have a SVN account, you may commit it directly in ;
    • or attach it to a mail to Mageia i18n team (mageia-i18n, #mageia-i18n on Freenode).
  6. @@ -38,7 +49,7 @@ include 'lib.php';

Thanks!

- +
- \ No newline at end of file + diff --git a/langs/report.php b/langs/report.php index 22e2da617..e24602a55 100644 --- a/langs/report.php +++ b/langs/report.php @@ -33,7 +33,7 @@

www.mageia.org translation report

@@ -44,6 +44,8 @@ define('APP_ROOT', realpath(__DIR__ . '/..')); $enFiles = get_lang_references(); + // added navigation file + array_unshift($enFiles, '../_nav/langs/en.lang'); $otherLangs = get_other_langs(); $enStringsCount = array(); @@ -58,8 +60,8 @@ foreach ($otherLangs as $l) { $stats['en']['files'] += 1; - $stats[$l]['files'] = 0; - $stats[$l]['strings'] = 0; + $stats[$l]['files'] = 0; + $stats[$l]['strings'] = 0; $s = sprintf('%s
%s', $langs[$l], $l); @@ -69,13 +71,29 @@ foreach ($enFiles as $f) { $enStringsCount[$f] = 0; + if ($f == '../_nav/langs/en.lang') { + $nav = true; + } else { + $nav = false; + } + $langF = str_replace('.en.lang', '.' . $l . '.lang', $f); - $langF = $l . substr($langF, 2); + if ($nav) { + $langF = '../_nav/langs/' . $l . '.lang'; + } else { + $langF = $l . substr($langF, 2); + } $link = str_replace(array('en/', '.en.lang', 'index'), '', $f); - $dest_l = sprintf('%s/%s/%s/%s', APP_ROOT, $l, $link, 'index.php'); - $dest_en = sprintf('%s/%s/%s/%s', APP_ROOT, 'en', $link, 'index.php'); + if ($nav) { + $dest_en = sprintf('%s/%s/%s', APP_ROOT, '_nav/langs', 'en.lang'); + $dest_l = sprintf('%s/%s/%s', APP_ROOT, '_nav/langs', $l . '.lang'); + } else { + $dest_en = sprintf('%s/%s/%s/%s', APP_ROOT, 'en', $link, 'index.php'); + $dest_l = sprintf('%s/%s/%s/%s', APP_ROOT, $l, $link, 'index.php'); + } + // if symlink e.g. does directly translated page exist? - if ((realpath($dest_l) == realpath($dest_en))) { + if ((realpath($dest_l) == realpath($dest_en)) || $nav) { $page_not_linked = ''; $old_page = ''; } else { @@ -103,6 +121,14 @@ if ($link == 'downloads/get') { $link = sprintf('view download OK page view non existing file page', $l, $link, $l, $link); + } else if ($nav) { + $local_f = @file_get_contents('../_nav/langs/' . $l . '.lang'); + $mognas_f = @file_get_contents('http://nav.mageia.org/langs/' . $l . '.lang'); + if ($local_f != $mognas_f) { + $link = '
difference in svn 1 and 2'; + } else { + $link = ''; + } } else { $link = sprintf('view page%s', $l, $link, $page_not_linked); } -- cgit v1.2.1