[Xfce4-commits] <www:nick/transifex> Make normal pages work with the new directory layout.

Nick Schermer noreply at xfce.org
Sun Nov 22 21:02:01 CET 2009


Updating branch refs/heads/nick/transifex
         to 126ae27c001bdfcf406ae1e1bdc342ce77cf0c94 (commit)
       from 0061bceefb1115582dc59eec742b11947d4d4358 (commit)

commit 126ae27c001bdfcf406ae1e1bdc342ce77cf0c94
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Nov 22 20:59:43 2009 +0100

    Make normal pages work with the new directory layout.

 include/arrays.php    |    2 +-
 include/content.php   |   26 ++++++++++++--------------
 include/footer.php    |    8 ++++----
 include/frontpage.php |    8 ++++----
 include/header.php    |   10 +++++-----
 5 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/include/arrays.php b/include/arrays.php
index 57b3ab7..e4bd506 100644
--- a/include/arrays.php
+++ b/include/arrays.php
@@ -25,7 +25,7 @@
  * - 3rd for php's setlocale function
  */
 $languages = array (
-  "en" => array ('English', 'UTF-8', 'en_EN')
+  "C" => array ('English', 'UTF-8', 'en_EN')
 );
 
 /* Internal style names. The visible names are located in the i18n/header.xx.php file */
diff --git a/include/content.php b/include/content.php
index a6bc013..798ce7b 100644
--- a/include/content.php
+++ b/include/content.php
@@ -25,7 +25,7 @@
  **/
 function PrepareContent ($uri, $lang)
 {
-  $dir = "i18n/" . $uri;
+  $dir = "pages/$lang/$uri";
 
   if (is_dir ($dir))
     {
@@ -34,32 +34,30 @@ function PrepareContent ($uri, $lang)
     }
   else
     {
-      /* $uri = projects/xfmedia/downloads = file? => get the index page */
-      $file = "i18n/" . $uri . "." . $lang . ".php";
-      $file_en = "i18n/" . $uri . ".en.php";
+      $file = "pages/$lang/$uri.php";
+      $file_en = "pages/C/$uri.php";
 
       if (is_file ($file))
         {
+          /* file exists in translation */
           $content["file"] = $file;
-	}
-      elseif (is_file ($file_en))
+        }
+      elseif ($lang != "C" && is_file (file_en))
         {
-          $content["file"] = $file_en;
-	  
-	  /* not in your language */
+          /* not in your language */
           $content["wronglang"] = TRUE; 
+          $content["file"] = file_en;
         }
-       else
+      else
         {
           /* Page does not exist, return 404 page and 404 header for wget */
-          header("HTTP/1.0 404 Not Found");
+          header ("HTTP/1.0 404 Not Found");
           return PrepareContent ("404", $lang);
         }
 
       $uri_dir = dirname ($uri);
-
-      $nav = "i18n/" . $uri_dir . "/" . $lang . ".nav.php";
-      $nav_en = "i18n/" . $uri_dir . "/en.nav.php";
+      $nav = "pages/$lang/$uri_dir/nav.php";
+      $nav_en = "pages/C/$uri_dir/nav.php";
 
       if (is_file ($nav))
         $content["nav"] = $nav;
diff --git a/include/footer.php b/include/footer.php
index a4756e8..a86ef32 100644
--- a/include/footer.php
+++ b/include/footer.php
@@ -23,10 +23,10 @@
  **/
 function PrintFooter ($lang)
 {
-  if (is_file ("i18n/footer.".$lang.".php"))
-    include ("i18n/footer.".$lang.".php");
+  if (is_file ("pages/$lang/footer.php"))
+    include ("pages/$lang/footer.php");
   else
-    include ("i18n/footer.en.php");
+    include ("pages/C/footer.php");
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/include/frontpage.php b/include/frontpage.php
index 193ac5e..8e0e4c8 100644
--- a/include/frontpage.php
+++ b/include/frontpage.php
@@ -22,7 +22,7 @@
 function PrintNews ($lang, $lastvisit, $max=6)
 {
   /* load english news file */
-  include ("i18n/news/en.news.php");
+  include ("pages/C/news/en.news.php");
 
   /* load the translation, if needed */
   if ($lang != "en" && is_file ("i18n/news/".$lang.".news.php"))
@@ -96,10 +96,10 @@ function PrintFrontpage ($lang, $lastvisit)
   $frontpage["news"] = PrintNews ($lang, $lastvisit);
   $frontpage["blog"] = PrintBlog ($lastvisit);
 
-  if (is_file ("i18n/frontpage.".$lang.".php"))
-    include ("i18n/frontpage.".$lang.".php");
+  if (is_file ("pages/$lang/frontpage.php"))
+    include ("pages/$lang/frontpage.php");
   else
-    include ("i18n/frontpage.en.php");
+    include ("pages/C/frontpage.php");
 }
 
 ?>
diff --git a/include/header.php b/include/header.php
index 2827882..fc962f9 100644
--- a/include/header.php
+++ b/include/header.php
@@ -80,8 +80,8 @@ function CreateBreadcrumbs ($uri, $lang)
   global $headtitle;
 
   /* Load breadcrumb correction/translation array */
-  $file = "i18n/arrays/". $lang .".breadcrumbs.php";
-  $file_en = "i18n/arrays/en.breadcrumbs.php";
+  $file = "pages/$lang/arrays/breadcrumbs.php";
+  $file_en = "pages/C/arrays/breadcrumbs.php";
 
   if (is_file ($file))
     include ($file);
@@ -191,10 +191,10 @@ function PrintHeader ($uri, $lang, $layout, $languages)
   $charset = $languages[$lang][1];
 
   /* Get the (translated) file */
-  if (is_file ("i18n/header.".$lang.".php"))
-    include ("i18n/header.".$lang.".php");
+  if (is_file ("pages/$lang/header.php"))
+    include ("pages/$lang/header.php");
   else
-    include ("i18n/header.en.php");
+    include ("pages/C/header.php");
 }
 
 ?>



More information about the Xfce4-commits mailing list