nlopess Sun Apr 18 12:04:33 2004 EDT
Modified files: /livedocs livedoc.php Log: print a message if the translation is outdated #test this please or change the message if you like http://cvs.php.net/diff.php/livedocs/livedoc.php?r1=1.87&r2=1.88&ty=u Index: livedocs/livedoc.php diff -u livedocs/livedoc.php:1.87 livedocs/livedoc.php:1.88 --- livedocs/livedoc.php:1.87 Mon Mar 29 06:19:15 2004 +++ livedocs/livedoc.php Sun Apr 18 12:04:32 2004 @@ -18,7 +18,7 @@ // | Generate an HTML version of a phpdoc/docbook page on the fly | // +----------------------------------------------------------------------+ // -// $Id: livedoc.php,v 1.87 2004/03/29 11:19:15 didou Exp $ +// $Id: livedoc.php,v 1.88 2004/04/18 16:04:32 nlopess Exp $ define('LIVEDOC_SOURCE', dirname(__FILE__)); include LIVEDOC_SOURCE . '/common.php'; @@ -120,6 +120,30 @@ $file_revision = 'unknown revision'; } +/* Checks if translated file is updated */ +if ($lang != 'en' && !isset($using_fallback)) { + + if (preg_match('$Revision: 1.88 $', $file_revision, $matches)) { + $lang_rev = $matches[1]; + } else { + $lang_rev = 0; + } + + /* get english file revision */ + $data = @file_get_contents(FALLBACK_BASE . $filename); + if (preg_match('/<!-- .Revision: \d+\.(\d+) . -->/', $data, $matches)) { + $en_rev = $matches[1]; + } else { + $en_rev = 0; + } + + if ($lang_rev < $en_rev) { + $link = FORCE_DYNAMIC ? WEBBASE . "index.php?l=en&q=$current_page" : "en/$current_page.html"; + echo '<div class="warning">The translation of this file is outdated. '; + echo "<a href ='$link'>Click here to read this file in english.</a></div>"; + } +} + echo manual_page_footer(); /***************************************************************************** @@ -302,7 +326,7 @@ */ function &load_xml_doc($filename, $included = false, $fallback_filename = '') { - global $file_revision, $idx; + global $file_revision, $idx, $using_fallback; $replace = array(); $search = array('æ', '©', 'é', 'è', 'à', 'ï', 'ö', 'ä', 'Ä', @@ -315,6 +339,7 @@ $data = @file_get_contents($filename); if (strlen($data) == 0 && strlen($fallback_filename)) { $data = @file_get_contents($fallback_filename); + $using_fallback = 1; if (strlen($data) == 0) { $data = "<warning>permissions problem for $filename?</warning>";