[DOC-WEB] [web-doc] master: Improve side navigation for translation tools

[email protected] (Jim Winstead) Fri, 25 Oct 2024 00:11:34 +0000
Newsgroups php.doc.web
Message-ID <[email protected]>
Author: Jim Winstead (jimwins)
Date: 2024-10-24T17:07:03-07:00

Commit: https://github.com/php/web-doc/commit/31cfd3f86e2605e718f16c9109d60f42a73eac6a
Raw diff: https://github.com/php/web-doc/commit/31cfd3f86e2605e718f16c9109d60f42a73eac6a.diff

Improve side navigation for translation tools

Changed paths:
  M  include/lib_general.inc.php
  M  www/revcheck.php


Diff:

diff --git a/include/lib_general.inc.php b/include/lib_general.inc.php
index c88fae2..31fa8b5 100644
--- a/include/lib_general.inc.php
+++ b/include/lib_general.inc.php
@@ -75,37 +75,28 @@ function site_footer($SECONDSCREEN = false)
     require __DIR__ . '/../shared/templates/footer.inc';
 }
 
-function nav_languages()
+function nav_languages($lang = null)
 {
     global $LANGUAGES;
     $out = '<div class="panel">';
-    $out .= '<p class="headline"><a href="revcheck.php">Translation status</a></p>';
+    $out .= '<p class="headline"><a href="/revcheck.php">Translation status</a></p>';
     $out .= '<div class="body">';
     $out .= '<ul>';
     foreach ($LANGUAGES as $code => $name)
     {
-        $out .='<li><a href="revcheck.php?lang='.$code.'">'.$name.'</a></li>';
+        $out .= '<li><a href="/revcheck.php?lang='.$code.'">'.$name.'</a>';
+        if ($lang === $code) {
+            $out .= '<ul>';
+            $out .= '<li><a href="/revcheck.php?p=translators&amp;lang='.$lang.'">Translators</a></li>';
+            $out .= '<li><a href="/revcheck.php?p=filesummary&amp;lang='.$lang.'">File summary</a></li>';
+            $out .= '<li><a href="/revcheck.php?p=files&amp;lang='.$lang.'">Outdated files</a></li>';
+            $out .= '<li><a href="/revcheck.php?p=misstags&amp;lang='.$lang.'">Missing revision numbers</a></li>';
+            $out .= '<li><a href="/revcheck.php?p=missfiles&amp;lang='.$lang.'">Untranslated files</a></li>';
+            $out .= '<li><a href="/revcheck.php?p=oldfiles&amp;lang='.$lang.'">Not in EN tree</a></li>';
+            $out .= '</ul>';
+        }
+        $out .= '</li>';
     }
     $out .= '</ul></div></div>';
     return $out;
 }
-
-function nav_tools($lang)
-{
-    global $LANGUAGES;
-    $out = '<div class="panel">';
-    $out .= '<p class="headline">';
-    $out .= '<a href="revcheck.php?lang='.$lang.'">Tools ('.$LANGUAGES[$lang].' Manual)</a>';
-    $out .= '</p>';
-    $out .= '<div class="body">';
-    $out .= '<ul>';
-    $out .= '<li><a href="revcheck.php?p=translators&amp;lang='.$lang.'">Translators</a></li>';
-    $out .= '<li><a href="revcheck.php?p=filesummary&amp;lang='.$lang.'">File summary</a></li>';
-    $out .= '<li><a href="revcheck.php?p=files&amp;lang='.$lang.'">Outdated files</a></li>';
-    $out .= '<li><a href="revcheck.php?p=misstags&amp;lang='.$lang.'">Missing revision numbers</a></li>';
-    $out .= '<li><a href="revcheck.php?p=missfiles&amp;lang='.$lang.'">Untranslated files</a></li>';
-    $out .= '<li><a href="revcheck.php?p=oldfiles&amp;lang='.$lang.'">Not in EN tree</a></li>';
-    $out .= '</ul>';
-    $out .= '</div></div>';
-    return $out;
-}
diff --git a/www/revcheck.php b/www/revcheck.php
index 4820bac..41ccd35 100644
--- a/www/revcheck.php
+++ b/www/revcheck.php
@@ -298,14 +298,6 @@
      // we need a dir to browse
      $dirs = get_dirs($dbhandle, $lang);
      $users = get_translators($dbhandle, $lang);
-     /*
-     if (empty($dirs)) {
-         echo '<p>Error: no directories found in database.</p>';
-         $sidebar = nav_tools($lang);
-         site_footer($sidebar);
-         die;
-     }
-     */
      echo '<p>This tool allows you to check which files in your translation need updates. To show the list ';
      echo 'choose a directory (it doesn\'t work recursively) or translator.</p>';
      echo '<p>When you click on the filename you will see the plaintext diff showing changes between revisions, so ';
@@ -448,6 +440,6 @@
 }
 
 if ($lang != 'en') {
-    $sidebar = nav_tools($lang);
+    $sidebar = nav_languages($lang);
     site_footer($sidebar);
 }