]> git.pld-linux.org Git - projects/buildlogs.git/commitdiff
- gettext support added
authorggodlewski <ggodlewski@pld-linux.org>
Mon, 7 Oct 2002 15:58:35 +0000 (15:58 +0000)
committerggodlewski <ggodlewski@pld-linux.org>
Mon, 7 Oct 2002 15:58:35 +0000 (15:58 +0000)
obsolete/buildlogs/index.php
obsolete/buildlogs/locale/pl_PL/LC_MESSAGES/messages.mo [new file with mode: 0644]
obsolete/buildlogs/locale/pl_PL/LC_MESSAGES/messages.po [new file with mode: 0644]

index 668a548395398938bcf589475c7e39c94bba1483..caf732934677d71f8f31393e0dcc5a75c422fd12 100644 (file)
@@ -33,6 +33,36 @@ $root_directory = "/home/services/ftp/pub/logs";
 $ftp_conn = 0;
 /* It should be set */
 
+$langs["en_US"]["charset"]="ISO-8859-1";
+$langs["pl_PL"]["charset"]="ISO-8859-2";
+
+$lang="en_US";
+if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
+{
+  $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
+  $rows=explode(",",$rows[0]);
+  $lang_detected=rtrim($rows[0]);
+} else if (preg_match("/opera/i",$_SERVER["HTTP_USER_AGENT"]))
+{
+  $lang_detected=preg_replace("/.*\[(.*)\].*/i","\\1",$_SERVER["HTTP_USER_AGENT"]);
+}
+
+// FIXME - some array
+$lang_detected=preg_replace("/^pl$/i","pl_PL",$lang_detected);
+
+if (isset($lang_detected) && isset($langs[$lang_detected]))
+{
+  $lang=$lang_detected;
+}
+
+if (isset($_GET["lang"]))$_SESSION["lang"]=$_GET["lang"];
+if (isset($_SESSION["lang"]))$lang=$_SESSION["lang"];
+
+putenv("LANG=$lang");
+setlocale(LC_ALL,$lang);
+bindtextdomain("messages","locale");
+textdomain("messages");
+
 if (isset($_GET["idx"]))$idx=$_GET["idx"];
 if (isset($_GET["ok"]))$ok=$_GET["ok"];
 if (isset($_GET["ns"]))$ns=$_GET["ns"];
@@ -129,21 +159,21 @@ function open_ftp()
        $ftp = ftp_connect($buildlogs_server);
 
        if ($ftp == false) {
-               mydie("cannot connect to $buildlogs_server");
+               mydie(_("cannot connect to")." $buildlogs_server");
                return false;
        }
 
        if (ftp_login($ftp, "anonymous", 
                      "buildlogs-iface@pld.org.pl") == false) {
                ftp_quit($ftp);
-               mydie("cannot ftp login to $buildlogs_server");
+               mydie(_("cannot ftp login to")." $buildlogs_server");
                return false;
        }
 
        $list = ftp_nlist($ftp, $a);
        if ($list == false) {
                ftp_quit($ftp);
-               mydie("cannot list $a");
+               mydie(_("cannot list")." $a");
                return false;
        }
 
@@ -206,20 +236,20 @@ function list_logs()
                return;
 
        if ($ok == 1) {
-               echo "<h1>Listing of $addr[$idx]/OK "
-                       ."(<a href=\"$big_url&ok=0\">fail</a>)</h1>";
+               echo "<h1>"._("Listing of")." $addr[$idx]/OK "
+                       ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>";
        } else {
-               echo "<h1>Listing of $addr[$idx]/FAIL "
-                       ."(<a href=\"$big_url&ok=1\">ok</a>)</h1>";
+               echo "<h1>"._("Listing of")." $addr[$idx]/FAIL "
+                       ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>";
        }
 
        echo "<div align=center><table border=0 cellspacing=1 ".
                "cellpadding=3 bgcolor=#000000 width=90%>\n";
-       echo "<tr><th bgcolor=#CCCCFF align=left width=60%>Log File ".
-                       "[<a href=\"$big_url&ns=1\">sort</a>]</th>".
-                "<th bgcolor=#CCCCFF align=right width=15%>Size</th> ".
-                "<th bgcolor=#CCCCFF align=left>Age ".
-                        "[<a href=\"$big_url&ns=0\">sort</a>]</th>".
+       echo "<tr><th bgcolor=#CCCCFF align=left width=60%>"._("Log File").
+                       "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
+                "<th bgcolor=#CCCCFF align=right width=15%>"._("Size")."</th> ".
+                "<th bgcolor=#CCCCFF align=left>"._("Age").
+                        "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
                 "</th></tr>";
 
        function cmp($f1, $f2) {
@@ -256,41 +286,29 @@ function list_logs()
                        if ($t >= 24) {
                                $t /= 24;
                                $t = round($t);
-                               if ($t > 1) {
-                                       $t = $t . " days";
-                               } else {
-                                       $t = $t . " day";
-                               }
+                               $t = $t . ngettext(" day"," days",$t);
                        } else {
                                $t = round($t);
-                               if ($t > 1) {
-                                       $t = $t . " hours";
-                               } else {
-                                       $t = $t . " hour";
-                               }
+                               $t = $t . ngettext(" hour"," hours",$t);
                        }
                } else {
                        $t = round($t);
-                       if ($t != 1) {
-                               $t = $t . " minutes";
-                       } else {
-                               $t = $t . " minute";
-                       }
+                       $t = $t . ngettext(" minute"," minutes",$t);
                }
                $u = "$big_url&off=$off&id=$h";
                echo "<tr><td bgcolor=#CCCCCC><a ".
                        "href=\"$u\">".
                     "$f</a> ".
-                    "[<a href=\"$u&action=text\">text</a> | ".
-                     "<a href=\"$u&action=tail\">tail</a>]".
+                    "[<a href=\"$u&action=text\">"._("text")."</a> | ".
+                     "<a href=\"$u&action=tail\">"._("tail")."</a>]".
                     "</td><td bgcolor=#CCCCCC align=right>".
                     "$s</td><td bgcolor=#CCCCCC>$t</td></tr>\n";
        }
        echo "</table></div>\n";
 
        $backarr = "&lt;&lt;&lt;&nbsp;";
-       $back = "Page back";
-       $forward = "Page forward";
+       $back = _("Page back");
+       $forward = _("Page forward");
        $forwardarr = "&nbsp;&gt;&gt;&gt;";
 
        echo "<p><table width=90% align=center><tr><td align=left width=1%>";
@@ -308,8 +326,7 @@ function list_logs()
        echo "</td>\n<td align=center>";
 
        if ($qa_addr[$idx] != "") {
-               echo "[<a href=\"$big_url&action=qa\">View <quot>rpm&nbsp;-qa</quot> of ".
-                       "builder</a>]";
+               echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm&nbsp;-qa</quot> of builder")."</a>]";
        } else {
                echo "&nbsp;";
        }
@@ -356,7 +373,7 @@ function file_name()
        }
 
        if ($f == false) {
-               mydie("cannot find specified file: $id");
+               mydie(_("cannot find specified file:")." $id");
                if ($local == 0)
                        ftp_quit($ftp_conn);
                return false;
@@ -393,8 +410,8 @@ function dump_log($tail)
        }
 
        one_item("Status", ($ok == 1 ?  
-                               "<font color=green><b>OK</b></font>" : 
-                               "<font color=red><b>Failed</b></a>"));
+                               "<font color=green><b>"._("OK")."</b></font>" : 
+                               "<font color=red><b>"._("Failed")."</b></a>"));
        one_item("Source URL", 
                 href("ftp://$buildlogs_server$f", 
                      "ftp://$buildlogs_server$f"));
@@ -411,9 +428,9 @@ function dump_log($tail)
        }
 
        if ($qa_addr[$idx] != "") {
-               one_item("rpm -qa of builder", href("$bu&action=qa", "View!"));
+               one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
        } else {
-               one_item("rpm -qa of builder", "Not available");
+               one_item(_("rpm -qa of builder"), _("Not available"));
         }
        if ($local) {
                one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
@@ -427,7 +444,7 @@ function dump_log($tail)
                getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
             "</td></tr>"; */
 
-       echo "</table><h2>Content:</h2>";
+       echo "</table><h2>"._("Content:")."</h2>";
 
        if ($local == 0) {
                ftp_quit($ftp_conn);
@@ -466,11 +483,11 @@ function dump_log($tail)
        <table width=100%>
         <tr>
          <td align=left>
-          [<a href="<?php echo $bu; ?>">Back to list of logs</a>]
+          [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
          </td>
          <td align=right>
           [<a href="<?php echo "$bu&action=qa" 
-               ?>">View rpm -qa of builder</a>]
+               ?>"><?=_("View rpm -qa of builder")?></a>]
          </td>
         </tr>
        </table>
@@ -525,8 +542,10 @@ function list_archs()
 {
        global $addr, $url, $idx;
 
+       $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
+
        echo "<table width=100% border=0>\n";
-       echo "<tr><td bgcolor=#cccccc nowrap=1>Failed</td><td bgcolor=#cccccc>Ok</td></tr>\n";
+       echo "<tr><td bgcolor=#cccccc nowrap=1>"._("Failed")."</td><td bgcolor=#cccccc>"._("Ok")."</td></tr>\n";
        for ($i = 0; $i < count($addr); $i++)
                echo "<tr><td nowrap=1>".
                     "<a href=\"$url?idx=$i&ok=0\">$addr[$i]</a></td><td nowrap=1>".
@@ -536,7 +555,7 @@ function list_archs()
        echo "</table><hr />\n";
        echo "<div align=\"center\"><a href=\"$url\">main()</a><hr />\n";
        echo "<a href=\"http://www.pld.org.pl/\"><img src=powpld.png ".
-               "alt=\"Powered by PLD Linux\" border=0></a><br />\n" .
+               "alt=\""._("Powered by PLD Linux")."\" border=0></a><br />\n" .
             "<small>(c) 2002 ".
             "<a href=\"mailto:feedback@pld.org.pl\">PLD&nbsp;Team</a>\n".
             "</small></div>\n";
@@ -559,7 +578,7 @@ function list_archs()
                     "Paranoid Android", "Lunatic Corp"
                     # feel free to add sth if you change this file ;)
                     );
-       echo "Powered by ";
+       echo _("Powered by")." ";
        $max = 1;
        for ($i = 0; $i < $max; $i++) {
                $x = rand(0, count($pow) - 1);
@@ -567,7 +586,6 @@ function list_archs()
                else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
                $pow[$x] = "";
        }
-
        echo "</small></div>";
 
        global $qa_addr;
@@ -577,10 +595,9 @@ function list_archs()
        echo "<input type=hidden name=idx value=$idx />";
        echo "<input type=hidden name=action value=sqa />";
        echo "<input type=text size=14 name=str /><br/>";
-       echo "<input type=submit name=submit value=\"Search rpmqa!\" />";
+       echo "<input type=submit name=submit value=\""._("Search rpmqa!")."\" />";
        echo "</form>";
        }
-
 }
 
 function get_qa()
@@ -603,12 +620,12 @@ function search_qa()
        global $url, $idx, $qa_addr, $str;
 
        $f = get_qa();
-       echo "<h1>Search results for '$str' in $qa_addr[$idx]</h1>";
+       echo "<h1>"._("Search results for")." '$str' "._("in")." $qa_addr[$idx]</h1>";
 
        start_pre();
 
        if ($f == 0) {
-               echo "Sorry, cannot open.";
+               echo _("Sorry, cannot open.");
        } else {
                while (($s = fgets($f, 1000)) != false) {
                        if (stristr($s, $str))
@@ -629,16 +646,15 @@ function dump_qa($plain)
 
        if ($plain) {
                header("Content-type: text/plain"); 
-               echo "# rpm -qa of $a\n";
+               echo _("# rpm -qa of")." $a\n";
        } else {
-               echo "<h1>rpm -qa of $a</h1>";
-               echo "<a href=\"$url?idx=$idx&action=qatxt\">text/plain "
-                       ."version</a>";
+               echo "<h1>"._("rpm -qa of")." $a</h1>";
+               echo "<a href=\"$url?idx=$idx&action=qatxt\">"._("text/plain version")."</a>";
                start_pre();
        }
 
        if ($f == 0) {
-               echo "Sorry, cannot open.";
+               echo _("Sorry, cannot open.");
        } else {
                while (($s = fgets($f, 1000)) != false) {
                        echo $s;
@@ -653,13 +669,13 @@ function welcome()
 {
 ?>
 <table border=0 width=100%><tr><td width=20%>&nbsp;</td><td>
-<h1>Zdrastwuj!</h1>
-<p>Welcome to PLD Build Logs WWW interface.</p><p>
-Feel free to email bug reports, complaints and feature requests 
+<h1><?=_("Welcome!")?></h1>
+<p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
+<?=_("Feel free to email bug reports, complaints and feature requests ")?>
 <!-- ech... niech strace... -->
-<a href="mailto:feedback@pld.org.pl">to us</a>. Positive opinions are also 
-<a href="mailto:feedback@pld.org.pl">welcome</a> ;)</p>
-<p>Version: $Id: index.php,v 1.26 2002/10/07 12:20:46 malekith Exp $</p>
+<a href="mailto:malekith /at/ pld-linux org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?> 
+<a href="mailto:malekith /at/ pld-linux org"><?=_("welcome")?></a> ;)</p>
+<p>Version: $Id: index.php,v 1.24 2002/10/07 11:04:22 ggodlewski Exp $</p>
 </td><td width=20%>&nbsp;</td></tr>
 </table>
 <?php
diff --git a/obsolete/buildlogs/locale/pl_PL/LC_MESSAGES/messages.mo b/obsolete/buildlogs/locale/pl_PL/LC_MESSAGES/messages.mo
new file mode 100644 (file)
index 0000000..7b6fb10
Binary files /dev/null and b/obsolete/buildlogs/locale/pl_PL/LC_MESSAGES/messages.mo differ
diff --git a/obsolete/buildlogs/locale/pl_PL/LC_MESSAGES/messages.po b/obsolete/buildlogs/locale/pl_PL/LC_MESSAGES/messages.po
new file mode 100644 (file)
index 0000000..bfaacbb
--- /dev/null
@@ -0,0 +1,190 @@
+# Polish messages for PLD BTS.
+# Copyright (C) 2002 Grzegorz Godlewski
+# This file is distributed under the same license as the PLD BTS.
+# Grzegorz Godlewski <ggodlewski@pld.org.pl>, 2002.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: 1.0\n"
+"POT-Creation-Date: 2002-10-07 16:01+0200\n"
+"PO-Revision-Date: 2002-10-07 16:01+0200\n"
+"Last-Translator: Grzegorz Godlewski <ggodlewski@pld.org.pl>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-2\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: index.php:137
+msgid "cannot connect to"
+msgstr "Nie mogê nawi±zaæ po³±czenia z"
+
+#: index.php:144
+msgid "cannot ftp login to"
+msgstr "Nie mogê zalogowaæ siê na serwerze ftp"
+
+#: index.php:151
+msgid "cannot list"
+msgstr "Nie mo¿na wylistowaæ"
+
+#: index.php:214 index.php:217
+msgid "Listing of"
+msgstr "Lista"
+
+#: index.php:215
+msgid "fail"
+msgstr "przerwane"
+
+#: index.php:218
+msgid "ok"
+msgstr "og"
+
+#: index.php:223
+msgid "Log File"
+msgstr "Log"
+
+#: index.php:289
+msgid "text"
+msgstr "tekst"
+
+#: index.php:290
+msgid "tail"
+msgstr "koñcówka"
+
+#: index.php:297
+msgid "Page back"
+msgstr "Strona wstecz"
+
+#: index.php:298
+msgid "Page forward"
+msgstr "Strona naprzód"
+
+#: index.php:316
+msgid "View <quot>rpm&nbsp;-qa</quot> of builder"
+msgstr "Zobacz <quot>rpm&nbsp;-qa</quot> z buildera"
+
+#: index.php:363
+msgid "cannot find specified file:"
+msgstr "nie mo¿na znale¼æ pliku:"
+
+#: index.php:400
+msgid "OK"
+msgstr "OK"
+
+#: index.php:401 index.php:533
+msgid "Failed"
+msgstr "Przerwane"
+
+#: index.php:418 index.php:420
+msgid "rpm -qa of builder"
+msgstr "rpm -qa z buildera"
+
+#: index.php:418
+msgid "View!"
+msgstr "Zobacz!"
+
+#: index.php:420
+msgid "Not available"
+msgstr "Nie dostêpne"
+
+#: index.php:434
+msgid "Content:"
+msgstr "Zawarto¶æ:"
+
+#: index.php:473
+msgid "Back to list of logs"
+msgstr "Wróæ do listy logów"
+
+#: index.php:533
+msgid "Ok"
+msgstr "Ok"
+
+#: index.php:543
+msgid "Powered by PLD Linux"
+msgstr "Napêdzane przez PLD Linux"
+
+#: index.php:566
+msgid "Powered by"
+msgstr "Napêdzane przez"
+
+#: index.php:584
+msgid "Search rpmqa!"
+msgstr "Przeszukaj rpmqa!"
+
+#: index.php:610
+msgid "Search results for"
+msgstr "Wynik szukania"
+
+#: index.php:610
+msgid "in"
+msgstr "w"
+
+#: index.php:615 index.php:644
+msgid "Sorry, cannot open."
+msgstr "Nie mogê otworzyæ"
+
+#: index.php:636
+msgid "# rpm -qa of"
+msgstr "# rpm -qa z"
+
+#: index.php:638
+msgid "rpm -qa of"
+msgstr "rpm -qa z"
+
+#: index.php:639
+msgid "text/plain version"
+msgstr "teks/czysta wersja"
+
+#: index.php:659
+msgid "Welcome!"
+msgstr "Witaj!"
+
+#: index.php:660
+msgid "Welcome to PLD Build Logs WWW interface."
+msgstr "Witaj w interfejsie WWW logów budowania PLD"
+
+#: index.php:661
+msgid "Feel free to email bug reports, complaints and feature requests "
+msgstr "Nie krêpuj siê wysy³aæ raporty z b³êdami, za¿alenia i ¿yczenia"
+
+#: index.php:663
+msgid "to us"
+msgstr "do nas"
+
+#: index.php:663
+msgid "Positive opinions are also"
+msgstr "Pozytywne opinie s± równie¿"
+
+#: index.php:664
+msgid "welcome"
+msgstr "mile widziane"
+
+#: index.php:230 index.php:233
+msgid "sort"
+msgstr "sortuj"
+
+#: index.php:231
+msgid "Size"
+msgstr "Rozmiar"
+
+#: index.php:232
+msgid "Age"
+msgstr "Wiek"
+
+msgid " day"
+msgid_plural " days"
+msgstr[0] " dnia"
+msgstr[1] " dni"
+msgstr[2] " dni"
+
+msgid " hour"
+msgid_plural " hours"
+msgstr[0] " godziny"
+msgstr[1] " fodzin"
+msgstr[2] " dni"
+
+msgid " minute"
+msgid_plural " minutes"
+msgstr[0] " minuty"
+msgstr[1] " minut"
+msgstr[2] " minut"
This page took 0.080338 seconds and 4 git commands to generate.