[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r817 - Extractor-docs/WWW GNUnet-docs/WWW i18nHTML i18nHTML
From: |
grothoff |
Subject: |
[GNUnet-SVN] r817 - Extractor-docs/WWW GNUnet-docs/WWW i18nHTML i18nHTML/contrib |
Date: |
Wed, 25 May 2005 05:05:50 -0700 (PDT) |
Author: grothoff
Date: 2005-05-25 05:05:16 -0700 (Wed, 25 May 2005)
New Revision: 817
Added:
Extractor-docs/WWW/example.php
Extractor-docs/WWW/example2.php
Extractor-docs/WWW/i18nhtml.inc.php
Extractor-docs/WWW/i18nhtml_config.inc.php
Extractor-docs/WWW/start.php
Extractor-docs/WWW/status.php
Extractor-docs/WWW/update0_1_0.php
Extractor-docs/WWW/update0_2_0.php
GNUnet-docs/WWW/example.php
GNUnet-docs/WWW/example2.php
GNUnet-docs/WWW/i18nhtml.inc.php
GNUnet-docs/WWW/i18nhtml_config.inc.php
GNUnet-docs/WWW/start.php
GNUnet-docs/WWW/update0_1_0.php
GNUnet-docs/WWW/update0_2_0.php
Removed:
Extractor-docs/WWW/i18nhtml.inc
Extractor-docs/WWW/i18nhtml_config.inc
GNUnet-docs/WWW/i18nhtml.inc
GNUnet-docs/WWW/i18nhtml_config.inc
Modified:
Extractor-docs/WWW/commitMassTranslation.php
Extractor-docs/WWW/commitTranslation.php
Extractor-docs/WWW/editor.php
Extractor-docs/WWW/html_header.php3
Extractor-docs/WWW/translate.php
Extractor-docs/WWW/vote.php
GNUnet-docs/WWW/commitMassTranslation.php
GNUnet-docs/WWW/commitTranslation.php
GNUnet-docs/WWW/editor.php
GNUnet-docs/WWW/scripts.inc
GNUnet-docs/WWW/status.php
GNUnet-docs/WWW/translate.php
GNUnet-docs/WWW/vote.php
i18nHTML/AUTHORS
i18nHTML/ChangeLog
i18nHTML/README
i18nHTML/contrib/populate.sql
Log:
update
Modified: Extractor-docs/WWW/commitMassTranslation.php
===================================================================
--- Extractor-docs/WWW/commitMassTranslation.php 2005-05-25 11:52:28 UTC
(rev 816)
+++ Extractor-docs/WWW/commitMassTranslation.php 2005-05-25 12:05:16 UTC
(rev 817)
@@ -17,7 +17,7 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
@@ -39,10 +39,10 @@
if ( ($dec == "xlang") || ($dec == "start") )
continue;
$val = fix($val);
- $query = "SELECT c FROM pending WHERE lang=\"$xlang\"";
+ $query = "SELECT c FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$xlang\"";
$result = mysql_query($query, $connection);
$num = 0;
- if ($result)
+ if ($result)
$num = mysql_numrows($result);
while ($num > 0) {
$num--;
@@ -59,36 +59,36 @@
$dec);
P();
continue;
- }
- $query = "DELETE FROM pending WHERE lang=\"$lang\" AND c=\"$enc_sql\"";
- mysql_query($query, $connection);
+ }
+ $query = "DELETE FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$lang\" AND
c=\"$enc_sql\"";
+ mysql_query($query, $connection);
$val_sql = mysql_real_escape_string(to_unicode($val));
- $query = "SELECT ranking FROM map WHERE name=\"$enc_sql\"" .
+ $query = "SELECT ranking FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$enc_sql\"" .
" AND lang=\"$lang\" AND translation=\"$val_sql\"";
$result = mysql_query($query, $connection);
$num = 0;
- if ($result)
+ if ($result)
$num = mysql_numrows($result);
if ($num == 0) {
$txtCnt = count_chars(stripslashes($enc_sql), 1);
$tCnt = count_chars(stripslashes($val_sql), 1);
if ($txtCnt[ord('%')] != $tCnt[ord('%')]) {
W("Commit '%s->%s' failed.", stripslashes($enc_sql),
stripslashes($val_sql));
- W("The number of percent signs in source text and translation do not
match.");
+ W("The number of percent signs in source text and translation do not
match.");
W("Note that you must preserve all %%s expressions unchanged.");
W("Also, a single displayed %% sign must be translated into two (%%%%)
such signs.");
P();
} else {
- $query = "INSERT INTO map VALUES(\"$enc_sql\", \"$lang\", " .
+ $query = "INSERT INTO ".$i18nHTMLsqlPrefix."map VALUES(\"$enc_sql\",
\"$lang\", " .
"\"$val_sql\", 1, \"" . $_SERVER['REMOTE_ADDR'] . "\");";
mysql_query($query, $connection);
$done++;
W("Storing translation for "%s" = "%s".",
ARRAY(stripslashes($enc_sql),
stripslashes($val_sql)));
- BR();
+ BR();
}
- }
+ }
}
P();
echo "<a href=\"" . $i18nHTMLbase . "editor.php?xlang=" . $lang . "&start=" .
($start - $done) . "\">";
Modified: Extractor-docs/WWW/commitTranslation.php
===================================================================
--- Extractor-docs/WWW/commitTranslation.php 2005-05-25 11:52:28 UTC (rev
816)
+++ Extractor-docs/WWW/commitTranslation.php 2005-05-25 12:05:16 UTC (rev
817)
@@ -17,7 +17,7 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
@@ -33,18 +33,18 @@
$back = $_REQUEST['back'];
// check for identical translation
-$query = "SELECT ranking FROM map WHERE name=\"$text_sql\"" .
+$query = "SELECT ranking FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$text_sql\"" .
" AND lang=\"$lang\" AND translation=\"$translation_sql\"";
$result = mysql_query($query, $connection);
$num = 0;
-if ($result)
+if ($result)
$num = mysql_numrows($result);
if ($num > 0) {
echo "<html><head>";
TITLE("Translation exists.");
echo "</head><body>";
W("Translation '%s' of sentence '%s' exists.",
- ARRAY(fix($translation), $text));
+ ARRAY(fix($translation), $text));
extlink($back, "Back...");
generateFooter();
echo "</body></html>";
@@ -56,17 +56,17 @@
TITLE("Commit failed.");
echo "</head><body>";
W("Commit failed ('%s' and '%s').", ARRAY($text, $translation));
- W("The number of percent signs in source text and translation does not
match.");
+ W("The number of percent signs in source text and translation does not
match.");
W("Note that you must preserve all %%s expressions unchanged.");
W("Also, a single displayed %% sign must be translated into two (%%%%)
such signs.");
echo "</body></html>";
} else {
- $query = "INSERT INTO map VALUES(\"$text_sql\", \"$lang\", " .
+ $query = "INSERT INTO ".$i18nHTMLsqlPrefix."map VALUES(\"$text_sql\",
\"$lang\", " .
"\"$translation_sql\", 1, \"" . $_SERVER['REMOTE_ADDR'] . "\");";
$result = mysql_query($query, $connection);
if ($result) {
- $query = "DELETE FROM pending WHERE lang=\"$lang\" AND c=\"$text_sql\"";
- mysql_query($query, $connection);
+ $query = "DELETE FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$lang\"
AND c=\"$text_sql\"";
+ mysql_query($query, $connection);
header("Location: " . $back); /* Redirect browser */
} else {
echo "<html><head>";
@@ -76,6 +76,6 @@
echo mysql_error();
echo "</body></html>";
}
- }
+ }
}
?>
Modified: Extractor-docs/WWW/editor.php
===================================================================
--- Extractor-docs/WWW/editor.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/editor.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -17,7 +17,7 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
@@ -30,8 +30,8 @@
if ( (! $xlang) || ($xlang == "English") ) {
echo "Cannot translate to English.";
die();
- }
-$start = $_REQUEST['start'];
+ }
+$start = $_REQUEST['start'];
H2("Mass translation to %s", $xlang);
W("This page is for translating lots of sentences at once.");
W("The sentences are ordered by the frequency that they are requested by
users.");
@@ -42,7 +42,7 @@
W("Do not copy the quotes (") from the original messages into the
translations.");
W("Leave translations that you cannot do blank.");
-$query = "SELECT c FROM pending WHERE lang=\"$lang\" ORDER BY count DESC";
+$query = "SELECT c FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$lang\"
ORDER BY count DESC";
$result = mysql_query($query, $connection);
$num = 0;
if ($result)
@@ -70,7 +70,7 @@
echo "<input type=hidden name=\"xlang\" value=\"$xlang\">";
$endp = $end + 1;
echo "<input type=hidden name=\"start\" value=\"$endp\">";
-
+
echo "<table border=5>";
echo "<tr>";
TH("Original");
@@ -82,26 +82,26 @@
continue;
$cx_plain = fix($row["c"]);
$cx_sql = mysql_real_escape_string($cx_plain);
-
- $query = "SELECT ranking FROM map WHERE name=\"$cx_sql\" AND
lang=\"$lang\"";
+
+ $query = "SELECT ranking FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$cx_sql\" AND lang=\"$lang\"";
$result2 = mysql_query($query, $connection);
$num2 = 0;
- if ($result2)
+ if ($result2)
$num2 = mysql_numrows($result2);
echo "<tr><td width=\"45%\">";
echo ""$cx_plain"";
echo "</td>\n\t<td width\"50\%\">";
if ($num2 > 0) {
- $query = "DELETE FROM pending WHERE lang=\"$lang\" AND c=\"$cx_sql\"";
- mysql_query($query, $connection);
+ $query = "DELETE FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$lang\"
AND c=\"$cx_sql\"";
+ mysql_query($query, $connection);
W("Skipped (already translated).");
} else {
echo "<input size=\"40\" maxlength=\"65535\" name=\"" .
bin2hex(md5($cx_plain)) . "\"></td></tr>\n";
}
}
echo "</tr></table>";
- echo "<input type=submit value=\"" .
- TRANSLATE_("I hereby give all these translations into the Public Domain
(commit)") .
+ echo "<input type=submit value=\"" .
+ TRANSLATE_("I hereby give all these translations into the Public Domain
(commit)") .
"\">";
echo "</form>";
}
Added: Extractor-docs/WWW/example.php
===================================================================
--- Extractor-docs/WWW/example.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/example.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,29 @@
+<?php
+include("i18nhtml.inc.php");
+DOCTYPE("HTML");
+echo "<html><head>";
+TITLE("Example page");
+echo "</head><body>";
+H1("Some document title");
+W("A sentence to translate.");
+W("A sentence with an argument '%s' that cannot be translated.",
+ "foo");
+W("A sentence with two arguments '%s' and '%s' that cannot be translated.",
+ ARRAY("foo", "bar"));
+P(); // <p>
+W("A sentence with a %s that CAN be translated.",
+ extlink_("http://gnunet.org/i18nHTML/", "link text"));
+W("A %s to another translatable page.",
+ intlink_("http://gnunet.org/i18nHTML/index", "link")); // .php is added
automatically!
+BR(); // <br>
+echo W_("A function returning the translation.");
+W("For more functions, look into i18nhtml.inc.");
+
+HR();
+W("And finally put the language selection bar somewhere:");
+generateLanguageBar(); // allow user to select other languages
+P();
+W("Oh, and put the footer to allow the editor mode:");
+generateFooter();
+echo "</body></html>";
+?>
\ No newline at end of file
Added: Extractor-docs/WWW/example2.php
===================================================================
--- Extractor-docs/WWW/example2.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/example2.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,61 @@
+<?php
+include("i18nhtml.inc.php"); // do this 1st, add translation support
+DOCTYPE("HTML","Transitional"); // tell the user agent document format
+setTranslateLinkMarker("***"); // make translation marker more visible
+editOnlyUntranslatedText(); // restrict translations to
untranslated strings
+
+echo "<html><head>";
+TITLE("Another Example Page");
+echo "</head><body>";
+
+HR();
+generateLanguageBar(); // allow user to select other languages
+HR();
+
+H1("header1");
+H2("header2");
+H3("header3");
+H2("header2 again");
+H3("yet another sub header");
+H3("and again, I think you get the idea");
+P(); // <p>
+W("A sentence to translate.");
+W("A sentence with an argument '%s' that cannot be translated.",
+ "foo");
+W("A sentence with two arguments '%s' and '%s' that cannot be translated.",
+ ARRAY("foo", "bar"));
+P(); // <p>
+echo "This is untranslated text\n";
+BR(); // <br>
+echo "another way to translate text, note each W chunk represents a ";
+echo "single translatable chunk so similar to above, but split into ";
+echo "multiple translation chunks.<br>";
+$myvar = W_("A sentence with an argument ");
+$myvar = $myvar . "foo" . W_(" that cannot be translated.");
+echo $myvar;
+P(); // <p>
+echo "here we have text that is translated, but not easily edited";
+echo "unless it happens to match some other text.<br>";
+$myvar = TRANSLATE_("A sentence with an argument ");
+$myvar = $myvar . "foo" . TRANSLATE_(" that is not translatable.");
+echo $myvar;
+W("A sentence with a %s that CAN be translated.",
+ extlink_("http://gnunet.org/i18nHTML/", "link text"));
+W("A %s to another translatable page.",
+ intlink_("http://gnunet.org/i18nHTML/index", "link")); // .php is added
automatically!
+BR(); // <br>
+echo W_("A function returning the translation.");
+W("For more functions, look into i18nhtml.inc.");
+P();
+
+HR();
+$t = "Notice how we don't have to escape or quote(\") ampersands & nor other";
+$t = $t . "HTML entities. <<<--->>> and such even work. This looks like
&\n";
+W($t);
+HR();
+
+P();
+W("Insert footer to allow entering translation edit mode:");
+generateFooter();
+echo "</body></html>";
+?>
Modified: Extractor-docs/WWW/html_header.php3
===================================================================
--- Extractor-docs/WWW/html_header.php3 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/html_header.php3 2005-05-25 12:05:16 UTC (rev 817)
@@ -1,5 +1,5 @@
<?php
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
DOCTYPE("HTML", "Transitional");
echo "<html><head>\n";
if ($title) {
Deleted: Extractor-docs/WWW/i18nhtml.inc
===================================================================
--- Extractor-docs/WWW/i18nhtml.inc 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/i18nhtml.inc 2005-05-25 12:05:16 UTC (rev 817)
@@ -1,888 +0,0 @@
-<?php
-/*
- (C) 2003, 2004, 2005 Christian Grothoff and other contributing authors.
-
- This code is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
- option) any later version.
-
- The code is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with the code; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
- // This file defines the functions that will be used
- // to build the webpage. The set may not contain everything
- // you might want, so feel free to define your own extensions.
-
- // Use W("text") to output translations.
- // $lang/xlang are used to specify the language
- // $editor can be set to create a translation
- // tag even if a translation is already available.
- // there is currently no security.
- //
- // An "_" is used for functions that return the
- // translated string instead of printing it directly.
- // These functions are used for "%s" printing with W().
- //
- // Most of the code should be straight forward. Look
- // at some of the example files that use it and compare with
- // the generated pages.
-// obtain user db specific configuration parameters
-include("i18nhtml_config.inc");
-header("Content-type: text/html; charset=utf-8");
-
-if (get_magic_quotes_gpc())
- die('PHP misconfigured. Disable get_magic_quotes.');
-
-// establish default connection to database server
-$connection = @mysql_connect($i18nHTMLsqlServer,
- $i18nHTMLsqlUser,
- $i18nHTMLsqlPass);
-if (!$connection) {
- die ('Failure connecting to ' . $i18nHTMLsqlServer . ' : ' . mysql_error());
-}
-
-// and select database on server that holds translations
-if ($connection) {
- $db_selected = mysql_select_db($i18nHTMLsqlDB,
- $connection);
- if (!$db_selected) {
- die ('Error selecting db : ' . mysql_error());
- }
-}
-
-// ensure the mapping and pending tables exist, creating them if not
-$query="CREATE TABLE IF NOT EXISTS map" .
- " (name BLOB, lang TINYBLOB, translation BLOB, ranking INT, ip
TINYTEXT, " .
- "INDEX(name(10)), INDEX(lang(4)), INDEX(ranking),
INDEX(translation(10)))";
-$result = mysql_query($query, $connection);
-if (($i18nHTMLdebug == 1) && (!$result)) {
- die('Unable to validate map table. Invalid query: ' . mysql_error());
-}
-
-$query="CREATE TABLE IF NOT EXISTS pending" .
- " (c BLOB, lang TINYBLOB, count INT, " .
- "INDEX(c(10)), INDEX(lang(4)), INDEX(count))";
-$result = mysql_query($query, $connection);
-if (($i18nHTMLdebug == 1) && (!$result)) {
- die('Unable to validate pending table. Invalid query: ' . mysql_error());
-}
-
-/* mapping of real-names to language codes */
-$languagecodes = array("English"=>"en",
- "German"=>"de",
- "French"=>"fr",
- "Portuguese"=>"pt",
- "Russian"=>"ru",
- "Romanian"=>"ro",
- "Spanish"=>"es",
- "Italian"=>"it",
- "Simplified chinese"=>"zh_CN",
- "Catalan"=>"ca",
- "Basque"=>"eu",
- "Arabic"=>"ar",
- "Bulgarian"=>"bg",
- "Czech"=>"cs",
- "Dutch"=>"nl",
- "Esperanto"=>"eo",
- "Hebrew"=>"he",
- "Japanese"=>"ja",
- "Norwegian"=>"no",
- "Polish"=>"po",
- "Ukrainian"=>"uk",
- "Danish"=>"da",
- "Swedish"=>"sv");
-
-/* try to automagically figure out user preferences */
-$hlang = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
-if ($hlang) {
- $tok = strtok($hlang, ";");
- while ($tok) {
- foreach($languagecodes as $name=>$code) {
- if (0 == strncmp($tok, $code, 2)) {
- $lang = $name;
- break 2;
- }
- }
- $tok = strtok(";");
- }
-}
-// If no language is specified, use english.
-if ( (! $lang) || ($lang=="") )
- $lang = "English";
-$xlang = $_REQUEST['xlang'];
-if ($xlang)
- $lang = $xlang;
-$lang = ucfirst(strtolower($lang));
-$lang = mysql_real_escape_string($lang);
-$editor = $_REQUEST['editor'];
-$i18nHTMLhasTranslation = 0; // set by last call to translation_query()
-
-/**
- * Replace certain HTML named special characters with their
- * numeric codes (some browsers don't work with the symbolic names).
- */
-$htmlin = array("’", ">", """, "′", "&", "\"",
"'", "`", "‘");
-$htmlout = array("’", ">", """ , "′", "&", """,
"′", "’", "‘");
-function fix($a) {
- global $htmlin;
- global $htmlout;
- return str_replace($htmlin, $htmlout, $a);
-}
-
-// *************************************************
-// i18nHTML configuration API functions
-// *************************************************
-
-// change the marker text shown to indicate text
-// is translatable (link to translate page text)
-function setTranslateLinkMarker($marker) {
- global $i18nHTMLmarker;
-
- if ($marker == "")
- $i18nHTMLmarker = "*"; // reset to default value
- else
- $i18nHTMLmarker = $marker;
-}
-
-// ***************************************************
-// i18nHTML _internal_ API functions (don't look here)
-// ***************************************************
-
-// returns a HTML string to link to enable one to translate the given
-// text ($a) when $editor has a nonzero value or
-// $i18nHTMLhasTranslation is 0; otherwise and empty string ("") is
-// returned.
-function translateLink_($a) {
- global $lang;
- global $HTTP_SERVER_VARS;
- global $editor;
- global $i18nHTMLhasTranslation;
- global $i18nHTMLmarker;
- global $i18nHTMLbase;
-
- if ($hasTranslation == "")
- $hasTranslation = $i18nHTMLhasTranslation;
- if ( ($editor) || ($i18nHTMLhasTranslation == 0) ) {
- $back = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] .
$HTTP_SERVER_VARS["REQUEST_URI"];
- return "<a href=\"" . $i18nHTMLbase . "translate.php?xlang="
- . $lang
- . "&text=" . urlencode(fix($a))
- . "&back=" . urlencode($back)
- . "\">" . $i18nHTMLmarker . "</a>\n";
- } else
- return "";
-}
-
-// displays a link to the page to enable one to
-// translate the given text ($a)
-// see translateLink_
-function translateLink($a) {
- echo translateLink_($a);
-}
-
-/**
- * transcode unicode entities to/from HTML entities
- *
- * Also, this function transforms HTML entities into their equivalent Unicode
entities.
- * For example, w.bloggar posts pages using HTML entities.
- * If you have to modify these pages using web forms, you would like to get
UTF-8 instead.
- *
- * @link
http://www.evolt.org/article/A_Simple_Character_Entity_Chart/17/21234/ A Simple
Character Entity Chart
- *
- * @param string the string to be transcoded
- * @param boolean TRUE to transcode to Unicode, FALSE to transcode to HTML
- * @return a transcoded string
- */
-function transcode($input, $to_unicode=TRUE) {
- // initialize tables only once
- static $html_entities, $unicode_entities;
- if(!is_array($html_entities)) {
-
-
- // numerical order
- $codes = array(
- ' ' => ' ', // non-breaking space
- '¡' => '¡', // inverted exclamation mark
- '¢' => '¢', // cent sign
- '£' => '£', // pound sign
- '¤' => '¤', // currency sign
- '¥' => '¥', // yen sign
- '¦' => '¦', // broken bar
- '§' => '§', // section sign
- '¨' => '¨', // diaeresis
- '©' => '©', // copyright sign
- 'ª' => 'ª', // feminine ordinal indicator
- '«' => '«', // left-pointing double angle
quotation mark
- '¬' => '¬', // not sign
- '­' => '­', // soft hyphen
- '®' => '®', // registered sign
- '¯' => '¯', // macron
- '°' => '°', // degree sign
- '±' => '±', // plus-minus sign
- '²' => '²', // superscript two
- '³' => '³', // superscript three
- '´' => '´', // acute accent
- 'µ' => 'µ', // micro sign
- '¶' => '¶', // pilcrow sign
- '·' => '·', // middle dot
- '¸' => '¸', // cedilla
- '¹' => '¹', // superscript one
- 'º' => 'º', // masculine ordinal indicator
- '»' => '»', // right-pointing double angle
quotation mark
- '¼' => '¼', // vulgar fraction one quarter
- '½' => '½', // vulgar fraction one half
- '¾' => '¾', // vulgar fraction three
quarters
- '¿' => '¿', // inverted question mark
- 'À' => 'À', // latin capital letter A with
grave
- 'Á' => 'Á', // latin capital letter A with
acute
- 'Â' => 'Â', // latin capital letter A with
circumflex
- 'Ã' => 'Ã', // latin capital letter A with
tilde
- 'Ä' => 'Ä', // latin capital letter A with
diaeresis
- 'Å' => 'Å', // latin capital letter A with
ring above
- 'Æ' => 'Æ', // latin capital letter AE
- 'Ç' => 'Ç', // latin capital letter C with
cedilla
- 'È' => 'È', // latin capital letter E with
grave
- 'É' => 'É', // latin capital letter E with
acute
- 'Ê' => 'Ê', // latin capital letter E with
circumflex
- 'Ë' => 'Ë', // latin capital letter E with
diaeresis
- 'Ì' => 'Ì', // latin capital letter I with
grave
- 'Í' => 'Í', // latin capital letter I with
acute
- 'Î' => 'Î', // latin capital letter I with
circumflex
- 'Ï' => 'Ï', // latin capital letter I with
diaeresis
- 'Ð' => 'Ð', // latin capital letter
ETH
- 'Ñ' => 'Ñ', // latin capital letter N with
tilde
- 'Ò' => 'Ò', // latin capital letter O with
grave
- 'Ó' => 'Ó', // latin capital letter O with
acute
- 'Ô' => 'Ô', // latin capital letter O with
circumflex
- 'Õ' => 'Õ', // latin capital letter O with
tilde
- 'Ö' => 'Ö', // latin capital letter O with
diaeresis
- '×' => '×', // multiplication sign
- 'Ø' => 'Ø', // latin capital letter O with
stroke
- 'Ù' => 'Ù', // latin capital letter U with
grave
- 'Ú' => 'Ú', // latin capital letter U with
acute
- 'Û' => 'Û', // latin capital letter U with
circumflex
- 'Ü' => 'Ü', // latin capital letter U with
diaeresis
- 'Ý' => 'Ý', // latin capital letter Y with
acute
- 'Þ' => 'Þ', // latin capital letter THORN
- 'ß' => 'ß', // latin small letter sharp s
- 'à' => 'à', // latin small letter a with
grave
- 'á' => 'á', // latin small letter a with
acute
- 'â' => 'â', // latin small letter a with
circumflex
- 'ã' => 'ã', // latin small letter a with
tilde
- 'ä' => 'ä', // latin small letter a with
diaeresis
- 'å' => 'å', // latin small letter a with
ring above
- 'æ' => 'æ', // latin small letter ae
- 'ç' => 'ç', // latin small letter c with
cedilla
- 'è' => 'è', // latin small letter e with
grave
- 'é' => 'é', // latin small letter e with
acute
- 'ê' => 'ê', // latin small letter e with
circumflex
- 'ë' => 'ë', // latin small letter e with
diaeresis
- 'ì' => 'ì', // latin small letter i with
grave
- 'í' => 'í', // latin small letter i with
acute
- 'î' => 'î', // latin small letter i with
circumflex
- 'ï' => 'ï', // latin small letter i with
diaeresis
- 'ð' => 'ð', // latin small letter
eth
- 'ñ' => 'ñ', // latin small letter n with
tilde
- 'ò' => 'ò', // latin small letter o with
grave
- 'ó' => 'ó', // latin small letter o with
acute
- 'ô' => 'ô', // latin small letter o with
circumflex
- 'õ' => 'õ', // latin small letter o with
tilde
- 'ö' => 'ö', // latin small letter o with
diaeresis
- '÷' => '÷', // division sign
- 'ø' => 'ø', // latin small letter o with
stroke
- 'ù' => 'ù', // latin small letter u with
grave
- 'ú' => 'ú', // latin small letter u with
acute
- 'û' => 'û', // latin small letter u with
circumflex
- 'ü' => 'ü', // latin small letter u with
diaeresis
- 'ý' => 'ý', // latin small letter y with
acute
- 'þ' => 'þ', // latin small letter thorn
- 'ÿ' => 'ÿ', //
- 'Œ' => 'Œ', // latin capital ligature OE
- 'œ' => 'œ', // latin small ligature oe
- 'Š' => 'Š', // latin capital letter S with
caron
- 'š' => 'š', // latin small letter s with
caron
- 'Ÿ' => 'Ÿ', // latin capital letter Y with
diaeresis
- 'ƒ' => 'ƒ' , // latin small f with hook
- 'ˆ' => 'ˆ', // modifier letter circumflex
accent
- '˜' => '˜', // small tilde
- 'Α' => 'Α', // greek capital letter alpha
- 'Β' => 'Β', // greek capital letter beta
- 'Γ' => 'Γ', // greek capital letter gamma
- 'Δ' => 'Δ', // greek capital letter delta
- 'Ε' => 'Ε', // greek capital letter epsilon
- 'Ζ' => 'Ζ', // greek capital letter zeta
- 'Η' => 'Η', // greek capital letter
eta
- 'Θ' => 'Θ', // greek capital letter theta
- 'Ι' => 'Ι', // greek capital letter iota
- 'Κ' => 'Κ', // greek capital letter kappa
- 'Λ' => 'Λ', // greek capital letter lambda
- 'Μ' => 'Μ', // greek capital letter
mu
- 'Ν' => 'Ν', // greek capital letter
nu
- 'Ξ' => 'Ξ', // greek capital letter
xi
- 'Ο' => 'Ο', // greek capital letter omicron
- 'Π' => 'Π', // greek capital letter
pi
- 'Ρ' => 'Ρ', // greek capital letter
rho
- 'Σ' => 'Σ', // greek capital letter sigma
- 'Τ' => 'Τ', // greek capital letter
tau
- 'Υ' => 'Υ', // greek capital letter upsilon
- 'Φ' => 'Φ', // greek capital letter
phi
- 'Χ' => 'Χ', // greek capital letter
chi
- 'Ψ' => 'Ψ', // greek capital letter
psi
- 'Ω' => 'Ω', // greek capital letter omega
- 'α' => 'α', // greek small letter alpha
- 'β' => 'β', // greek small letter beta
- 'γ' => 'γ', // greek small letter gamma
- 'δ' => 'δ', // greek small letter delta
- 'ε' => 'ε', // greek small letter epsilon
- 'ζ' => 'ζ', // greek small letter zeta
- 'η' => 'η', // greek small letter
eta
- 'θ' => 'θ', // greek small letter theta
- 'ι' => 'ι', // greek small letter iota
- 'κ' => 'κ', // greek small letter kappa
- 'λ' => 'λ', // greek small letter lambda
- 'μ' => 'μ', // greek small letter mu
- 'ν' => 'ν', // greek small letter nu
- 'ξ' => 'ξ', // greek small letter xi
- 'ο' => 'ο', // greek small letter omicron
- 'π' => 'π', // greek small letter pi
- 'ρ' => 'ρ', // greek small letter
rho
- 'ς' => 'ς', // greek small letter final
sigma
- 'σ' => 'σ', // greek small letter sigma
- 'τ' => 'τ', // greek small letter
tau
- 'υ' => 'υ', // greek small letter upsilon
- 'φ' => 'φ', // greek small letter
phi
- 'χ' => 'χ', // greek small letter
chi
- 'ψ' => 'ψ', // greek small letter
psi
- 'ω' => 'ω', // greek small letter omega
- 'ϑ' => 'ϑ', // greek small letter
theta symbol
- 'ϒ' => 'ϒ', // greek upsilon with hook
symbol
- 'ϖ' => 'ϖ', // greek pi symbol
- ' ' => ' ', // en space
- ' ' => ' ', // em space
- ' ' => ' ', // thin space
- '‌' => '‌', // zero width non-joiner
- '‍' => '‍', // zero width joiner
- '‎' => '‎', // left-to-right mark
- '‏' => '‏', // right-to-left mark
- '–' => '–', // en dash
- '—' => '—', // em dash
- '‘' => '‘', // left single quotation mark
- '’' => '’', // right single quotation mark
- '‚' => '‚', // single low-9 quotation mark
- '“' => '“', // left double quotation mark
- '”' => '”', // right double quotation mark
- '„' => '„', // double low-9 quotation mark
- '†' => '†', // dagger
- '‡' => '‡', // double dagger
- '•' => '•', // bullet
- '…' => '…', // horizontal ellipsis
- '‰' => '‰', // per mille sign
- '′' => '′', // primeminutes
- '″' => '″', // double prime
- '‹' => '‹', // single left-pointing angle
quotation mark
- '›' => '›', // single right-pointing angle
quotation mark
- '‾' => '‾', // overline
- '⁄' => '⁄', // fraction slash
- '€' => '€', // euro sign
- 'ℑ' => 'ℑ', // blackletter capital I
- '℘' => '℘', // script capital P
- 'ℜ' => 'ℜ', // blackletter capital R
- '™' => '™', // trade mark sign
- 'ℵ' => 'ℵ', // alef symbol
- '←' => '←', // leftwards arrow
- '↑' => '↑', // upwards arrow
- '→' => '→', // rightwards arrow
- '↓' => '↓', // downwards arrow
- '↔' => '↔', // left right arrow
- '↵' => '↵', // downwards arrow with corner
leftwards
- '⇐' => '⇐', // leftwards double arrow
- '⇑' => '⇑', // upwards double arrow
- '⇒' => '⇒', // rightwards double arrow
- '⇓' => '⇓', // downwards double arrow
- '⇔' => '⇔', // left right double arrow
- '∀' => '∀', // for all
- '∂' => '∂', // partial differential
- '∃' => '∃', // there exists
- '∅' => '∅', // empty set
- '∇' => '∇', // nabla
- '∈' => '∈', // element of
- '∉' => '∉', // not an element of
- '∋' => '∋', // contains as member
- '∏' => '∏', // n-ary product
- '∑' => '∑', // n-ary sumation
- '−' => '−', // minus sign
- '∗' => '∗', // asterisk operator
- '√' => '√', // square root
- '∝' => '∝', // proportional to
- '∞' => '∞', // infinity
- '∠' => '∠', // angle
- '∧' => '∧', // logical and
- '∨' => '∨', // logical or
- '∩' => '∩', // intersection
- '∪' => '∪', // union
- '∫' => '∫', // integral
- '∴' => '∴', // therefore
- '∼' => '∼', // tilde operator
- '≅' => '≅', // approximately equal to
- '≈' => '≈', // almost equal to
- '≠' => '≠', // not equal to
- '≡' => '≡', // identical to
- '≤' => '≤', // less-than or equal to
- '≥' => '≥', // greater-than or
equal to
- '⊂' => '⊂', // subset of
- '⊃' => '⊃', // superset of
- '⊄' => '⊄', // not a subset of
- '⊆' => '⊆', // subset of or equal to
- '⊇' => '⊇', // superset of or equal to
- '⊕' => '⊕', // circled plus
- '⊗' => '⊗', // circled times
- '⊥' => '⊥', // up tack
- '⋅' => '⋅', // dot operator
- '⌈' => '⌈', // left ceiling
- '⌉' => '⌉', // right ceiling
- '⌊' => '⌊', // left floor
- '⌋' => '⌋', // right floor
- '〈' => '⟨', // left-pointing angle bracket
- '〉' => '⟩', // right-pointing angle bracket
- '◊' => '◊', // lozenge
- '♠' => '♠', // black spade suit
- '♣' => '♣', // black club suit
- '♥' => '♥', // black heart suit
- '♦' => '♦' // black diam suit
- );
-
- // split entities for use in str_replace()
- foreach($codes as $unicode_entity => $html_entity) {
- $unicode_entities[] = $unicode_entity;
- $html_entities[] = $html_entity;
- }
- }
- // transcode HTML entities to Unicode
- if($to_unicode)
- return str_replace($html_entities, $unicode_entities, $input);
-
- // transcode Unicode entities to HTML entities
- else
- return str_replace($unicode_entities, $html_entities, $input);
-}
-
-/**
- * transcode multi-byte characters to HTML representations for Unicode
- *
- * This function is aiming to preserve Unicode characters through storage in a
ISO-8859-1 compliant system.
- *
- * Every multi-byte UTF-8 character is transformed to its equivalent HTML
numerical entity (eg, &#4568;)
- * that may be handled safely by PHP and by MySQL.
- *
- * Of course, this solution does not allow for full-text search in the
database and therefore, is not a
- * definitive solution to internationalization issues.
- * It does enable, however, practical use of Unicode to build pages in foreign
languages.
- *
- * Also, this function transforms HTML entities into their equivalent Unicode
entities.
- * For example, w.bloggar posts pages using HTML entities.
- * If you have to modify these pages using web forms, you would like to get
UTF-8 instead.
- *
- * @link
http://www.evolt.org/article/A_Simple_Character_Entity_Chart/17/21234/ A Simple
Character Entity Chart
- *
- * @param string the original UTF-8 string
- * @return a string acceptable in an ISO-8859-1 storage system (ie., PHP4 +
MySQl 3)
- */
-function to_unicode($input) {
- // transcode HTML entities to Unicode entities
- $input = transcode($input);
- // scan the whole string
- $output = '';
- $index = 0;
- while($index < strlen($input)) {
- // look at one char
- $char = ord($input[$index]);
- // one byte (0xxxxxxx)
- if ($char < 0x80) {
- // some chars may be undefined
- $output .= chr($char);
- $index += 1;
- // two bytes (110xxxxx 10xxxxxx)
- } else if ($char < 0xE0) {
- // strip weird sequences (eg, C0 80 -> NUL)
- if($value = (($char % 0x20) * 0x40) + (ord($input[$index + 1]) % 0x40))
- $output .= '&#' . $value . ';';
- $index += 2;
- // three bytes (1110xxxx 10xxxxxx 10xxxxxx) example: euro sign =
\xE2\x82\xAC -> €
- } else if ($char < 0xF0) {
- // strip weird sequences
- if($value = (($char % 0x10) * 0x1000) + ((ord($input[$index + 1]) %
0x40) * 0x40) + (ord($input[$index + 2]) % 0x40))
- $output .= '&#' . $value . ';';
- $index += 3;
- // four bytes (11110xxx 10xxxxxx 10xxxxxx 10xxxxxx)
- } else if($char < 0xF8) {
- // strip weird sequences
- if ($value = (($char % 0x08) * 0x40000) + ((ord($input[$index + 1]) %
0x40) * 0x1000) + ((ord($input[$index + 2]) % 0x40) * 0x40)
- + (ord($input[$index + 3]) % 0x40))
- $output .= '&#' . $value . ';';
- $index += 4;
- // five bytes (111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx)
- } else if($char < 0xFC) {
- // strip weird sequences
- if ($value = (($char % 0x04) * 0x1000000) + ((ord($input[$index + 1]) %
0x40) * 0x40000) + ((ord($input[$index + 2]) % 0x40) * 0x1000)
- + ((ord($input[$index + 3]) % 0x40) * 0x40) + (ord($input[$index + 4])
% 0x40))
- $output .= '&#' . $value . ';';
- $index += 5;
- // six bytes (1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx)
- } else {
- // strip weird sequences
- if ($value = (($char % 0x02) * 0x40000000) + ((ord($input[$index + 1]) %
0x40) * 0x1000000) + ((ord($input[$index + 2]) % 0x40) * 0x40000)
- + ((ord($input[$index + 3]) % 0x40) * 0x1000) + ((ord($input[$index +
4]) % 0x40) * 0x40) + (ord($input[$index + 4]) % 0x40))
- $output .= '&#' . $value . ';';
- $index += 6;
- }
- }
- // return the translated string
- return $output;
-}
-
-// returns either the translated string or the original string.
-// Assumes we are passed the original string as occurs in text; result
-// will be html tokenized by htmlentities() using UTF8.
-// $i18nHTMLhasTranslation is set to nonzero value if a translation is
-// available or failure connecting to database, otherwise it is set to
-// 0.
-function translation_query($a) {
- global $connection;
- global $lang;
- global $i18nHTMLrecordMode;
- global $i18nHTMLhasTranslation;
-
- $i18nHTMLhasTranslation = 1; // assume translation until failure
-
- if ($a == "")
- return $a;
- $a = fix($a);
- $a_sql = mysql_real_escape_string($a);
- if (!$connection) {
- // database not available, just print English
- return $a;
- }
-
- /* // uncomment to selectively clone DB
- $fp = fopen("/tmp/clone.sql", "a+", 0);
- $query = "SELECT * FROM map WHERE name=\"$a_sql\" ORDER BY ranking DESC";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_num_rows($result);
- $last = "English";
- for ($i=0;$i<$num;$i++) {
- $row = mysql_fetch_array($result);
- if ($last != mysql_real_escape_string($row["lang"])) {
- $last = mysql_real_escape_string($row["lang"]);
- $trans = mysql_real_escape_string($row["translation"]);
- $rank = $row["ranking"];
- $ip = $row["ip"];
- fputs($fp, "INSERT INTO map VALUES(\"$a_sql\", \"$last\", \"$trans\",
$rank, \"$ip\");\n");
- }
- }
- */
-
- if ("English" == $lang) {
- // no need to translate english, that's the
- // hard-wired source language!
- if ($i18nHTMLrecordMode == 2) {
- // if not already in pending table (and recordMode set to allow us)
- // then insert this string into it
- $query = "SELECT count FROM pending WHERE c=\"$a_sql\" AND
lang=\"$lang\"";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_num_rows($result);
- if (0 == $num) {
- $query = "INSERT INTO pending VALUES(\"$a_sql\", \"$lang\", 0)";
- mysql_query($query, $connection);
- }
- }
- return $a;
- }
- // attempt to get translations, ranked for best
- $query = "SELECT translation FROM map WHERE name=\"$a_sql\" AND
lang=\"$lang\" ORDER BY ranking DESC";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_num_rows($result);
- if (0 == $num) { // didn't find a translation
- if ($i18nHTMLrecordMode > 0) {
- // either insert untranslated item into pending table or update
- // referenced count; count is used to display more used strings
- // during mass translation before less common ones.
- $query = "SELECT count FROM pending WHERE c=\"$a_sql\" AND
lang=\"$lang\"";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_numrows($result);
- $count = 0;
- if ($num > 0) {
- $row = mysql_fetch_array($result);
- $count = $row["count"] + 1;
- $query = "UPDATE pending SET count=$count WHERE c=\"$a_sql\" AND
lang=\"$lang\"";
- } else {
- $query = "INSERT INTO pending VALUES(\"$a_sql\", \"$lang\", 1)";
- }
- mysql_query($query, $connection);
-
- }
- $i18nHTMLhasTranslation = 0; // no translation was found
- return $a; // just return English string
- } else { // translation available
-
- $row = mysql_fetch_array($result);
- return $row["translation"];
- }
-}
-
-// *************************************************
-// Fundamental i18nHTML API functions
-// *************************************************
-
-// translate the sentence $a and return the result.
-function TRANSLATE_($a,$args=null) {
- if ($a == "")
- return 0;
- return vsprintf(translation_query($a), $args);
-}
-
-// translate the sentence $a and output just
-// the translated text (without link to translate.php)
-function TRANSLATE($a,$args=null) {
- echo TRANSLATE_($a);
-}
-
-// translate the sentence $a adding a link
-// to enable editing translations and return the result.
-function W_($a,$args=null) {
- if ($a == "")
- return 0;
- return TRANSLATE_($a,$args) . translateLink_($a);
-}
-
-// translate the sentence $a appending a link
-// to enable edit the translation and output the
-// result.
-function W($a, $args=NULL) {
- if ($a != "")
- echo W_($a, $args) . "\n";
-}
-
-// create internationalized, internal link to
-// $a.php with description $b
-function intlink_($a, $b) {
- global $lang;
-
- $ret = "<a href=\"" . $a . "?xlang=" . $lang . "\">" . TRANSLATE_($b) .
"</a>";
- $ret = $ret . translateLink_($b);
- return $ret;
-}
-
-// create internationalized, internal link to
-// $a.php with description $b
-function intlink($a, $b) {
- echo intlink_($a, $b);
-}
-
-// create internationalized, external link to
-// $a with description $b
-function extlink_($a, $b) {
- $ret = "<a href=\"" . $a . "\">" . TRANSLATE_($b) . "</a>" .
translateLink_($b);
- return $ret;
-}
-
-// create internationalized, external link to
-// $a with description $b
-function extlink($a, $b) {
- echo extlink_($a, $b);
-}
-
-
-// *************************************************
-// global, call-once helper functions
-// *************************************************
-
-// outputs appropriate DOCTYPE declaration for the document
-// this should be the 1st line in your php file after including
-// i18nhtml.inc. Valid types are: HTML for HTML 4 documents,
-// XHTML1 for xhtml 1.0 documents, and XHTML1.1 for xhtml 1.1
-// defaulting to HTML4 if $type is blank or unknown. An optional
-// $mode may be specified, it must be one of "Transitional",
-// "Strict", or "Frameset", defaulting to "Transitional".
-// Note for XHTML1.1 $mode is ignored.
-// example:
-// include("i18nhtml.inc");
-// DOCTYPE("XHTML1");
-function DOCTYPE($type=null, $mode=null) {
- // depending on $mode, use appropriate dtd
- if ($mode == "Strict") {
- $dtd = "strict";
- if ($type != "XHTML1") // Strict not specified except for XHTML1.0
- $mode = "";
- } else if ($mode == "Frameset") {
- $dtd = "frameset";
- } else { // $mode == Transitional, default, or unknown
- $dtd = "loose";
- $mode = "Transitional";
- }
- if ($type == "XHTML1")
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 " . $mode . "//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" . $dtd . ".dtd\">\n";
- else if ($type == "XHTML1.1")
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
- else
- echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " . $mode . "//EN\"
\"http://www.w3.org/TR/html4/" . $dtd . ".dtd\">\n";
-}
-
-function TITLE($a,$b="") {
- global $lang;
- global $languagecodes;
- echo "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"
>";
- echo "<title>" . TRANSLATE_($a,$b) . "</title>\n";
- if (isset($languagecodes[$lang])) {
- echo "<meta name=\"content-language\" content=\"" .
- $languagecodes[$lang] . "\">";
- echo "<meta name=\"language\" content=\"" .
- $languagecodes[$lang] . "\">";
- }
-}
-
-// displays a list of all languages currently available with
-// at least 1 translated string.
-function generateLanguageBar() {
- global $connection;
-
- if ($connection) {
- echo "<center>[";
- $query = "SELECT DISTINCT lang FROM map ORDER BY lang";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_numrows($result);
- echo "<a href=\"?xlang=English\">";
- W("English");
- echo "</a>";
- $last = "English";
- for ($i=0;$i<$num;$i++) {
- $row = mysql_fetch_array($result);
- $next = $row["lang"];
- if ($next == $last)
- continue;
- echo " | ";
- echo "<a href=\"?xlang=$next\">" . W_($next) . "</a>";
- $last = $next;
- }
- echo "]</center>";
- }
-}
-
-
-// displays text at the bottom of the page to indicate
-// translation mode (including link to active) and
-// copyright notice for i18nHTML.
-function generateFooter() {
- global $xlang;
- global $editor;
- global $HTTP_SERVER_VARS;
-
- P();
- echo "Translation engine based on <a
href=\"http://gnunet.org/i18nHTML/\">i18nHTML</a> (C) 2003, 2004, 2005
Christian Grothoff.<br />\n";
- if ( ($xlang) && ($xlang != "English") ) {
- $back = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] .
$HTTP_SERVER_VARS["REQUEST_URI"];
- echo "<center><small>\n";
- if ($editor != 1)
- echo " <a href=\"$back&editor=1\">" . W_("enter translation mode") .
"</a>";
- else
- W(" Translation Mode Active (for this page only)");
- echo "</small></center>\n";
- }
- echo "</p>\n";
-}
-
-// *************************************************
-// HTML construct helper functions
-// *************************************************
-
-function LI($a,$b="") {
- echo "<li>" . W_($a,$b) . "</li>\n";
-}
-function TH($a,$b="") {
- echo "<th>" . W_($a,$b) . "</th>\n";
-}
-function TD($a,$b="") {
- echo "<td>" . W_($a,$b) . "</td>\n";
-}
-function DT($a,$b="") {
- echo "<dt>" . W_($a,$b) . "</dt>\n";
-}
-function DD($a,$b="") {
- echo "<dd>" . W_($a,$b) . "</dd>\n";
-}
-function H1($a,$b="") {
- echo "<h1>" . W_($a,$b) . "</h1>\n";
-}
-function H2($a,$b="") {
- echo "<h2>" . W_($a,$b) . "</h2>\n";
-}
-function H3($a,$b="") {
- echo "<h3>" . W_($a,$b) . "</h3>\n";
-}
-function H4($a,$b="") {
- echo "<h4>" . W_($a,$b) . "</h4>\n";
-}
-function H5($a,$b="") {
- echo "<h5>" . W_($a,$b) . "</h5>\n";
-}
-function PRE($a) {
- echo "<pre>" . $a . "</pre>";
-}
-// 'verbatim' (untranslated) "li"
-function LIV($a) {
- echo "<li>" . $a . "</li>\n";
-}
-function P($attr="") {
- echo "<p $attr>\n";
-}
-function BR() {
- echo "<br />\n";
-}
-function HR() {
- echo "<hr>\n";
-}
-function DTDD($a,$b) {
- DT($a);
- DD($b);
-}
-function LILI($a,$b) {
- echo "<li>" . extlink_($a,$b) . "</li>\n";
-}
-function ANCHOR($a) {
- echo "<a name=\"$a\"></a>\n";
-}
-function IMG_($src, $alt, $align="CENTER", $width, $height, $border=0,
$hspace=0, $vspace=0) {
- $ret = "";
-
- if ($align == "CENTER")
- $ret = $ret . "<p><center>\n";
- $ret = $ret . "<img src=\"" . $src . "\" alt=\"";
- $ret = $ret . TRANSLATE_($alt);
- $ret = $ret . "\" align=\"" . $align . "\" width=$width height=$height
border=$border hspace=$hspace vspace=$vspace>\n";
- $ret = $ret . translateLink_($alt);
- if ($align == "CENTER")
- $ret = $ret . "</center><p>\n";
- return $ret;
-}
-function IMG($src, $alt, $align="CENTER", $width, $height, $border=0,
$hspace=0, $vspace=0) {
- echo IMG_($src, $alt, $align, $width, $height, $border, $hspace, $vspace);
-}
-
-?>
\ No newline at end of file
Added: Extractor-docs/WWW/i18nhtml.inc.php
===================================================================
--- Extractor-docs/WWW/i18nhtml.inc.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/i18nhtml.inc.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,885 @@
+<?php
+/*
+ (C) 2003, 2004, 2005 Christian Grothoff and other contributing authors.
+
+ This code is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ The code is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with the code; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+ // This file defines the functions that will be used
+ // to build the webpage. The set may not contain everything
+ // you might want, so feel free to define your own extensions.
+
+ // Use W("text") to output translations.
+ // $lang/xlang are used to specify the language
+ // $editor can be set to create a translation
+ // tag even if a translation is already available.
+ // there is currently no security.
+ //
+ // An "_" is used for functions that return the
+ // translated string instead of printing it directly.
+ // These functions are used for "%s" printing with W().
+ //
+ // Most of the code should be straight forward. Look
+ // at some of the example files that use it and compare with
+ // the generated pages.
+// obtain user db specific configuration parameters
+include("i18nhtml_config.inc.php");
+header("Content-type: text/html; charset=utf-8");
+
+// if (get_magic_quotes_gpc())
+// die('PHP misconfigured. Disable get_magic_quotes.');
+
+// establish default connection to database server
+$connection = @mysql_connect($i18nHTMLsqlServer,
+ $i18nHTMLsqlUser,
+ $i18nHTMLsqlPass);
+if (!$connection) {
+ die ('Failure connecting to ' . $i18nHTMLsqlServer . ' : ' . mysql_error());
+}
+
+// and select database on server that holds translations
+if ($connection) {
+ $db_selected = mysql_select_db($i18nHTMLsqlDB,
+ $connection);
+ if (!$db_selected) {
+ die ('Error selecting db : ' . mysql_error());
+ }
+}
+
+// ensure the mapping and pending tables exist, creating them if not
+$query="CREATE TABLE IF NOT EXISTS ".$i18nHTMLsqlPrefix."map" .
+ " (name BLOB, lang TINYBLOB, translation BLOB, ranking INT, ip
TINYTEXT, " .
+ "INDEX(name(10)), INDEX(lang(4)), INDEX(ranking),
INDEX(translation(10)))";
+$result = mysql_query($query, $connection);
+if (($i18nHTMLdebug == 1) && (!$result)) {
+ die('Unable to validate map table. Invalid query: ' . mysql_error());
+}
+
+$query="CREATE TABLE IF NOT EXISTS ".$i18nHTMLsqlPrefix."pending" .
+ " (c BLOB, lang TINYBLOB, count INT, " .
+ "INDEX(c(10)), INDEX(lang(4)), INDEX(count))";
+$result = mysql_query($query, $connection);
+if (($i18nHTMLdebug == 1) && (!$result)) {
+ die('Unable to validate pending table. Invalid query: ' . mysql_error());
+}
+
+/* mapping of real-names to language codes */
+$languagecodes = array("English"=>"en",
+ "German"=>"de",
+ "French"=>"fr",
+ "Portuguese"=>"pt",
+ "Russian"=>"ru",
+ "Romanian"=>"ro",
+ "Spanish"=>"es",
+ "Italian"=>"it",
+ "Simplified chinese"=>"zh_CN",
+ "Catalan"=>"ca",
+ "Basque"=>"eu",
+ "Arabic"=>"ar",
+ "Bulgarian"=>"bg",
+ "Czech"=>"cs",
+ "Dutch"=>"nl",
+ "Esperanto"=>"eo",
+ "Hebrew"=>"he",
+ "Japanese"=>"ja",
+ "Norwegian"=>"no",
+ "Polish"=>"po",
+ "Ukrainian"=>"uk",
+ "Danish"=>"da",
+ "Swedish"=>"sv");
+
+/* try to automagically figure out user preferences */
+$hlang = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
+if ($hlang) {
+ $tok = strtok($hlang, ";");
+ while ($tok) {
+ foreach($languagecodes as $name=>$code) {
+ if (0 == strncmp($tok, $code, 2)) {
+ $lang = $name;
+ break 2;
+ }
+ }
+ $tok = strtok(";");
+ }
+}
+// If no language is specified, use english.
+if ( (! $lang) || ($lang=="") )
+ $lang = "English";
+$xlang = $_REQUEST['xlang'];
+if ($xlang)
+ $lang = $xlang;
+$lang = ucfirst(strtolower($lang));
+$lang = quote_smart($lang);
+$editor = $_REQUEST['editor'];
+$i18nHTMLhasTranslation = 0; // set by last call to translation_query()
+
+/**
+ * Replace certain HTML named special characters with their
+ * numeric codes (some browsers don't work with the symbolic names).
+ */
+$htmlin = array("’", ">", """, "′", "&", "\"",
"'", "`", "‘");
+$htmlout = array("’", ">", """ , "′", "&", """,
"′", "’", "‘");
+function fix($a) {
+ global $htmlin;
+ global $htmlout;
+ return str_replace($htmlin, $htmlout, $a);
+}
+
+// Quote variable to make safe from
+// http://fr.php.net/manual/en/function.mysql-real-escape-string.php
+function quote_smart($value)
+{
+ // Stripslashes
+ if (get_magic_quotes_gpc()) {
+ $value = stripslashes($value);
+ }
+ $value = mysql_real_escape_string($value);
+ return $value;
+}
+
+// *************************************************
+// i18nHTML configuration API functions
+// *************************************************
+
+// change the marker text shown to indicate text
+// is translatable (link to translate page text)
+function setTranslateLinkMarker($marker) {
+ global $i18nHTMLmarker;
+
+ if ($marker == "")
+ $i18nHTMLmarker = "*"; // reset to default value
+ else
+ $i18nHTMLmarker = $marker;
+}
+
+// ***************************************************
+// i18nHTML _internal_ API functions (don't look here)
+// ***************************************************
+
+// returns a HTML string to link to enable one to translate the given
+// text ($a) when $editor has a nonzero value or
+// $i18nHTMLhasTranslation is 0; otherwise and empty string ("") is
+// returned.
+function translateLink_($a) {
+ global $lang;
+ global $HTTP_SERVER_VARS;
+ global $editor;
+ global $i18nHTMLhasTranslation;
+ global $i18nHTMLmarker;
+ global $i18nHTMLbase;
+
+ if ($hasTranslation == "")
+ $hasTranslation = $i18nHTMLhasTranslation;
+ if ( ($editor) || ($i18nHTMLhasTranslation == 0) ) {
+ $back = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] .
$HTTP_SERVER_VARS["REQUEST_URI"];
+ return "<a href=\"" . $i18nHTMLbase . "translate.php?xlang="
+ . $lang
+ . "&text=" . urlencode(fix($a))
+ . "&back=" . urlencode($back)
+ . "\" title=\""
+ .fix($a)
+ ."\">" . $i18nHTMLmarker . "</a>\n";
+ } else
+ return "";
+}
+
+// displays a link to the page to enable one to
+// translate the given text ($a)
+// see translateLink_
+function translateLink($a) {
+ echo translateLink_($a);
+}
+
+/**
+ * transcode unicode entities to/from HTML entities
+ *
+ * Also, this function transforms HTML entities into their equivalent Unicode
entities.
+ * For example, w.bloggar posts pages using HTML entities.
+ * If you have to modify these pages using web forms, you would like to get
UTF-8 instead.
+ *
+ * @link
http://www.evolt.org/article/A_Simple_Character_Entity_Chart/17/21234/ A Simple
Character Entity Chart
+ *
+ * @param string the string to be transcoded
+ * @param boolean TRUE to transcode to Unicode, FALSE to transcode to HTML
+ * @return a transcoded string
+ */
+function transcode($input, $to_unicode=TRUE) {
+ // initialize tables only once
+ static $html_entities, $unicode_entities;
+ if(!is_array($html_entities)) {
+
+
+ // numerical order
+ $codes = array(
+ ' ' => ' ', // non-breaking space
+ '¡' => '¡', // inverted exclamation mark
+ '¢' => '¢', // cent sign
+ '£' => '£', // pound sign
+ '¤' => '¤', // currency sign
+ '¥' => '¥', // yen sign
+ '¦' => '¦', // broken bar
+ '§' => '§', // section sign
+ '¨' => '¨', // diaeresis
+ '©' => '©', // copyright sign
+ 'ª' => 'ª', // feminine ordinal indicator
+ '«' => '«', // left-pointing double angle
quotation mark
+ '¬' => '¬', // not sign
+ '­' => '­', // soft hyphen
+ '®' => '®', // registered sign
+ '¯' => '¯', // macron
+ '°' => '°', // degree sign
+ '±' => '±', // plus-minus sign
+ '²' => '²', // superscript two
+ '³' => '³', // superscript three
+ '´' => '´', // acute accent
+ 'µ' => 'µ', // micro sign
+ '¶' => '¶', // pilcrow sign
+ '·' => '·', // middle dot
+ '¸' => '¸', // cedilla
+ '¹' => '¹', // superscript one
+ 'º' => 'º', // masculine ordinal indicator
+ '»' => '»', // right-pointing double angle
quotation mark
+ '¼' => '¼', // vulgar fraction one quarter
+ '½' => '½', // vulgar fraction one half
+ '¾' => '¾', // vulgar fraction three
quarters
+ '¿' => '¿', // inverted question mark
+ 'À' => 'À', // latin capital letter A with
grave
+ 'Á' => 'Á', // latin capital letter A with
acute
+ 'Â' => 'Â', // latin capital letter A with
circumflex
+ 'Ã' => 'Ã', // latin capital letter A with
tilde
+ 'Ä' => 'Ä', // latin capital letter A with
diaeresis
+ 'Å' => 'Å', // latin capital letter A with
ring above
+ 'Æ' => 'Æ', // latin capital letter AE
+ 'Ç' => 'Ç', // latin capital letter C with
cedilla
+ 'È' => 'È', // latin capital letter E with
grave
+ 'É' => 'É', // latin capital letter E with
acute
+ 'Ê' => 'Ê', // latin capital letter E with
circumflex
+ 'Ë' => 'Ë', // latin capital letter E with
diaeresis
+ 'Ì' => 'Ì', // latin capital letter I with
grave
+ 'Í' => 'Í', // latin capital letter I with
acute
+ 'Î' => 'Î', // latin capital letter I with
circumflex
+ 'Ï' => 'Ï', // latin capital letter I with
diaeresis
+ 'Ð' => 'Ð', // latin capital letter
ETH
+ 'Ñ' => 'Ñ', // latin capital letter N with
tilde
+ 'Ò' => 'Ò', // latin capital letter O with
grave
+ 'Ó' => 'Ó', // latin capital letter O with
acute
+ 'Ô' => 'Ô', // latin capital letter O with
circumflex
+ 'Õ' => 'Õ', // latin capital letter O with
tilde
+ 'Ö' => 'Ö', // latin capital letter O with
diaeresis
+ '×' => '×', // multiplication sign
+ 'Ø' => 'Ø', // latin capital letter O with
stroke
+ 'Ù' => 'Ù', // latin capital letter U with
grave
+ 'Ú' => 'Ú', // latin capital letter U with
acute
+ 'Û' => 'Û', // latin capital letter U with
circumflex
+ 'Ü' => 'Ü', // latin capital letter U with
diaeresis
+ 'Ý' => 'Ý', // latin capital letter Y with
acute
+ 'Þ' => 'Þ', // latin capital letter THORN
+ 'ß' => 'ß', // latin small letter sharp s
+ 'à' => 'à', // latin small letter a with
grave
+ 'á' => 'á', // latin small letter a with
acute
+ 'â' => 'â', // latin small letter a with
circumflex
+ 'ã' => 'ã', // latin small letter a with
tilde
+ 'ä' => 'ä', // latin small letter a with
diaeresis
+ 'å' => 'å', // latin small letter a with
ring above
+ 'æ' => 'æ', // latin small letter ae
+ 'ç' => 'ç', // latin small letter c with
cedilla
+ 'è' => 'è', // latin small letter e with
grave
+ 'é' => 'é', // latin small letter e with
acute
+ 'ê' => 'ê', // latin small letter e with
circumflex
+ 'ë' => 'ë', // latin small letter e with
diaeresis
+ 'ì' => 'ì', // latin small letter i with
grave
+ 'í' => 'í', // latin small letter i with
acute
+ 'î' => 'î', // latin small letter i with
circumflex
+ 'ï' => 'ï', // latin small letter i with
diaeresis
+ 'ð' => 'ð', // latin small letter
eth
+ 'ñ' => 'ñ', // latin small letter n with
tilde
+ 'ò' => 'ò', // latin small letter o with
grave
+ 'ó' => 'ó', // latin small letter o with
acute
+ 'ô' => 'ô', // latin small letter o with
circumflex
+ 'õ' => 'õ', // latin small letter o with
tilde
+ 'ö' => 'ö', // latin small letter o with
diaeresis
+ '÷' => '÷', // division sign
+ 'ø' => 'ø', // latin small letter o with
stroke
+ 'ù' => 'ù', // latin small letter u with
grave
+ 'ú' => 'ú', // latin small letter u with
acute
+ 'û' => 'û', // latin small letter u with
circumflex
+ 'ü' => 'ü', // latin small letter u with
diaeresis
+ 'ý' => 'ý', // latin small letter y with
acute
+ 'þ' => 'þ', // latin small letter thorn
+ 'ÿ' => 'ÿ', //
+ 'Œ' => 'Œ', // latin capital ligature OE
+ 'œ' => 'œ', // latin small ligature oe
+ 'Š' => 'Š', // latin capital letter S with
caron
+ 'š' => 'š', // latin small letter s with
caron
+ 'Ÿ' => 'Ÿ', // latin capital letter Y with
diaeresis
+ 'ƒ' => 'ƒ' , // latin small f with hook
+ 'ˆ' => 'ˆ', // modifier letter circumflex
accent
+ '˜' => '˜', // small tilde
+ 'Α' => 'Α', // greek capital letter alpha
+ 'Β' => 'Β', // greek capital letter beta
+ 'Γ' => 'Γ', // greek capital letter gamma
+ 'Δ' => 'Δ', // greek capital letter delta
+ 'Ε' => 'Ε', // greek capital letter epsilon
+ 'Ζ' => 'Ζ', // greek capital letter zeta
+ 'Η' => 'Η', // greek capital letter
eta
+ 'Θ' => 'Θ', // greek capital letter theta
+ 'Ι' => 'Ι', // greek capital letter iota
+ 'Κ' => 'Κ', // greek capital letter kappa
+ 'Λ' => 'Λ', // greek capital letter lambda
+ 'Μ' => 'Μ', // greek capital letter
mu
+ 'Ν' => 'Ν', // greek capital letter
nu
+ 'Ξ' => 'Ξ', // greek capital letter
xi
+ 'Ο' => 'Ο', // greek capital letter omicron
+ 'Π' => 'Π', // greek capital letter
pi
+ 'Ρ' => 'Ρ', // greek capital letter
rho
+ 'Σ' => 'Σ', // greek capital letter sigma
+ 'Τ' => 'Τ', // greek capital letter
tau
+ 'Υ' => 'Υ', // greek capital letter upsilon
+ 'Φ' => 'Φ', // greek capital letter
phi
+ 'Χ' => 'Χ', // greek capital letter
chi
+ 'Ψ' => 'Ψ', // greek capital letter
psi
+ 'Ω' => 'Ω', // greek capital letter omega
+ 'α' => 'α', // greek small letter alpha
+ 'β' => 'β', // greek small letter beta
+ 'γ' => 'γ', // greek small letter gamma
+ 'δ' => 'δ', // greek small letter delta
+ 'ε' => 'ε', // greek small letter epsilon
+ 'ζ' => 'ζ', // greek small letter zeta
+ 'η' => 'η', // greek small letter
eta
+ 'θ' => 'θ', // greek small letter theta
+ 'ι' => 'ι', // greek small letter iota
+ 'κ' => 'κ', // greek small letter kappa
+ 'λ' => 'λ', // greek small letter lambda
+ 'μ' => 'μ', // greek small letter mu
+ 'ν' => 'ν', // greek small letter nu
+ 'ξ' => 'ξ', // greek small letter xi
+ 'ο' => 'ο', // greek small letter omicron
+ 'π' => 'π', // greek small letter pi
+ 'ρ' => 'ρ', // greek small letter
rho
+ 'ς' => 'ς', // greek small letter final
sigma
+ 'σ' => 'σ', // greek small letter sigma
+ 'τ' => 'τ', // greek small letter
tau
+ 'υ' => 'υ', // greek small letter upsilon
+ 'φ' => 'φ', // greek small letter
phi
+ 'χ' => 'χ', // greek small letter
chi
+ 'ψ' => 'ψ', // greek small letter
psi
+ 'ω' => 'ω', // greek small letter omega
+ 'ϑ' => 'ϑ', // greek small letter
theta symbol
+ 'ϒ' => 'ϒ', // greek upsilon with hook
symbol
+ 'ϖ' => 'ϖ', // greek pi symbol
+ ' ' => ' ', // en space
+ ' ' => ' ', // em space
+ ' ' => ' ', // thin space
+ '‌' => '‌', // zero width non-joiner
+ '‍' => '‍', // zero width joiner
+ '‎' => '‎', // left-to-right mark
+ '‏' => '‏', // right-to-left mark
+ '–' => '–', // en dash
+ '—' => '—', // em dash
+ '‘' => '‘', // left single quotation mark
+ '’' => '’', // right single quotation mark
+ '‚' => '‚', // single low-9 quotation mark
+ '“' => '“', // left double quotation mark
+ '”' => '”', // right double quotation mark
+ '„' => '„', // double low-9 quotation mark
+ '†' => '†', // dagger
+ '‡' => '‡', // double dagger
+ '•' => '•', // bullet
+ '…' => '…', // horizontal ellipsis
+ '‰' => '‰', // per mille sign
+ '′' => '′', // primeminutes
+ '″' => '″', // double prime
+ '‹' => '‹', // single left-pointing angle
quotation mark
+ '›' => '›', // single right-pointing angle
quotation mark
+ '‾' => '‾', // overline
+ '⁄' => '⁄', // fraction slash
+ '€' => '€', // euro sign
+ 'ℑ' => 'ℑ', // blackletter capital I
+ '℘' => '℘', // script capital P
+ 'ℜ' => 'ℜ', // blackletter capital R
+ '™' => '™', // trade mark sign
+ 'ℵ' => 'ℵ', // alef symbol
+ '←' => '←', // leftwards arrow
+ '↑' => '↑', // upwards arrow
+ '→' => '→', // rightwards arrow
+ '↓' => '↓', // downwards arrow
+ '↔' => '↔', // left right arrow
+ '↵' => '↵', // downwards arrow with corner
leftwards
+ '⇐' => '⇐', // leftwards double arrow
+ '⇑' => '⇑', // upwards double arrow
+ '⇒' => '⇒', // rightwards double arrow
+ '⇓' => '⇓', // downwards double arrow
+ '⇔' => '⇔', // left right double arrow
+ '∀' => '∀', // for all
+ '∂' => '∂', // partial differential
+ '∃' => '∃', // there exists
+ '∅' => '∅', // empty set
+ '∇' => '∇', // nabla
+ '∈' => '∈', // element of
+ '∉' => '∉', // not an element of
+ '∋' => '∋', // contains as member
+ '∏' => '∏', // n-ary product
+ '∑' => '∑', // n-ary sumation
+ '−' => '−', // minus sign
+ '∗' => '∗', // asterisk operator
+ '√' => '√', // square root
+ '∝' => '∝', // proportional to
+ '∞' => '∞', // infinity
+ '∠' => '∠', // angle
+ '∧' => '∧', // logical and
+ '∨' => '∨', // logical or
+ '∩' => '∩', // intersection
+ '∪' => '∪', // union
+ '∫' => '∫', // integral
+ '∴' => '∴', // therefore
+ '∼' => '∼', // tilde operator
+ '≅' => '≅', // approximately equal to
+ '≈' => '≈', // almost equal to
+ '≠' => '≠', // not equal to
+ '≡' => '≡', // identical to
+ '≤' => '≤', // less-than or equal to
+ '≥' => '≥', // greater-than or
equal to
+ '⊂' => '⊂', // subset of
+ '⊃' => '⊃', // superset of
+ '⊄' => '⊄', // not a subset of
+ '⊆' => '⊆', // subset of or equal to
+ '⊇' => '⊇', // superset of or equal to
+ '⊕' => '⊕', // circled plus
+ '⊗' => '⊗', // circled times
+ '⊥' => '⊥', // up tack
+ '⋅' => '⋅', // dot operator
+ '⌈' => '⌈', // left ceiling
+ '⌉' => '⌉', // right ceiling
+ '⌊' => '⌊', // left floor
+ '⌋' => '⌋', // right floor
+ '〈' => '⟨', // left-pointing angle bracket
+ '〉' => '⟩', // right-pointing angle bracket
+ '◊' => '◊', // lozenge
+ '♠' => '♠', // black spade suit
+ '♣' => '♣', // black club suit
+ '♥' => '♥', // black heart suit
+ '♦' => '♦' // black diam suit
+ );
+
+ // split entities for use in str_replace()
+ foreach($codes as $unicode_entity => $html_entity) {
+ $unicode_entities[] = $unicode_entity;
+ $html_entities[] = $html_entity;
+ }
+ }
+ // transcode HTML entities to Unicode
+ if($to_unicode)
+ return str_replace($html_entities, $unicode_entities, $input);
+
+ // transcode Unicode entities to HTML entities
+ else
+ return str_replace($unicode_entities, $html_entities, $input);
+}
+
+/**
+ * transcode multi-byte characters to HTML representations for Unicode
+ *
+ * This function is aiming to preserve Unicode characters through storage in a
ISO-8859-1 compliant system.
+ *
+ * Every multi-byte UTF-8 character is transformed to its equivalent HTML
numerical entity (eg, &#4568;)
+ * that may be handled safely by PHP and by MySQL.
+ *
+ * Of course, this solution does not allow for full-text search in the
database and therefore, is not a
+ * definitive solution to internationalization issues.
+ * It does enable, however, practical use of Unicode to build pages in foreign
languages.
+ *
+ * Also, this function transforms HTML entities into their equivalent Unicode
entities.
+ * For example, w.bloggar posts pages using HTML entities.
+ * If you have to modify these pages using web forms, you would like to get
UTF-8 instead.
+ *
+ * @link
http://www.evolt.org/article/A_Simple_Character_Entity_Chart/17/21234/ A Simple
Character Entity Chart
+ *
+ * @param string the original UTF-8 string
+ * @return a string acceptable in an ISO-8859-1 storage system (ie., PHP4 +
MySQl 3)
+ */
+function to_unicode($input) {
+ // transcode HTML entities to Unicode entities
+ $input = transcode($input);
+ // scan the whole string
+ $output = '';
+ $index = 0;
+ while($index < strlen($input)) {
+ // look at one char
+ $char = ord($input[$index]);
+ // one byte (0xxxxxxx)
+ if ($char < 0x80) {
+ // some chars may be undefined
+ $output .= chr($char);
+ $index += 1;
+ // two bytes (110xxxxx 10xxxxxx)
+ } else if ($char < 0xE0) {
+ // strip weird sequences (eg, C0 80 -> NUL)
+ if($value = (($char % 0x20) * 0x40) + (ord($input[$index + 1]) % 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 2;
+ // three bytes (1110xxxx 10xxxxxx 10xxxxxx) example: euro sign =
\xE2\x82\xAC -> €
+ } else if ($char < 0xF0) {
+ // strip weird sequences
+ if($value = (($char % 0x10) * 0x1000) + ((ord($input[$index + 1]) %
0x40) * 0x40) + (ord($input[$index + 2]) % 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 3;
+ // four bytes (11110xxx 10xxxxxx 10xxxxxx 10xxxxxx)
+ } else if($char < 0xF8) {
+ // strip weird sequences
+ if ($value = (($char % 0x08) * 0x40000) + ((ord($input[$index + 1]) %
0x40) * 0x1000) + ((ord($input[$index + 2]) % 0x40) * 0x40)
+ + (ord($input[$index + 3]) % 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 4;
+ // five bytes (111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx)
+ } else if($char < 0xFC) {
+ // strip weird sequences
+ if ($value = (($char % 0x04) * 0x1000000) + ((ord($input[$index + 1]) %
0x40) * 0x40000) + ((ord($input[$index + 2]) % 0x40) * 0x1000)
+ + ((ord($input[$index + 3]) % 0x40) * 0x40) + (ord($input[$index + 4])
% 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 5;
+ // six bytes (1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx)
+ } else {
+ // strip weird sequences
+ if ($value = (($char % 0x02) * 0x40000000) + ((ord($input[$index + 1]) %
0x40) * 0x1000000) + ((ord($input[$index + 2]) % 0x40) * 0x40000)
+ + ((ord($input[$index + 3]) % 0x40) * 0x1000) + ((ord($input[$index +
4]) % 0x40) * 0x40) + (ord($input[$index + 4]) % 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 6;
+ }
+ }
+ // return the translated string
+ return $output;
+}
+
+// returns either the translated string or the original string.
+// Assumes we are passed the original string as occurs in text; result
+// will be html tokenized by htmlentities() using UTF8.
+// $i18nHTMLhasTranslation is set to nonzero value if a translation is
+// available or failure connecting to database, otherwise it is set to
+// 0.
+function translation_query($a) {
+ global $connection;
+ global $lang;
+ global $i18nHTMLrecordMode;
+ global $i18nHTMLhasTranslation, $i18nHTMLsqlPrefix;
+
+ $i18nHTMLhasTranslation = 1; // assume translation until failure
+
+ if ($a == "")
+ return $a;
+ $a = fix($a);
+ $a_sql = quote_smart($a);
+ if (!$connection) {
+ // database not available, just print English
+ return $a;
+ }
+
+ if ("English" == $lang) {
+ // no need to translate english, that's the
+ // hard-wired source language!
+ if ($i18nHTMLrecordMode == 2) {
+ // if not already in pending table (and recordMode set to allow us)
+ // then insert this string into it
+ $query = "SELECT count FROM ".$i18nHTMLsqlPrefix."pending WHERE
c=\"$a_sql\" AND lang=\"$lang\"";
+ $result = mysql_query($query, $connection);
+ $num = 0;
+ if ($result)
+ $num = mysql_num_rows($result);
+ if (0 == $num) {
+ $query = "INSERT INTO ".$i18nHTMLsqlPrefix."pending VALUES(\"$a_sql\",
\"$lang\", 0)";
+ mysql_query($query, $connection);
+ }
+ }
+ return $a;
+ }
+ // attempt to get translations, ranked for best
+ $query = "SELECT translation FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$a_sql\" AND lang=\"$lang\" ORDER BY ranking DESC";
+ $result = mysql_query($query, $connection);
+ $num = 0;
+ if ($result)
+ $num = mysql_num_rows($result);
+ if (0 == $num) { // didn't find a translation
+ if ($i18nHTMLrecordMode > 0) {
+ // either insert untranslated item into pending table or update
+ // referenced count; count is used to display more used strings
+ // during mass translation before less common ones.
+ $query = "SELECT count FROM ".$i18nHTMLsqlPrefix."pending WHERE
c=\"$a_sql\" AND lang=\"$lang\"";
+ $result = mysql_query($query, $connection);
+ $num = 0;
+ if ($result)
+ $num = mysql_numrows($result);
+ $count = 0;
+ if ($num > 0) {
+ $row = mysql_fetch_array($result);
+ $count = $row["count"] + 1;
+ $query = "UPDATE ".$i18nHTMLsqlPrefix."pending SET count=$count WHERE
c=\"$a_sql\" AND lang=\"$lang\"";
+ } else {
+ $query = "INSERT INTO ".$i18nHTMLsqlPrefix."pending VALUES(\"$a_sql\",
\"$lang\", 1)";
+ }
+ mysql_query($query, $connection);
+
+ }
+ $i18nHTMLhasTranslation = 0; // no translation was found
+ return $a; // just return English string
+ } else { // translation available
+
+ $row = mysql_fetch_array($result);
+ return $row["translation"];
+ }
+}
+
+// *************************************************
+// Fundamental i18nHTML API functions
+// *************************************************
+
+// translate the sentence $a and return the result.
+function TRANSLATE_($a,$args=null) {
+ if ($a == "")
+ return 0;
+ return vsprintf(translation_query($a), $args);
+}
+
+// translate the sentence $a and output just
+// the translated text (without link to translate.php)
+function TRANSLATE($a,$args=null) {
+ echo TRANSLATE_($a);
+}
+
+// translate the sentence $a adding a link
+// to enable editing translations and return the result.
+function W_($a,$args=null) {
+ if ($a == "")
+ return 0;
+ return TRANSLATE_($a,$args) . translateLink_($a);
+}
+
+// translate the sentence $a appending a link
+// to enable edit the translation and output the
+// result.
+function W($a, $args=NULL) {
+ if ($a != "")
+ echo W_($a, $args) . "\n";
+}
+
+// create internationalized, internal link to
+// $a.php with description $b
+function intlink_($a, $b) {
+ global $lang;
+
+ $ret = "<a href=\"" . $a . "?xlang=" . $lang . "\">" . TRANSLATE_($b) .
"</a>";
+ $ret = $ret . translateLink_($b);
+ return $ret;
+}
+
+// create internationalized, internal link to
+// $a.php with description $b
+function intlink($a, $b) {
+ echo intlink_($a, $b);
+}
+
+// create internationalized, external link to
+// $a with description $b
+function extlink_($a, $b) {
+ $ret = "<a href=\"" . $a . "\">" . TRANSLATE_($b) . "</a>" .
translateLink_($b);
+ return $ret;
+}
+
+// create internationalized, external link to
+// $a with description $b
+function extlink($a, $b) {
+ echo extlink_($a, $b);
+}
+
+
+// *************************************************
+// global, call-once helper functions
+// *************************************************
+
+// outputs appropriate DOCTYPE declaration for the document
+// this should be the 1st line in your php file after including
+// i18nhtml.inc. Valid types are: HTML for HTML 4 documents,
+// XHTML1 for xhtml 1.0 documents, and XHTML1.1 for xhtml 1.1
+// defaulting to HTML4 if $type is blank or unknown. An optional
+// $mode may be specified, it must be one of "Transitional",
+// "Strict", or "Frameset", defaulting to "Transitional".
+// Note for XHTML1.1 $mode is ignored.
+// example:
+// include("i18nhtml.inc");
+// DOCTYPE("XHTML1");
+function DOCTYPE($type=null, $mode=null) {
+ // depending on $mode, use appropriate dtd
+ if ($mode == "Strict") {
+ $dtd = "strict";
+ if ($type != "XHTML1") // Strict not specified except for XHTML1.0
+ $mode = "";
+ } else if ($mode == "Frameset") {
+ $dtd = "frameset";
+ } else { // $mode == Transitional, default, or unknown
+ $dtd = "loose";
+ $mode = "Transitional";
+ }
+ if ($type == "XHTML1")
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 " . $mode . "//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" . $dtd . ".dtd\">\n";
+ else if ($type == "XHTML1.1")
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
+ else
+ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " . $mode . "//EN\"
\"http://www.w3.org/TR/html4/" . $dtd . ".dtd\">\n";
+}
+
+function TITLE($a,$b="") {
+ global $lang;
+ global $languagecodes;
+ echo "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"
>";
+ echo "<title>" . TRANSLATE_($a,$b) . "</title>\n";
+ if (isset($languagecodes[$lang])) {
+ echo "<meta name=\"content-language\" content=\"" .
+ $languagecodes[$lang] . "\">";
+ echo "<meta name=\"language\" content=\"" .
+ $languagecodes[$lang] . "\">";
+ }
+}
+
+// displays a list of all languages currently available with
+// at least 1 translated string.
+function generateLanguageBar() {
+ global $connection, $i18nHTMLsqlPrefix;
+
+ if ($connection) {
+ echo "<center>[";
+ $query = "SELECT DISTINCT lang FROM ".$i18nHTMLsqlPrefix."map ORDER BY
lang";
+// die($query);
+ $result = mysql_query($query, $connection);
+ $num = 0;
+ if ($result)
+ $num = mysql_numrows($result);
+ echo "<a href=\"?xlang=English\">";
+ W("English");
+ echo "</a>";
+ $last = "English";
+ for ($i=0;$i<$num;$i++) {
+ $row = mysql_fetch_array($result);
+ $next = $row["lang"];
+ if ($next == $last)
+ continue;
+ echo " | ";
+ echo "<a href=\"?xlang=$next\">" . W_($next) . "</a>";
+ $last = $next;
+ }
+ echo "]</center>";
+ }
+}
+
+
+// displays text at the bottom of the page to indicate
+// translation mode (including link to active) and
+// copyright notice for i18nHTML.
+function generateFooter() {
+ global $xlang;
+ global $editor;
+ global $HTTP_SERVER_VARS;
+
+ P();
+ echo "Translation engine based on <a
href=\"http://gnunet.org/i18nHTML/\">i18nHTML</a> (C) 2003, 2004, 2005
Christian Grothoff.<br />\n";
+ if ( ($xlang) && ($xlang != "English") ) {
+ $back = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] .
$HTTP_SERVER_VARS["REQUEST_URI"];
+ echo "<center><small>\n";
+ if ($editor != 1)
+ echo " <a href=\"$back&editor=1\">" . W_("enter translation mode") .
"</a>";
+ else
+ W(" Translation Mode Active (for this page only)");
+ echo "</small></center>\n";
+ }
+ echo "</p>\n";
+}
+
+
+
+// *************************************************
+// HTML construct helper functions
+// *************************************************
+
+function LI($a,$b="") {
+ echo "<li>" . W_($a,$b) . "</li>\n";
+}
+function TH($a,$b="") {
+ echo "<th>" . W_($a,$b) . "</th>\n";
+}
+function TD($a,$b="") {
+ echo "<td>" . W_($a,$b) . "</td>\n";
+}
+function DT($a,$b="") {
+ echo "<dt>" . W_($a,$b) . "</dt>\n";
+}
+function DD($a,$b="") {
+ echo "<dd>" . W_($a,$b) . "</dd>\n";
+}
+function H1($a,$b="") {
+ echo "<h1>" . W_($a,$b) . "</h1>\n";
+}
+function H2($a,$b="") {
+ echo "<h2>" . W_($a,$b) . "</h2>\n";
+}
+function H3($a,$b="") {
+ echo "<h3>" . W_($a,$b) . "</h3>\n";
+}
+function H4($a,$b="") {
+ echo "<h4>" . W_($a,$b) . "</h4>\n";
+}
+function H5($a,$b="") {
+ echo "<h5>" . W_($a,$b) . "</h5>\n";
+}
+function PRE($a) {
+ echo "<pre>" . $a . "</pre>";
+}
+// 'verbatim' (untranslated) "li"
+function LIV($a) {
+ echo "<li>" . $a . "</li>\n";
+}
+function P($attr="") {
+ echo "<p $attr>\n";
+}
+function BR($attr="") {
+ echo "<br $attr/>\n";
+}
+function HR() {
+ echo "<hr/>\n";
+}
+function DTDD($a,$b) {
+ DT($a);
+ DD($b);
+}
+function LILI($a,$b) {
+ echo "<li>" . extlink_($a,$b) . "</li>\n";
+}
+function ANCHOR($a) {
+ echo "<a name=\"$a\"></a>\n";
+}
+function IMG_($src, $alt, $align="CENTER", $width, $height, $border=0,
$hspace=0, $vspace=0) {
+ $ret = "";
+
+ if ($align == "CENTER")
+ $ret = $ret . "<p><center>\n";
+ $ret = $ret . "<img src=\"" . $src . "\" alt=\"";
+ $ret = $ret . TRANSLATE_($alt);
+ $ret = $ret . "\" align=\"" . $align . "\" width=$width height=$height
border=$border hspace=$hspace vspace=$vspace>\n";
+ $ret = $ret . translateLink_($alt);
+ if ($align == "CENTER")
+ $ret = $ret . "</center><p>\n";
+ return $ret;
+}
+function IMG($src, $alt, $align="CENTER", $width, $height, $border=0,
$hspace=0, $vspace=0) {
+ echo IMG_($src, $alt, $align, $width, $height, $border, $hspace, $vspace);
+}
+
+?>
\ No newline at end of file
Deleted: Extractor-docs/WWW/i18nhtml_config.inc
===================================================================
--- Extractor-docs/WWW/i18nhtml_config.inc 2005-05-25 11:52:28 UTC (rev
816)
+++ Extractor-docs/WWW/i18nhtml_config.inc 2005-05-25 12:05:16 UTC (rev
817)
@@ -1,35 +0,0 @@
-<?php
-/*
- (C) 2003, 2004 Christian Grothoff
-
- This code is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
- option) any later version.
-
- The code is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with the code; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
- // Use this file to configure i18nHTML
-
-// -- use 0 when /. comes...
-$i18nHTMLrecordMode = 2; // 1: only missing, 2: everything, 0: disable
-
-$i18nHTMLsqlServer = "localhost";
-$i18nHTMLsqlUser = "GNUnetWWW";
-$i18nHTMLsqlPass = "garlic";
-
-$i18nHTMLsqlDB = "translations"; // default is "translation"
-$i18nHTMLbase = ""; // base directory prepended to i18nHTML php pages used in
links
-$i18nHTMLmarker = "*"; // default value if never changed
-
-
-?>
Added: Extractor-docs/WWW/i18nhtml_config.inc.php
===================================================================
--- Extractor-docs/WWW/i18nhtml_config.inc.php 2005-05-25 11:52:28 UTC (rev
816)
+++ Extractor-docs/WWW/i18nhtml_config.inc.php 2005-05-25 12:05:16 UTC (rev
817)
@@ -0,0 +1,36 @@
+<?php
+/*
+ (C) 2003, 2004 Christian Grothoff
+
+ This code is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ The code is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with the code; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+ // Use this file to configure i18nHTML
+
+// -- use 0 when /. comes...
+$i18nHTMLrecordMode = 2; // 1: only missing, 2: everything, 0: disable
+
+$i18nHTMLsqlServer = "localhost";
+$i18nHTMLsqlUser = "GNUnetWWW";
+$i18nHTMLsqlPass = "garlic";
+
+$i18nHTMLsqlDB = "translations"; // default is "translation"
+$i18nHTMLbase = ""; // base directory prepended to i18nHTML php pages used in
links
+$i18nHTMLmarker = "*"; // default value if never changed
+
+$i18nHTMLsqlPrefix = ""; // use this if you want to have a prefix for the SQL
table names used by i18nHTML
+
+?>
Added: Extractor-docs/WWW/start.php
===================================================================
--- Extractor-docs/WWW/start.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/start.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,29 @@
+<?php
+include("i18nhtml.inc.php");
+DOCTYPE("HTML", "Transitional");
+echo "<html><head>\n";
+TITLE("Documentation");
+echo "</head><body>";
+generateLanguageBar();
+H2("Documentation");
+H3("i18nHTML");
+W("These webpages uses %s to internationalize the documentation.",
+ extlink_("http://gnunet.org/i18nHTML/", "i18nHTML"));
+W("Please feel encouraged to help, for example by translating some of the
pages to your native language.");
+W("Just view the pages in your language and click on the "*" after a
sentence to translate it.");
+W("You can start a new language by adding <tt>lang=LANGUAGE</tt> after the
<tt>.php3</tt> in the URL.");
+W("The translations incorporate a voting system, the highest ranked
translation is displayed.");
+W("English is always the source language.");
+W("Only developers can change the source, contact them if you find problems.");
+W("On the translation page, you find all other translations.");
+W("You can also vote for a specific translation by clicking on the respective
sentence.");
+W("You are allowed to vote multiple times for the same sentence, e.g. to
express strong feelings. :-)");
+W("The system logs your IP and allows the administrator to easily undo all
operations that were performed from a certain IP address.");
+if ($xlang && ($xlang != "English") ) {
+ W("You can translate the most commonly requested untranslated sentences for
your language using the %s.",
+ intlink_("editor.php", "mass translation page"));
+ }
+
+generateFooter();
+echo "</body></html>\n";
+?>
Added: Extractor-docs/WWW/status.php
===================================================================
--- Extractor-docs/WWW/status.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/status.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,93 @@
+<?php
+/*
+ (C) 2003, 2004, 2005 Christian Grothoff
+
+ This code is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ The code is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with the code; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+ // This file can be used to obtain some statistics
+ // about the progress of the translation.
+ // It has no other purpose.
+
+include("i18nhtml.inc.php");
+if (!$connection) {
+ echo "Database is down.";
+ die();
+ }
+$mode = $_REQUEST['mode'];
+DOCTYPE("HTML", "Transitional");
+echo "<html><head>\n";
+TITLE("Translation: status");
+echo "</head><body>";
+W("Language setting is %s.",
+ $lang);
+P();
+$query = "SELECT count FROM ".$i18nHTMLsqlPrefix."pending WHERE
lang=\"English\"";
+$result = mysql_query($query, $connection);
+$num = 0;
+if ($result)
+ $num = mysql_numrows($result);
+W("Sentences in the original English text: %s",
+ $num);
+P();
+if ($mode == 1) {
+ H2("All available translations");
+ echo "<table border='5'>\n";
+ echo "<tr>";
+ TH("Original");
+ TH("Language");
+ TH("Translation");
+ TH("Votes");
+ echo "</tr>\n";
+}
+$stats = ARRAY();
+$query = "SELECT name,ranking,translation,lang FROM ".$i18nHTMLsqlPrefix."map";
+$result = mysql_query($query, $connection);
+$num = 0;
+if ($result)
+ $num = mysql_numrows($result);
+for ($i=0;$i<$num;$i++) {
+ $row = mysql_fetch_array($result);
+ $text = stripslashes($row["name"]);
+ $translation = stripslashes($row["translation"]);
+ $ranking = $row["ranking"];
+ $stats[$row["lang"]]++;
+ if ($mode == 1) {
+ printf("<tr><td>%s</td><td>%s</td><td><a href=\"vote.php3?" .
+ "lang=%s&text=%s&translation=%s\">%s</a></td><td>%s</td></tr>\n",
+ $text,
+ $row["lang"],
+ urlencode($row["lang"]),
+ urlencode($text),
+ urlencode($translation),
+ $translation,
+ $ranking);
+ }
+}
+if ($mode == 1) {
+ echo "</table>";
+ P();
+ HR();
+ P();
+}
+W("%s translated sentences in database.", $num);
+P();
+foreach ($stats as $a => $b) {
+ W("%s translations available in %s.", ARRAY($b, $a));
+ BR();
+}
+generateFooter();
+echo "</body></html>";
+?>
\ No newline at end of file
Modified: Extractor-docs/WWW/translate.php
===================================================================
--- Extractor-docs/WWW/translate.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/translate.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -17,13 +17,13 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
}
$text = fix($_REQUEST['text']);
-$text_sql = mysql_real_escape_string($text);
+$text_sql = quote_smart($text);
$text_url = urlencode($text);
$back = $_REQUEST['back'];
DOCTYPE("HTML", "Transitional");
@@ -36,7 +36,7 @@
if ($lang == "English") {
echo "Cannot translate to English.";
die();
- }
+ }
H2("Original Text");
echo $text;
H2("Translation");
@@ -49,8 +49,8 @@
echo "<input type=hidden name=\"back\" value=\"$back\">\n";
W("Translated text:");
echo "<input size=\"80\" maxlength=\"65535\" name=\"translation\">\n";
-echo "<input type=submit value=\"" .
- TRANSLATE_("I hereby give this translation into the Public Domain
(commit)") .
+echo "<input type=submit value=\"" .
+ TRANSLATE_("I hereby give this translation into the Public Domain
(commit)") .
"\">\n";
echo "</form>\n";
P();
@@ -58,15 +58,15 @@
H2("All available translations");
echo "<table border=5 width=95%>\n";
echo "<tr><th>" . W_("Language") . "</th><th>" . W_("Translation") .
"</th></tr>\n";
-$query = "SELECT translation,lang FROM map WHERE name=\"$text_sql\" ORDER BY
ranking DESC";
+$query = "SELECT translation,lang FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$text_sql\" ORDER BY ranking DESC";
$result = mysql_query($query, $connection);
$num = 0;
-if ($result)
+if ($result)
$num = mysql_num_rows($result);
for ($i=0;$i<$num;$i++) {
$row = mysql_fetch_array($result);
$translation = $row["translation"];
- printf("<tr><td>%s</td><td><a href=\"" . $i18nHTMLbase .
+ printf("<tr><td>%s</td><td><a href=\"" . $i18nHTMLbase .
"vote.php?xlang=%s&text=%s&translation=%s\">%s</a></td></tr>\n",
W_($row["lang"]),
urlencode($row["lang"]),
Added: Extractor-docs/WWW/update0_1_0.php
===================================================================
--- Extractor-docs/WWW/update0_1_0.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/update0_1_0.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,50 @@
+<?php
+include("i18nhtml.inc");
+?>
+# This script merely generates the SQL statements<br>
+# to do the update. You'll have to run the SQL<br>
+# commands yourself to prevent accidental data loss.<br>
+# <pre>
+<?php
+echo "use $i18nHTMLsqlDB;\n";
+$query = "SELECT * FROM map";
+$result = mysql_query($query, $connection);
+$num = 0;
+$loss = 0;
+if ($result)
+ $num = mysql_numrows($result);
+for ($ii=0;$ii<$num;$ii++) {
+ $row = mysql_fetch_array($result);
+ $la = mysql_real_escape_string($row["lang"]);
+ $src = mysql_real_escape_string($row["name"]); // urlencoded
+ $dst = $row["translation"]; // possibly urlencoded
+ $rank = $row["ranking"];
+ $rtrans = mysql_real_escape_string(to_unicode(urldecode($dst)));
+ // detect "bad" translations (where conversion failed)
+ // if more than 5 values in [0..9] follow => bad conversion
+ $txtCnt = count_chars(urldecode($src), 1);
+ $tCnt = count_chars($rtrans, 1);
+
+ // 3426
+ if (! ( ereg("&#[0-9]{6}", $rtrans) ||
+ ($txtCnt[ord('%')] != $tCnt[ord('%')]) ||
+ ( ( ($la != "Japanese") &&
+ ($la != "Traditional chinese") &&
+ ($la != "Russian") &&
+ ($la != "Ukrainian") &&
+ (ereg("&#[0-9]{4}", $rtrans)) ) ) ) ) {
+ $dst = mysql_real_escape_string($dst);
+ if ($rtrans != $dst) {
+ $subquery = "UPDATE map SET translation=\"$rtrans\" WHERE name=\"$src\"
AND lang=\"$la\" AND translation=\"$dst\" AND ranking=$rank;\n";
+ echo "$subquery\n";
+ }
+ } else {
+ $subquery = "DELETE FROM map WHERE name=\"$src\" AND lang=\"$la\" AND
translation=\"$dst\" AND ranking=$rank;\n";
+ echo "$subquery\n";
+ $loss++;
+ }
+ }
+echo "# Lost $loss out of $num translations.\n";
+?>
+# </pre>
+# end of conversion
Added: Extractor-docs/WWW/update0_2_0.php
===================================================================
--- Extractor-docs/WWW/update0_2_0.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/update0_2_0.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,36 @@
+<?php
+include("i18nhtml.inc");
+?>
+# This script merely generates the SQL statements<br>
+# to do the update. You'll have to run the SQL<br>
+# commands yourself to prevent accidental data loss.<br>
+# <pre>
+<?php
+echo "use $i18nHTMLsqlDB;\n";
+$query = "SELECT * FROM map";
+$result = mysql_query($query, $connection);
+$num = 0;
+$loss = 0;
+if ($result)
+ $num = mysql_numrows($result);
+for ($ii=0;$ii<$num;$ii++) {
+ $row = mysql_fetch_array($result);
+ $la = mysql_real_escape_string($row["lang"]);
+ $src = $row["name"]; // urlencoded
+ $src_sql = mysql_real_escape_string($src);
+ $dst_sql = mysql_real_escape_string($row["translation"]);
+ $rank = $row["ranking"];
+ $rname = fix(urldecode($src));
+ $rname_sql = mysql_real_escape_string(fix(urldecode($src)));
+ // detect "bad" translations (where conversion failed)
+ // if more than 5 values in [0..9] follow => bad conversion
+ $txtCnt = count_chars(urldecode($src), 1);
+ $tCnt = count_chars($rtrans, 1);
+
+ $dst = mysql_real_escape_string($dst);
+ $subquery = "UPDATE map SET name=\"$rname_sql\" WHERE name=\"$src_sql\" AND
lang=\"$la\" AND translation=\"$dst_sql\" AND ranking=$rank;\n";
+ echo "$subquery";
+}
+?>
+# </pre>
+# end of conversion
Modified: Extractor-docs/WWW/vote.php
===================================================================
--- Extractor-docs/WWW/vote.php 2005-05-25 11:52:28 UTC (rev 816)
+++ Extractor-docs/WWW/vote.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -20,7 +20,7 @@
// This file records votes from users for translations.
// For sentences with multiple translations, the one with the most
// votes is displayed.
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
DOCTYPE("HTML", "Transitional");
echo "<html><head>";
TITLE("WWW translation: vote");
@@ -28,22 +28,22 @@
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
- }
+ }
$text = fix(urldecode($_REQUEST['text']));
$translation = fix(urldecode($_REQUEST['translation']));
-$text_sql = mysql_real_escape_string($text);
-$translation_sql = mysql_real_escape_string(to_unicode($translation));
+$text_sql = quote_smart($text);
+$translation_sql = quote_smart(to_unicode($translation));
-$query = "SELECT ranking FROM map WHERE " .
+$query = "SELECT ranking FROM ".$i18nHTMLsqlPrefix."map WHERE " .
"name=\"$text_sql\" AND lang=\"$lang\" AND
translation=\"$translation_sql\"";
$result = mysql_query($query, $connection);
$num = 0;
-if ($result)
+if ($result)
$num = mysql_numrows($result);
if ($num > 0) {
$row = mysql_fetch_array($result);
$ranking = $row["ranking"] + 1;
- $query = "UPDATE map SET ranking=\"$ranking\" WHERE " .
+ $query = "UPDATE ".$i18nHTMLsqlPrefix."map SET ranking=\"$ranking\" WHERE " .
"name=\"$text_sql\" AND lang=\"$lang\" AND
translation=\"$translation_sql\"";
mysql_query($query, $connection);
W("Ranking of translation is now: ");
Modified: GNUnet-docs/WWW/commitMassTranslation.php
===================================================================
--- GNUnet-docs/WWW/commitMassTranslation.php 2005-05-25 11:52:28 UTC (rev
816)
+++ GNUnet-docs/WWW/commitMassTranslation.php 2005-05-25 12:05:16 UTC (rev
817)
@@ -17,7 +17,7 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
@@ -39,10 +39,10 @@
if ( ($dec == "xlang") || ($dec == "start") )
continue;
$val = fix($val);
- $query = "SELECT c FROM pending WHERE lang=\"$xlang\"";
+ $query = "SELECT c FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$xlang\"";
$result = mysql_query($query, $connection);
$num = 0;
- if ($result)
+ if ($result)
$num = mysql_numrows($result);
while ($num > 0) {
$num--;
@@ -59,36 +59,36 @@
$dec);
P();
continue;
- }
- $query = "DELETE FROM pending WHERE lang=\"$lang\" AND c=\"$enc_sql\"";
- mysql_query($query, $connection);
+ }
+ $query = "DELETE FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$lang\" AND
c=\"$enc_sql\"";
+ mysql_query($query, $connection);
$val_sql = mysql_real_escape_string(to_unicode($val));
- $query = "SELECT ranking FROM map WHERE name=\"$enc_sql\"" .
+ $query = "SELECT ranking FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$enc_sql\"" .
" AND lang=\"$lang\" AND translation=\"$val_sql\"";
$result = mysql_query($query, $connection);
$num = 0;
- if ($result)
+ if ($result)
$num = mysql_numrows($result);
if ($num == 0) {
$txtCnt = count_chars(stripslashes($enc_sql), 1);
$tCnt = count_chars(stripslashes($val_sql), 1);
if ($txtCnt[ord('%')] != $tCnt[ord('%')]) {
W("Commit '%s->%s' failed.", stripslashes($enc_sql),
stripslashes($val_sql));
- W("The number of percent signs in source text and translation do not
match.");
+ W("The number of percent signs in source text and translation do not
match.");
W("Note that you must preserve all %%s expressions unchanged.");
W("Also, a single displayed %% sign must be translated into two (%%%%)
such signs.");
P();
} else {
- $query = "INSERT INTO map VALUES(\"$enc_sql\", \"$lang\", " .
+ $query = "INSERT INTO ".$i18nHTMLsqlPrefix."map VALUES(\"$enc_sql\",
\"$lang\", " .
"\"$val_sql\", 1, \"" . $_SERVER['REMOTE_ADDR'] . "\");";
mysql_query($query, $connection);
$done++;
W("Storing translation for "%s" = "%s".",
ARRAY(stripslashes($enc_sql),
stripslashes($val_sql)));
- BR();
+ BR();
}
- }
+ }
}
P();
echo "<a href=\"" . $i18nHTMLbase . "editor.php?xlang=" . $lang . "&start=" .
($start - $done) . "\">";
Modified: GNUnet-docs/WWW/commitTranslation.php
===================================================================
--- GNUnet-docs/WWW/commitTranslation.php 2005-05-25 11:52:28 UTC (rev
816)
+++ GNUnet-docs/WWW/commitTranslation.php 2005-05-25 12:05:16 UTC (rev
817)
@@ -17,7 +17,7 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
@@ -33,18 +33,18 @@
$back = $_REQUEST['back'];
// check for identical translation
-$query = "SELECT ranking FROM map WHERE name=\"$text_sql\"" .
+$query = "SELECT ranking FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$text_sql\"" .
" AND lang=\"$lang\" AND translation=\"$translation_sql\"";
$result = mysql_query($query, $connection);
$num = 0;
-if ($result)
+if ($result)
$num = mysql_numrows($result);
if ($num > 0) {
echo "<html><head>";
TITLE("Translation exists.");
echo "</head><body>";
W("Translation '%s' of sentence '%s' exists.",
- ARRAY(fix($translation), $text));
+ ARRAY(fix($translation), $text));
extlink($back, "Back...");
generateFooter();
echo "</body></html>";
@@ -56,17 +56,17 @@
TITLE("Commit failed.");
echo "</head><body>";
W("Commit failed ('%s' and '%s').", ARRAY($text, $translation));
- W("The number of percent signs in source text and translation does not
match.");
+ W("The number of percent signs in source text and translation does not
match.");
W("Note that you must preserve all %%s expressions unchanged.");
W("Also, a single displayed %% sign must be translated into two (%%%%)
such signs.");
echo "</body></html>";
} else {
- $query = "INSERT INTO map VALUES(\"$text_sql\", \"$lang\", " .
+ $query = "INSERT INTO ".$i18nHTMLsqlPrefix."map VALUES(\"$text_sql\",
\"$lang\", " .
"\"$translation_sql\", 1, \"" . $_SERVER['REMOTE_ADDR'] . "\");";
$result = mysql_query($query, $connection);
if ($result) {
- $query = "DELETE FROM pending WHERE lang=\"$lang\" AND c=\"$text_sql\"";
- mysql_query($query, $connection);
+ $query = "DELETE FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$lang\"
AND c=\"$text_sql\"";
+ mysql_query($query, $connection);
header("Location: " . $back); /* Redirect browser */
} else {
echo "<html><head>";
@@ -76,6 +76,6 @@
echo mysql_error();
echo "</body></html>";
}
- }
+ }
}
?>
Modified: GNUnet-docs/WWW/editor.php
===================================================================
--- GNUnet-docs/WWW/editor.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/editor.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -17,7 +17,7 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
@@ -30,8 +30,8 @@
if ( (! $xlang) || ($xlang == "English") ) {
echo "Cannot translate to English.";
die();
- }
-$start = $_REQUEST['start'];
+ }
+$start = $_REQUEST['start'];
H2("Mass translation to %s", $xlang);
W("This page is for translating lots of sentences at once.");
W("The sentences are ordered by the frequency that they are requested by
users.");
@@ -42,7 +42,7 @@
W("Do not copy the quotes (") from the original messages into the
translations.");
W("Leave translations that you cannot do blank.");
-$query = "SELECT c FROM pending WHERE lang=\"$lang\" ORDER BY count DESC";
+$query = "SELECT c FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$lang\"
ORDER BY count DESC";
$result = mysql_query($query, $connection);
$num = 0;
if ($result)
@@ -70,7 +70,7 @@
echo "<input type=hidden name=\"xlang\" value=\"$xlang\">";
$endp = $end + 1;
echo "<input type=hidden name=\"start\" value=\"$endp\">";
-
+
echo "<table border=5>";
echo "<tr>";
TH("Original");
@@ -82,26 +82,26 @@
continue;
$cx_plain = fix($row["c"]);
$cx_sql = mysql_real_escape_string($cx_plain);
-
- $query = "SELECT ranking FROM map WHERE name=\"$cx_sql\" AND
lang=\"$lang\"";
+
+ $query = "SELECT ranking FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$cx_sql\" AND lang=\"$lang\"";
$result2 = mysql_query($query, $connection);
$num2 = 0;
- if ($result2)
+ if ($result2)
$num2 = mysql_numrows($result2);
echo "<tr><td width=\"45%\">";
echo ""$cx_plain"";
echo "</td>\n\t<td width\"50\%\">";
if ($num2 > 0) {
- $query = "DELETE FROM pending WHERE lang=\"$lang\" AND c=\"$cx_sql\"";
- mysql_query($query, $connection);
+ $query = "DELETE FROM ".$i18nHTMLsqlPrefix."pending WHERE lang=\"$lang\"
AND c=\"$cx_sql\"";
+ mysql_query($query, $connection);
W("Skipped (already translated).");
} else {
echo "<input size=\"40\" maxlength=\"65535\" name=\"" .
bin2hex(md5($cx_plain)) . "\"></td></tr>\n";
}
}
echo "</tr></table>";
- echo "<input type=submit value=\"" .
- TRANSLATE_("I hereby give all these translations into the Public Domain
(commit)") .
+ echo "<input type=submit value=\"" .
+ TRANSLATE_("I hereby give all these translations into the Public Domain
(commit)") .
"\">";
echo "</form>";
}
Added: GNUnet-docs/WWW/example.php
===================================================================
--- GNUnet-docs/WWW/example.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/example.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,29 @@
+<?php
+include("i18nhtml.inc.php");
+DOCTYPE("HTML");
+echo "<html><head>";
+TITLE("Example page");
+echo "</head><body>";
+H1("Some document title");
+W("A sentence to translate.");
+W("A sentence with an argument '%s' that cannot be translated.",
+ "foo");
+W("A sentence with two arguments '%s' and '%s' that cannot be translated.",
+ ARRAY("foo", "bar"));
+P(); // <p>
+W("A sentence with a %s that CAN be translated.",
+ extlink_("http://gnunet.org/i18nHTML/", "link text"));
+W("A %s to another translatable page.",
+ intlink_("http://gnunet.org/i18nHTML/index", "link")); // .php is added
automatically!
+BR(); // <br>
+echo W_("A function returning the translation.");
+W("For more functions, look into i18nhtml.inc.");
+
+HR();
+W("And finally put the language selection bar somewhere:");
+generateLanguageBar(); // allow user to select other languages
+P();
+W("Oh, and put the footer to allow the editor mode:");
+generateFooter();
+echo "</body></html>";
+?>
\ No newline at end of file
Added: GNUnet-docs/WWW/example2.php
===================================================================
--- GNUnet-docs/WWW/example2.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/example2.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,61 @@
+<?php
+include("i18nhtml.inc.php"); // do this 1st, add translation support
+DOCTYPE("HTML","Transitional"); // tell the user agent document format
+setTranslateLinkMarker("***"); // make translation marker more visible
+editOnlyUntranslatedText(); // restrict translations to
untranslated strings
+
+echo "<html><head>";
+TITLE("Another Example Page");
+echo "</head><body>";
+
+HR();
+generateLanguageBar(); // allow user to select other languages
+HR();
+
+H1("header1");
+H2("header2");
+H3("header3");
+H2("header2 again");
+H3("yet another sub header");
+H3("and again, I think you get the idea");
+P(); // <p>
+W("A sentence to translate.");
+W("A sentence with an argument '%s' that cannot be translated.",
+ "foo");
+W("A sentence with two arguments '%s' and '%s' that cannot be translated.",
+ ARRAY("foo", "bar"));
+P(); // <p>
+echo "This is untranslated text\n";
+BR(); // <br>
+echo "another way to translate text, note each W chunk represents a ";
+echo "single translatable chunk so similar to above, but split into ";
+echo "multiple translation chunks.<br>";
+$myvar = W_("A sentence with an argument ");
+$myvar = $myvar . "foo" . W_(" that cannot be translated.");
+echo $myvar;
+P(); // <p>
+echo "here we have text that is translated, but not easily edited";
+echo "unless it happens to match some other text.<br>";
+$myvar = TRANSLATE_("A sentence with an argument ");
+$myvar = $myvar . "foo" . TRANSLATE_(" that is not translatable.");
+echo $myvar;
+W("A sentence with a %s that CAN be translated.",
+ extlink_("http://gnunet.org/i18nHTML/", "link text"));
+W("A %s to another translatable page.",
+ intlink_("http://gnunet.org/i18nHTML/index", "link")); // .php is added
automatically!
+BR(); // <br>
+echo W_("A function returning the translation.");
+W("For more functions, look into i18nhtml.inc.");
+P();
+
+HR();
+$t = "Notice how we don't have to escape or quote(\") ampersands & nor other";
+$t = $t . "HTML entities. <<<--->>> and such even work. This looks like
&\n";
+W($t);
+HR();
+
+P();
+W("Insert footer to allow entering translation edit mode:");
+generateFooter();
+echo "</body></html>";
+?>
Deleted: GNUnet-docs/WWW/i18nhtml.inc
===================================================================
--- GNUnet-docs/WWW/i18nhtml.inc 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/i18nhtml.inc 2005-05-25 12:05:16 UTC (rev 817)
@@ -1,888 +0,0 @@
-<?php
-/*
- (C) 2003, 2004, 2005 Christian Grothoff and other contributing authors.
-
- This code is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
- option) any later version.
-
- The code is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with the code; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
- // This file defines the functions that will be used
- // to build the webpage. The set may not contain everything
- // you might want, so feel free to define your own extensions.
-
- // Use W("text") to output translations.
- // $lang/xlang are used to specify the language
- // $editor can be set to create a translation
- // tag even if a translation is already available.
- // there is currently no security.
- //
- // An "_" is used for functions that return the
- // translated string instead of printing it directly.
- // These functions are used for "%s" printing with W().
- //
- // Most of the code should be straight forward. Look
- // at some of the example files that use it and compare with
- // the generated pages.
-// obtain user db specific configuration parameters
-include("i18nhtml_config.inc");
-header("Content-type: text/html; charset=utf-8");
-
-if (get_magic_quotes_gpc())
- die('PHP misconfigured. Disable get_magic_quotes.');
-
-// establish default connection to database server
-$connection = @mysql_connect($i18nHTMLsqlServer,
- $i18nHTMLsqlUser,
- $i18nHTMLsqlPass);
-if (!$connection) {
- die ('Failure connecting to ' . $i18nHTMLsqlServer . ' : ' . mysql_error());
-}
-
-// and select database on server that holds translations
-if ($connection) {
- $db_selected = mysql_select_db($i18nHTMLsqlDB,
- $connection);
- if (!$db_selected) {
- die ('Error selecting db : ' . mysql_error());
- }
-}
-
-// ensure the mapping and pending tables exist, creating them if not
-$query="CREATE TABLE IF NOT EXISTS map" .
- " (name BLOB, lang TINYBLOB, translation BLOB, ranking INT, ip
TINYTEXT, " .
- "INDEX(name(10)), INDEX(lang(4)), INDEX(ranking),
INDEX(translation(10)))";
-$result = mysql_query($query, $connection);
-if (($i18nHTMLdebug == 1) && (!$result)) {
- die('Unable to validate map table. Invalid query: ' . mysql_error());
-}
-
-$query="CREATE TABLE IF NOT EXISTS pending" .
- " (c BLOB, lang TINYBLOB, count INT, " .
- "INDEX(c(10)), INDEX(lang(4)), INDEX(count))";
-$result = mysql_query($query, $connection);
-if (($i18nHTMLdebug == 1) && (!$result)) {
- die('Unable to validate pending table. Invalid query: ' . mysql_error());
-}
-
-/* mapping of real-names to language codes */
-$languagecodes = array("English"=>"en",
- "German"=>"de",
- "French"=>"fr",
- "Portuguese"=>"pt",
- "Russian"=>"ru",
- "Romanian"=>"ro",
- "Spanish"=>"es",
- "Italian"=>"it",
- "Simplified chinese"=>"zh_CN",
- "Catalan"=>"ca",
- "Basque"=>"eu",
- "Arabic"=>"ar",
- "Bulgarian"=>"bg",
- "Czech"=>"cs",
- "Dutch"=>"nl",
- "Esperanto"=>"eo",
- "Hebrew"=>"he",
- "Japanese"=>"ja",
- "Norwegian"=>"no",
- "Polish"=>"po",
- "Ukrainian"=>"uk",
- "Danish"=>"da",
- "Swedish"=>"sv");
-
-/* try to automagically figure out user preferences */
-$hlang = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
-if ($hlang) {
- $tok = strtok($hlang, ";");
- while ($tok) {
- foreach($languagecodes as $name=>$code) {
- if (0 == strncmp($tok, $code, 2)) {
- $lang = $name;
- break 2;
- }
- }
- $tok = strtok(";");
- }
-}
-// If no language is specified, use english.
-if ( (! $lang) || ($lang=="") )
- $lang = "English";
-$xlang = $_REQUEST['xlang'];
-if ($xlang)
- $lang = $xlang;
-$lang = ucfirst(strtolower($lang));
-$lang = mysql_real_escape_string($lang);
-$editor = $_REQUEST['editor'];
-$i18nHTMLhasTranslation = 0; // set by last call to translation_query()
-
-/**
- * Replace certain HTML named special characters with their
- * numeric codes (some browsers don't work with the symbolic names).
- */
-$htmlin = array("’", ">", """, "′", "&", "\"",
"'", "`", "‘");
-$htmlout = array("’", ">", """ , "′", "&", """,
"′", "’", "‘");
-function fix($a) {
- global $htmlin;
- global $htmlout;
- return str_replace($htmlin, $htmlout, $a);
-}
-
-// *************************************************
-// i18nHTML configuration API functions
-// *************************************************
-
-// change the marker text shown to indicate text
-// is translatable (link to translate page text)
-function setTranslateLinkMarker($marker) {
- global $i18nHTMLmarker;
-
- if ($marker == "")
- $i18nHTMLmarker = "*"; // reset to default value
- else
- $i18nHTMLmarker = $marker;
-}
-
-// ***************************************************
-// i18nHTML _internal_ API functions (don't look here)
-// ***************************************************
-
-// returns a HTML string to link to enable one to translate the given
-// text ($a) when $editor has a nonzero value or
-// $i18nHTMLhasTranslation is 0; otherwise and empty string ("") is
-// returned.
-function translateLink_($a) {
- global $lang;
- global $HTTP_SERVER_VARS;
- global $editor;
- global $i18nHTMLhasTranslation;
- global $i18nHTMLmarker;
- global $i18nHTMLbase;
-
- if ($hasTranslation == "")
- $hasTranslation = $i18nHTMLhasTranslation;
- if ( ($editor) || ($i18nHTMLhasTranslation == 0) ) {
- $back = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] .
$HTTP_SERVER_VARS["REQUEST_URI"];
- return "<a href=\"" . $i18nHTMLbase . "translate.php?xlang="
- . $lang
- . "&text=" . urlencode(fix($a))
- . "&back=" . urlencode($back)
- . "\">" . $i18nHTMLmarker . "</a>\n";
- } else
- return "";
-}
-
-// displays a link to the page to enable one to
-// translate the given text ($a)
-// see translateLink_
-function translateLink($a) {
- echo translateLink_($a);
-}
-
-/**
- * transcode unicode entities to/from HTML entities
- *
- * Also, this function transforms HTML entities into their equivalent Unicode
entities.
- * For example, w.bloggar posts pages using HTML entities.
- * If you have to modify these pages using web forms, you would like to get
UTF-8 instead.
- *
- * @link
http://www.evolt.org/article/A_Simple_Character_Entity_Chart/17/21234/ A Simple
Character Entity Chart
- *
- * @param string the string to be transcoded
- * @param boolean TRUE to transcode to Unicode, FALSE to transcode to HTML
- * @return a transcoded string
- */
-function transcode($input, $to_unicode=TRUE) {
- // initialize tables only once
- static $html_entities, $unicode_entities;
- if(!is_array($html_entities)) {
-
-
- // numerical order
- $codes = array(
- ' ' => ' ', // non-breaking space
- '¡' => '¡', // inverted exclamation mark
- '¢' => '¢', // cent sign
- '£' => '£', // pound sign
- '¤' => '¤', // currency sign
- '¥' => '¥', // yen sign
- '¦' => '¦', // broken bar
- '§' => '§', // section sign
- '¨' => '¨', // diaeresis
- '©' => '©', // copyright sign
- 'ª' => 'ª', // feminine ordinal indicator
- '«' => '«', // left-pointing double angle
quotation mark
- '¬' => '¬', // not sign
- '­' => '­', // soft hyphen
- '®' => '®', // registered sign
- '¯' => '¯', // macron
- '°' => '°', // degree sign
- '±' => '±', // plus-minus sign
- '²' => '²', // superscript two
- '³' => '³', // superscript three
- '´' => '´', // acute accent
- 'µ' => 'µ', // micro sign
- '¶' => '¶', // pilcrow sign
- '·' => '·', // middle dot
- '¸' => '¸', // cedilla
- '¹' => '¹', // superscript one
- 'º' => 'º', // masculine ordinal indicator
- '»' => '»', // right-pointing double angle
quotation mark
- '¼' => '¼', // vulgar fraction one quarter
- '½' => '½', // vulgar fraction one half
- '¾' => '¾', // vulgar fraction three
quarters
- '¿' => '¿', // inverted question mark
- 'À' => 'À', // latin capital letter A with
grave
- 'Á' => 'Á', // latin capital letter A with
acute
- 'Â' => 'Â', // latin capital letter A with
circumflex
- 'Ã' => 'Ã', // latin capital letter A with
tilde
- 'Ä' => 'Ä', // latin capital letter A with
diaeresis
- 'Å' => 'Å', // latin capital letter A with
ring above
- 'Æ' => 'Æ', // latin capital letter AE
- 'Ç' => 'Ç', // latin capital letter C with
cedilla
- 'È' => 'È', // latin capital letter E with
grave
- 'É' => 'É', // latin capital letter E with
acute
- 'Ê' => 'Ê', // latin capital letter E with
circumflex
- 'Ë' => 'Ë', // latin capital letter E with
diaeresis
- 'Ì' => 'Ì', // latin capital letter I with
grave
- 'Í' => 'Í', // latin capital letter I with
acute
- 'Î' => 'Î', // latin capital letter I with
circumflex
- 'Ï' => 'Ï', // latin capital letter I with
diaeresis
- 'Ð' => 'Ð', // latin capital letter
ETH
- 'Ñ' => 'Ñ', // latin capital letter N with
tilde
- 'Ò' => 'Ò', // latin capital letter O with
grave
- 'Ó' => 'Ó', // latin capital letter O with
acute
- 'Ô' => 'Ô', // latin capital letter O with
circumflex
- 'Õ' => 'Õ', // latin capital letter O with
tilde
- 'Ö' => 'Ö', // latin capital letter O with
diaeresis
- '×' => '×', // multiplication sign
- 'Ø' => 'Ø', // latin capital letter O with
stroke
- 'Ù' => 'Ù', // latin capital letter U with
grave
- 'Ú' => 'Ú', // latin capital letter U with
acute
- 'Û' => 'Û', // latin capital letter U with
circumflex
- 'Ü' => 'Ü', // latin capital letter U with
diaeresis
- 'Ý' => 'Ý', // latin capital letter Y with
acute
- 'Þ' => 'Þ', // latin capital letter THORN
- 'ß' => 'ß', // latin small letter sharp s
- 'à' => 'à', // latin small letter a with
grave
- 'á' => 'á', // latin small letter a with
acute
- 'â' => 'â', // latin small letter a with
circumflex
- 'ã' => 'ã', // latin small letter a with
tilde
- 'ä' => 'ä', // latin small letter a with
diaeresis
- 'å' => 'å', // latin small letter a with
ring above
- 'æ' => 'æ', // latin small letter ae
- 'ç' => 'ç', // latin small letter c with
cedilla
- 'è' => 'è', // latin small letter e with
grave
- 'é' => 'é', // latin small letter e with
acute
- 'ê' => 'ê', // latin small letter e with
circumflex
- 'ë' => 'ë', // latin small letter e with
diaeresis
- 'ì' => 'ì', // latin small letter i with
grave
- 'í' => 'í', // latin small letter i with
acute
- 'î' => 'î', // latin small letter i with
circumflex
- 'ï' => 'ï', // latin small letter i with
diaeresis
- 'ð' => 'ð', // latin small letter
eth
- 'ñ' => 'ñ', // latin small letter n with
tilde
- 'ò' => 'ò', // latin small letter o with
grave
- 'ó' => 'ó', // latin small letter o with
acute
- 'ô' => 'ô', // latin small letter o with
circumflex
- 'õ' => 'õ', // latin small letter o with
tilde
- 'ö' => 'ö', // latin small letter o with
diaeresis
- '÷' => '÷', // division sign
- 'ø' => 'ø', // latin small letter o with
stroke
- 'ù' => 'ù', // latin small letter u with
grave
- 'ú' => 'ú', // latin small letter u with
acute
- 'û' => 'û', // latin small letter u with
circumflex
- 'ü' => 'ü', // latin small letter u with
diaeresis
- 'ý' => 'ý', // latin small letter y with
acute
- 'þ' => 'þ', // latin small letter thorn
- 'ÿ' => 'ÿ', //
- 'Œ' => 'Œ', // latin capital ligature OE
- 'œ' => 'œ', // latin small ligature oe
- 'Š' => 'Š', // latin capital letter S with
caron
- 'š' => 'š', // latin small letter s with
caron
- 'Ÿ' => 'Ÿ', // latin capital letter Y with
diaeresis
- 'ƒ' => 'ƒ' , // latin small f with hook
- 'ˆ' => 'ˆ', // modifier letter circumflex
accent
- '˜' => '˜', // small tilde
- 'Α' => 'Α', // greek capital letter alpha
- 'Β' => 'Β', // greek capital letter beta
- 'Γ' => 'Γ', // greek capital letter gamma
- 'Δ' => 'Δ', // greek capital letter delta
- 'Ε' => 'Ε', // greek capital letter epsilon
- 'Ζ' => 'Ζ', // greek capital letter zeta
- 'Η' => 'Η', // greek capital letter
eta
- 'Θ' => 'Θ', // greek capital letter theta
- 'Ι' => 'Ι', // greek capital letter iota
- 'Κ' => 'Κ', // greek capital letter kappa
- 'Λ' => 'Λ', // greek capital letter lambda
- 'Μ' => 'Μ', // greek capital letter
mu
- 'Ν' => 'Ν', // greek capital letter
nu
- 'Ξ' => 'Ξ', // greek capital letter
xi
- 'Ο' => 'Ο', // greek capital letter omicron
- 'Π' => 'Π', // greek capital letter
pi
- 'Ρ' => 'Ρ', // greek capital letter
rho
- 'Σ' => 'Σ', // greek capital letter sigma
- 'Τ' => 'Τ', // greek capital letter
tau
- 'Υ' => 'Υ', // greek capital letter upsilon
- 'Φ' => 'Φ', // greek capital letter
phi
- 'Χ' => 'Χ', // greek capital letter
chi
- 'Ψ' => 'Ψ', // greek capital letter
psi
- 'Ω' => 'Ω', // greek capital letter omega
- 'α' => 'α', // greek small letter alpha
- 'β' => 'β', // greek small letter beta
- 'γ' => 'γ', // greek small letter gamma
- 'δ' => 'δ', // greek small letter delta
- 'ε' => 'ε', // greek small letter epsilon
- 'ζ' => 'ζ', // greek small letter zeta
- 'η' => 'η', // greek small letter
eta
- 'θ' => 'θ', // greek small letter theta
- 'ι' => 'ι', // greek small letter iota
- 'κ' => 'κ', // greek small letter kappa
- 'λ' => 'λ', // greek small letter lambda
- 'μ' => 'μ', // greek small letter mu
- 'ν' => 'ν', // greek small letter nu
- 'ξ' => 'ξ', // greek small letter xi
- 'ο' => 'ο', // greek small letter omicron
- 'π' => 'π', // greek small letter pi
- 'ρ' => 'ρ', // greek small letter
rho
- 'ς' => 'ς', // greek small letter final
sigma
- 'σ' => 'σ', // greek small letter sigma
- 'τ' => 'τ', // greek small letter
tau
- 'υ' => 'υ', // greek small letter upsilon
- 'φ' => 'φ', // greek small letter
phi
- 'χ' => 'χ', // greek small letter
chi
- 'ψ' => 'ψ', // greek small letter
psi
- 'ω' => 'ω', // greek small letter omega
- 'ϑ' => 'ϑ', // greek small letter
theta symbol
- 'ϒ' => 'ϒ', // greek upsilon with hook
symbol
- 'ϖ' => 'ϖ', // greek pi symbol
- ' ' => ' ', // en space
- ' ' => ' ', // em space
- ' ' => ' ', // thin space
- '‌' => '‌', // zero width non-joiner
- '‍' => '‍', // zero width joiner
- '‎' => '‎', // left-to-right mark
- '‏' => '‏', // right-to-left mark
- '–' => '–', // en dash
- '—' => '—', // em dash
- '‘' => '‘', // left single quotation mark
- '’' => '’', // right single quotation mark
- '‚' => '‚', // single low-9 quotation mark
- '“' => '“', // left double quotation mark
- '”' => '”', // right double quotation mark
- '„' => '„', // double low-9 quotation mark
- '†' => '†', // dagger
- '‡' => '‡', // double dagger
- '•' => '•', // bullet
- '…' => '…', // horizontal ellipsis
- '‰' => '‰', // per mille sign
- '′' => '′', // primeminutes
- '″' => '″', // double prime
- '‹' => '‹', // single left-pointing angle
quotation mark
- '›' => '›', // single right-pointing angle
quotation mark
- '‾' => '‾', // overline
- '⁄' => '⁄', // fraction slash
- '€' => '€', // euro sign
- 'ℑ' => 'ℑ', // blackletter capital I
- '℘' => '℘', // script capital P
- 'ℜ' => 'ℜ', // blackletter capital R
- '™' => '™', // trade mark sign
- 'ℵ' => 'ℵ', // alef symbol
- '←' => '←', // leftwards arrow
- '↑' => '↑', // upwards arrow
- '→' => '→', // rightwards arrow
- '↓' => '↓', // downwards arrow
- '↔' => '↔', // left right arrow
- '↵' => '↵', // downwards arrow with corner
leftwards
- '⇐' => '⇐', // leftwards double arrow
- '⇑' => '⇑', // upwards double arrow
- '⇒' => '⇒', // rightwards double arrow
- '⇓' => '⇓', // downwards double arrow
- '⇔' => '⇔', // left right double arrow
- '∀' => '∀', // for all
- '∂' => '∂', // partial differential
- '∃' => '∃', // there exists
- '∅' => '∅', // empty set
- '∇' => '∇', // nabla
- '∈' => '∈', // element of
- '∉' => '∉', // not an element of
- '∋' => '∋', // contains as member
- '∏' => '∏', // n-ary product
- '∑' => '∑', // n-ary sumation
- '−' => '−', // minus sign
- '∗' => '∗', // asterisk operator
- '√' => '√', // square root
- '∝' => '∝', // proportional to
- '∞' => '∞', // infinity
- '∠' => '∠', // angle
- '∧' => '∧', // logical and
- '∨' => '∨', // logical or
- '∩' => '∩', // intersection
- '∪' => '∪', // union
- '∫' => '∫', // integral
- '∴' => '∴', // therefore
- '∼' => '∼', // tilde operator
- '≅' => '≅', // approximately equal to
- '≈' => '≈', // almost equal to
- '≠' => '≠', // not equal to
- '≡' => '≡', // identical to
- '≤' => '≤', // less-than or equal to
- '≥' => '≥', // greater-than or
equal to
- '⊂' => '⊂', // subset of
- '⊃' => '⊃', // superset of
- '⊄' => '⊄', // not a subset of
- '⊆' => '⊆', // subset of or equal to
- '⊇' => '⊇', // superset of or equal to
- '⊕' => '⊕', // circled plus
- '⊗' => '⊗', // circled times
- '⊥' => '⊥', // up tack
- '⋅' => '⋅', // dot operator
- '⌈' => '⌈', // left ceiling
- '⌉' => '⌉', // right ceiling
- '⌊' => '⌊', // left floor
- '⌋' => '⌋', // right floor
- '〈' => '⟨', // left-pointing angle bracket
- '〉' => '⟩', // right-pointing angle bracket
- '◊' => '◊', // lozenge
- '♠' => '♠', // black spade suit
- '♣' => '♣', // black club suit
- '♥' => '♥', // black heart suit
- '♦' => '♦' // black diam suit
- );
-
- // split entities for use in str_replace()
- foreach($codes as $unicode_entity => $html_entity) {
- $unicode_entities[] = $unicode_entity;
- $html_entities[] = $html_entity;
- }
- }
- // transcode HTML entities to Unicode
- if($to_unicode)
- return str_replace($html_entities, $unicode_entities, $input);
-
- // transcode Unicode entities to HTML entities
- else
- return str_replace($unicode_entities, $html_entities, $input);
-}
-
-/**
- * transcode multi-byte characters to HTML representations for Unicode
- *
- * This function is aiming to preserve Unicode characters through storage in a
ISO-8859-1 compliant system.
- *
- * Every multi-byte UTF-8 character is transformed to its equivalent HTML
numerical entity (eg, &#4568;)
- * that may be handled safely by PHP and by MySQL.
- *
- * Of course, this solution does not allow for full-text search in the
database and therefore, is not a
- * definitive solution to internationalization issues.
- * It does enable, however, practical use of Unicode to build pages in foreign
languages.
- *
- * Also, this function transforms HTML entities into their equivalent Unicode
entities.
- * For example, w.bloggar posts pages using HTML entities.
- * If you have to modify these pages using web forms, you would like to get
UTF-8 instead.
- *
- * @link
http://www.evolt.org/article/A_Simple_Character_Entity_Chart/17/21234/ A Simple
Character Entity Chart
- *
- * @param string the original UTF-8 string
- * @return a string acceptable in an ISO-8859-1 storage system (ie., PHP4 +
MySQl 3)
- */
-function to_unicode($input) {
- // transcode HTML entities to Unicode entities
- $input = transcode($input);
- // scan the whole string
- $output = '';
- $index = 0;
- while($index < strlen($input)) {
- // look at one char
- $char = ord($input[$index]);
- // one byte (0xxxxxxx)
- if ($char < 0x80) {
- // some chars may be undefined
- $output .= chr($char);
- $index += 1;
- // two bytes (110xxxxx 10xxxxxx)
- } else if ($char < 0xE0) {
- // strip weird sequences (eg, C0 80 -> NUL)
- if($value = (($char % 0x20) * 0x40) + (ord($input[$index + 1]) % 0x40))
- $output .= '&#' . $value . ';';
- $index += 2;
- // three bytes (1110xxxx 10xxxxxx 10xxxxxx) example: euro sign =
\xE2\x82\xAC -> €
- } else if ($char < 0xF0) {
- // strip weird sequences
- if($value = (($char % 0x10) * 0x1000) + ((ord($input[$index + 1]) %
0x40) * 0x40) + (ord($input[$index + 2]) % 0x40))
- $output .= '&#' . $value . ';';
- $index += 3;
- // four bytes (11110xxx 10xxxxxx 10xxxxxx 10xxxxxx)
- } else if($char < 0xF8) {
- // strip weird sequences
- if ($value = (($char % 0x08) * 0x40000) + ((ord($input[$index + 1]) %
0x40) * 0x1000) + ((ord($input[$index + 2]) % 0x40) * 0x40)
- + (ord($input[$index + 3]) % 0x40))
- $output .= '&#' . $value . ';';
- $index += 4;
- // five bytes (111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx)
- } else if($char < 0xFC) {
- // strip weird sequences
- if ($value = (($char % 0x04) * 0x1000000) + ((ord($input[$index + 1]) %
0x40) * 0x40000) + ((ord($input[$index + 2]) % 0x40) * 0x1000)
- + ((ord($input[$index + 3]) % 0x40) * 0x40) + (ord($input[$index + 4])
% 0x40))
- $output .= '&#' . $value . ';';
- $index += 5;
- // six bytes (1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx)
- } else {
- // strip weird sequences
- if ($value = (($char % 0x02) * 0x40000000) + ((ord($input[$index + 1]) %
0x40) * 0x1000000) + ((ord($input[$index + 2]) % 0x40) * 0x40000)
- + ((ord($input[$index + 3]) % 0x40) * 0x1000) + ((ord($input[$index +
4]) % 0x40) * 0x40) + (ord($input[$index + 4]) % 0x40))
- $output .= '&#' . $value . ';';
- $index += 6;
- }
- }
- // return the translated string
- return $output;
-}
-
-// returns either the translated string or the original string.
-// Assumes we are passed the original string as occurs in text; result
-// will be html tokenized by htmlentities() using UTF8.
-// $i18nHTMLhasTranslation is set to nonzero value if a translation is
-// available or failure connecting to database, otherwise it is set to
-// 0.
-function translation_query($a) {
- global $connection;
- global $lang;
- global $i18nHTMLrecordMode;
- global $i18nHTMLhasTranslation;
-
- $i18nHTMLhasTranslation = 1; // assume translation until failure
-
- if ($a == "")
- return $a;
- $a = fix($a);
- $a_sql = mysql_real_escape_string($a);
- if (!$connection) {
- // database not available, just print English
- return $a;
- }
-
- /* // uncomment to selectively clone DB
- $fp = fopen("/tmp/clone.sql", "a+", 0);
- $query = "SELECT * FROM map WHERE name=\"$a_sql\" ORDER BY ranking DESC";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_num_rows($result);
- $last = "English";
- for ($i=0;$i<$num;$i++) {
- $row = mysql_fetch_array($result);
- if ($last != mysql_real_escape_string($row["lang"])) {
- $last = mysql_real_escape_string($row["lang"]);
- $trans = mysql_real_escape_string($row["translation"]);
- $rank = $row["ranking"];
- $ip = $row["ip"];
- fputs($fp, "INSERT INTO map VALUES(\"$a_sql\", \"$last\", \"$trans\",
$rank, \"$ip\");\n");
- }
- }
- */
-
- if ("English" == $lang) {
- // no need to translate english, that's the
- // hard-wired source language!
- if ($i18nHTMLrecordMode == 2) {
- // if not already in pending table (and recordMode set to allow us)
- // then insert this string into it
- $query = "SELECT count FROM pending WHERE c=\"$a_sql\" AND
lang=\"$lang\"";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_num_rows($result);
- if (0 == $num) {
- $query = "INSERT INTO pending VALUES(\"$a_sql\", \"$lang\", 0)";
- mysql_query($query, $connection);
- }
- }
- return $a;
- }
- // attempt to get translations, ranked for best
- $query = "SELECT translation FROM map WHERE name=\"$a_sql\" AND
lang=\"$lang\" ORDER BY ranking DESC";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_num_rows($result);
- if (0 == $num) { // didn't find a translation
- if ($i18nHTMLrecordMode > 0) {
- // either insert untranslated item into pending table or update
- // referenced count; count is used to display more used strings
- // during mass translation before less common ones.
- $query = "SELECT count FROM pending WHERE c=\"$a_sql\" AND
lang=\"$lang\"";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_numrows($result);
- $count = 0;
- if ($num > 0) {
- $row = mysql_fetch_array($result);
- $count = $row["count"] + 1;
- $query = "UPDATE pending SET count=$count WHERE c=\"$a_sql\" AND
lang=\"$lang\"";
- } else {
- $query = "INSERT INTO pending VALUES(\"$a_sql\", \"$lang\", 1)";
- }
- mysql_query($query, $connection);
-
- }
- $i18nHTMLhasTranslation = 0; // no translation was found
- return $a; // just return English string
- } else { // translation available
-
- $row = mysql_fetch_array($result);
- return $row["translation"];
- }
-}
-
-// *************************************************
-// Fundamental i18nHTML API functions
-// *************************************************
-
-// translate the sentence $a and return the result.
-function TRANSLATE_($a,$args=null) {
- if ($a == "")
- return 0;
- return vsprintf(translation_query($a), $args);
-}
-
-// translate the sentence $a and output just
-// the translated text (without link to translate.php)
-function TRANSLATE($a,$args=null) {
- echo TRANSLATE_($a);
-}
-
-// translate the sentence $a adding a link
-// to enable editing translations and return the result.
-function W_($a,$args=null) {
- if ($a == "")
- return 0;
- return TRANSLATE_($a,$args) . translateLink_($a);
-}
-
-// translate the sentence $a appending a link
-// to enable edit the translation and output the
-// result.
-function W($a, $args=NULL) {
- if ($a != "")
- echo W_($a, $args) . "\n";
-}
-
-// create internationalized, internal link to
-// $a.php with description $b
-function intlink_($a, $b) {
- global $lang;
-
- $ret = "<a href=\"" . $a . "?xlang=" . $lang . "\">" . TRANSLATE_($b) .
"</a>";
- $ret = $ret . translateLink_($b);
- return $ret;
-}
-
-// create internationalized, internal link to
-// $a.php with description $b
-function intlink($a, $b) {
- echo intlink_($a, $b);
-}
-
-// create internationalized, external link to
-// $a with description $b
-function extlink_($a, $b) {
- $ret = "<a href=\"" . $a . "\">" . TRANSLATE_($b) . "</a>" .
translateLink_($b);
- return $ret;
-}
-
-// create internationalized, external link to
-// $a with description $b
-function extlink($a, $b) {
- echo extlink_($a, $b);
-}
-
-
-// *************************************************
-// global, call-once helper functions
-// *************************************************
-
-// outputs appropriate DOCTYPE declaration for the document
-// this should be the 1st line in your php file after including
-// i18nhtml.inc. Valid types are: HTML for HTML 4 documents,
-// XHTML1 for xhtml 1.0 documents, and XHTML1.1 for xhtml 1.1
-// defaulting to HTML4 if $type is blank or unknown. An optional
-// $mode may be specified, it must be one of "Transitional",
-// "Strict", or "Frameset", defaulting to "Transitional".
-// Note for XHTML1.1 $mode is ignored.
-// example:
-// include("i18nhtml.inc");
-// DOCTYPE("XHTML1");
-function DOCTYPE($type=null, $mode=null) {
- // depending on $mode, use appropriate dtd
- if ($mode == "Strict") {
- $dtd = "strict";
- if ($type != "XHTML1") // Strict not specified except for XHTML1.0
- $mode = "";
- } else if ($mode == "Frameset") {
- $dtd = "frameset";
- } else { // $mode == Transitional, default, or unknown
- $dtd = "loose";
- $mode = "Transitional";
- }
- if ($type == "XHTML1")
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 " . $mode . "//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" . $dtd . ".dtd\">\n";
- else if ($type == "XHTML1.1")
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
- else
- echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " . $mode . "//EN\"
\"http://www.w3.org/TR/html4/" . $dtd . ".dtd\">\n";
-}
-
-function TITLE($a,$b="") {
- global $lang;
- global $languagecodes;
- echo "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"
>";
- echo "<title>" . TRANSLATE_($a,$b) . "</title>\n";
- if (isset($languagecodes[$lang])) {
- echo "<meta name=\"content-language\" content=\"" .
- $languagecodes[$lang] . "\">";
- echo "<meta name=\"language\" content=\"" .
- $languagecodes[$lang] . "\">";
- }
-}
-
-// displays a list of all languages currently available with
-// at least 1 translated string.
-function generateLanguageBar() {
- global $connection;
-
- if ($connection) {
- echo "<center>[";
- $query = "SELECT DISTINCT lang FROM map ORDER BY lang";
- $result = mysql_query($query, $connection);
- $num = 0;
- if ($result)
- $num = mysql_numrows($result);
- echo "<a href=\"?xlang=English\">";
- W("English");
- echo "</a>";
- $last = "English";
- for ($i=0;$i<$num;$i++) {
- $row = mysql_fetch_array($result);
- $next = $row["lang"];
- if ($next == $last)
- continue;
- echo " | ";
- echo "<a href=\"?xlang=$next\">" . W_($next) . "</a>";
- $last = $next;
- }
- echo "]</center>";
- }
-}
-
-
-// displays text at the bottom of the page to indicate
-// translation mode (including link to active) and
-// copyright notice for i18nHTML.
-function generateFooter() {
- global $xlang;
- global $editor;
- global $HTTP_SERVER_VARS;
-
- P();
- echo "Translation engine based on <a
href=\"http://gnunet.org/i18nHTML/\">i18nHTML</a> (C) 2003, 2004, 2005
Christian Grothoff.<br />\n";
- if ( ($xlang) && ($xlang != "English") ) {
- $back = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] .
$HTTP_SERVER_VARS["REQUEST_URI"];
- echo "<center><small>\n";
- if ($editor != 1)
- echo " <a href=\"$back&editor=1\">" . W_("enter translation mode") .
"</a>";
- else
- W(" Translation Mode Active (for this page only)");
- echo "</small></center>\n";
- }
- echo "</p>\n";
-}
-
-// *************************************************
-// HTML construct helper functions
-// *************************************************
-
-function LI($a,$b="") {
- echo "<li>" . W_($a,$b) . "</li>\n";
-}
-function TH($a,$b="") {
- echo "<th>" . W_($a,$b) . "</th>\n";
-}
-function TD($a,$b="") {
- echo "<td>" . W_($a,$b) . "</td>\n";
-}
-function DT($a,$b="") {
- echo "<dt>" . W_($a,$b) . "</dt>\n";
-}
-function DD($a,$b="") {
- echo "<dd>" . W_($a,$b) . "</dd>\n";
-}
-function H1($a,$b="") {
- echo "<h1>" . W_($a,$b) . "</h1>\n";
-}
-function H2($a,$b="") {
- echo "<h2>" . W_($a,$b) . "</h2>\n";
-}
-function H3($a,$b="") {
- echo "<h3>" . W_($a,$b) . "</h3>\n";
-}
-function H4($a,$b="") {
- echo "<h4>" . W_($a,$b) . "</h4>\n";
-}
-function H5($a,$b="") {
- echo "<h5>" . W_($a,$b) . "</h5>\n";
-}
-function PRE($a) {
- echo "<pre>" . $a . "</pre>";
-}
-// 'verbatim' (untranslated) "li"
-function LIV($a) {
- echo "<li>" . $a . "</li>\n";
-}
-function P($attr="") {
- echo "<p $attr>\n";
-}
-function BR() {
- echo "<br />\n";
-}
-function HR() {
- echo "<hr>\n";
-}
-function DTDD($a,$b) {
- DT($a);
- DD($b);
-}
-function LILI($a,$b) {
- echo "<li>" . extlink_($a,$b) . "</li>\n";
-}
-function ANCHOR($a) {
- echo "<a name=\"$a\"></a>\n";
-}
-function IMG_($src, $alt, $align="CENTER", $width, $height, $border=0,
$hspace=0, $vspace=0) {
- $ret = "";
-
- if ($align == "CENTER")
- $ret = $ret . "<p><center>\n";
- $ret = $ret . "<img src=\"" . $src . "\" alt=\"";
- $ret = $ret . TRANSLATE_($alt);
- $ret = $ret . "\" align=\"" . $align . "\" width=$width height=$height
border=$border hspace=$hspace vspace=$vspace>\n";
- $ret = $ret . translateLink_($alt);
- if ($align == "CENTER")
- $ret = $ret . "</center><p>\n";
- return $ret;
-}
-function IMG($src, $alt, $align="CENTER", $width, $height, $border=0,
$hspace=0, $vspace=0) {
- echo IMG_($src, $alt, $align, $width, $height, $border, $hspace, $vspace);
-}
-
-?>
\ No newline at end of file
Added: GNUnet-docs/WWW/i18nhtml.inc.php
===================================================================
--- GNUnet-docs/WWW/i18nhtml.inc.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/i18nhtml.inc.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,885 @@
+<?php
+/*
+ (C) 2003, 2004, 2005 Christian Grothoff and other contributing authors.
+
+ This code is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ The code is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with the code; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+ // This file defines the functions that will be used
+ // to build the webpage. The set may not contain everything
+ // you might want, so feel free to define your own extensions.
+
+ // Use W("text") to output translations.
+ // $lang/xlang are used to specify the language
+ // $editor can be set to create a translation
+ // tag even if a translation is already available.
+ // there is currently no security.
+ //
+ // An "_" is used for functions that return the
+ // translated string instead of printing it directly.
+ // These functions are used for "%s" printing with W().
+ //
+ // Most of the code should be straight forward. Look
+ // at some of the example files that use it and compare with
+ // the generated pages.
+// obtain user db specific configuration parameters
+include("i18nhtml_config.inc.php");
+header("Content-type: text/html; charset=utf-8");
+
+// if (get_magic_quotes_gpc())
+// die('PHP misconfigured. Disable get_magic_quotes.');
+
+// establish default connection to database server
+$connection = @mysql_connect($i18nHTMLsqlServer,
+ $i18nHTMLsqlUser,
+ $i18nHTMLsqlPass);
+if (!$connection) {
+ die ('Failure connecting to ' . $i18nHTMLsqlServer . ' : ' . mysql_error());
+}
+
+// and select database on server that holds translations
+if ($connection) {
+ $db_selected = mysql_select_db($i18nHTMLsqlDB,
+ $connection);
+ if (!$db_selected) {
+ die ('Error selecting db : ' . mysql_error());
+ }
+}
+
+// ensure the mapping and pending tables exist, creating them if not
+$query="CREATE TABLE IF NOT EXISTS ".$i18nHTMLsqlPrefix."map" .
+ " (name BLOB, lang TINYBLOB, translation BLOB, ranking INT, ip
TINYTEXT, " .
+ "INDEX(name(10)), INDEX(lang(4)), INDEX(ranking),
INDEX(translation(10)))";
+$result = mysql_query($query, $connection);
+if (($i18nHTMLdebug == 1) && (!$result)) {
+ die('Unable to validate map table. Invalid query: ' . mysql_error());
+}
+
+$query="CREATE TABLE IF NOT EXISTS ".$i18nHTMLsqlPrefix."pending" .
+ " (c BLOB, lang TINYBLOB, count INT, " .
+ "INDEX(c(10)), INDEX(lang(4)), INDEX(count))";
+$result = mysql_query($query, $connection);
+if (($i18nHTMLdebug == 1) && (!$result)) {
+ die('Unable to validate pending table. Invalid query: ' . mysql_error());
+}
+
+/* mapping of real-names to language codes */
+$languagecodes = array("English"=>"en",
+ "German"=>"de",
+ "French"=>"fr",
+ "Portuguese"=>"pt",
+ "Russian"=>"ru",
+ "Romanian"=>"ro",
+ "Spanish"=>"es",
+ "Italian"=>"it",
+ "Simplified chinese"=>"zh_CN",
+ "Catalan"=>"ca",
+ "Basque"=>"eu",
+ "Arabic"=>"ar",
+ "Bulgarian"=>"bg",
+ "Czech"=>"cs",
+ "Dutch"=>"nl",
+ "Esperanto"=>"eo",
+ "Hebrew"=>"he",
+ "Japanese"=>"ja",
+ "Norwegian"=>"no",
+ "Polish"=>"po",
+ "Ukrainian"=>"uk",
+ "Danish"=>"da",
+ "Swedish"=>"sv");
+
+/* try to automagically figure out user preferences */
+$hlang = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
+if ($hlang) {
+ $tok = strtok($hlang, ";");
+ while ($tok) {
+ foreach($languagecodes as $name=>$code) {
+ if (0 == strncmp($tok, $code, 2)) {
+ $lang = $name;
+ break 2;
+ }
+ }
+ $tok = strtok(";");
+ }
+}
+// If no language is specified, use english.
+if ( (! $lang) || ($lang=="") )
+ $lang = "English";
+$xlang = $_REQUEST['xlang'];
+if ($xlang)
+ $lang = $xlang;
+$lang = ucfirst(strtolower($lang));
+$lang = quote_smart($lang);
+$editor = $_REQUEST['editor'];
+$i18nHTMLhasTranslation = 0; // set by last call to translation_query()
+
+/**
+ * Replace certain HTML named special characters with their
+ * numeric codes (some browsers don't work with the symbolic names).
+ */
+$htmlin = array("’", ">", """, "′", "&", "\"",
"'", "`", "‘");
+$htmlout = array("’", ">", """ , "′", "&", """,
"′", "’", "‘");
+function fix($a) {
+ global $htmlin;
+ global $htmlout;
+ return str_replace($htmlin, $htmlout, $a);
+}
+
+// Quote variable to make safe from
+// http://fr.php.net/manual/en/function.mysql-real-escape-string.php
+function quote_smart($value)
+{
+ // Stripslashes
+ if (get_magic_quotes_gpc()) {
+ $value = stripslashes($value);
+ }
+ $value = mysql_real_escape_string($value);
+ return $value;
+}
+
+// *************************************************
+// i18nHTML configuration API functions
+// *************************************************
+
+// change the marker text shown to indicate text
+// is translatable (link to translate page text)
+function setTranslateLinkMarker($marker) {
+ global $i18nHTMLmarker;
+
+ if ($marker == "")
+ $i18nHTMLmarker = "*"; // reset to default value
+ else
+ $i18nHTMLmarker = $marker;
+}
+
+// ***************************************************
+// i18nHTML _internal_ API functions (don't look here)
+// ***************************************************
+
+// returns a HTML string to link to enable one to translate the given
+// text ($a) when $editor has a nonzero value or
+// $i18nHTMLhasTranslation is 0; otherwise and empty string ("") is
+// returned.
+function translateLink_($a) {
+ global $lang;
+ global $HTTP_SERVER_VARS;
+ global $editor;
+ global $i18nHTMLhasTranslation;
+ global $i18nHTMLmarker;
+ global $i18nHTMLbase;
+
+ if ($hasTranslation == "")
+ $hasTranslation = $i18nHTMLhasTranslation;
+ if ( ($editor) || ($i18nHTMLhasTranslation == 0) ) {
+ $back = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] .
$HTTP_SERVER_VARS["REQUEST_URI"];
+ return "<a href=\"" . $i18nHTMLbase . "translate.php?xlang="
+ . $lang
+ . "&text=" . urlencode(fix($a))
+ . "&back=" . urlencode($back)
+ . "\" title=\""
+ .fix($a)
+ ."\">" . $i18nHTMLmarker . "</a>\n";
+ } else
+ return "";
+}
+
+// displays a link to the page to enable one to
+// translate the given text ($a)
+// see translateLink_
+function translateLink($a) {
+ echo translateLink_($a);
+}
+
+/**
+ * transcode unicode entities to/from HTML entities
+ *
+ * Also, this function transforms HTML entities into their equivalent Unicode
entities.
+ * For example, w.bloggar posts pages using HTML entities.
+ * If you have to modify these pages using web forms, you would like to get
UTF-8 instead.
+ *
+ * @link
http://www.evolt.org/article/A_Simple_Character_Entity_Chart/17/21234/ A Simple
Character Entity Chart
+ *
+ * @param string the string to be transcoded
+ * @param boolean TRUE to transcode to Unicode, FALSE to transcode to HTML
+ * @return a transcoded string
+ */
+function transcode($input, $to_unicode=TRUE) {
+ // initialize tables only once
+ static $html_entities, $unicode_entities;
+ if(!is_array($html_entities)) {
+
+
+ // numerical order
+ $codes = array(
+ ' ' => ' ', // non-breaking space
+ '¡' => '¡', // inverted exclamation mark
+ '¢' => '¢', // cent sign
+ '£' => '£', // pound sign
+ '¤' => '¤', // currency sign
+ '¥' => '¥', // yen sign
+ '¦' => '¦', // broken bar
+ '§' => '§', // section sign
+ '¨' => '¨', // diaeresis
+ '©' => '©', // copyright sign
+ 'ª' => 'ª', // feminine ordinal indicator
+ '«' => '«', // left-pointing double angle
quotation mark
+ '¬' => '¬', // not sign
+ '­' => '­', // soft hyphen
+ '®' => '®', // registered sign
+ '¯' => '¯', // macron
+ '°' => '°', // degree sign
+ '±' => '±', // plus-minus sign
+ '²' => '²', // superscript two
+ '³' => '³', // superscript three
+ '´' => '´', // acute accent
+ 'µ' => 'µ', // micro sign
+ '¶' => '¶', // pilcrow sign
+ '·' => '·', // middle dot
+ '¸' => '¸', // cedilla
+ '¹' => '¹', // superscript one
+ 'º' => 'º', // masculine ordinal indicator
+ '»' => '»', // right-pointing double angle
quotation mark
+ '¼' => '¼', // vulgar fraction one quarter
+ '½' => '½', // vulgar fraction one half
+ '¾' => '¾', // vulgar fraction three
quarters
+ '¿' => '¿', // inverted question mark
+ 'À' => 'À', // latin capital letter A with
grave
+ 'Á' => 'Á', // latin capital letter A with
acute
+ 'Â' => 'Â', // latin capital letter A with
circumflex
+ 'Ã' => 'Ã', // latin capital letter A with
tilde
+ 'Ä' => 'Ä', // latin capital letter A with
diaeresis
+ 'Å' => 'Å', // latin capital letter A with
ring above
+ 'Æ' => 'Æ', // latin capital letter AE
+ 'Ç' => 'Ç', // latin capital letter C with
cedilla
+ 'È' => 'È', // latin capital letter E with
grave
+ 'É' => 'É', // latin capital letter E with
acute
+ 'Ê' => 'Ê', // latin capital letter E with
circumflex
+ 'Ë' => 'Ë', // latin capital letter E with
diaeresis
+ 'Ì' => 'Ì', // latin capital letter I with
grave
+ 'Í' => 'Í', // latin capital letter I with
acute
+ 'Î' => 'Î', // latin capital letter I with
circumflex
+ 'Ï' => 'Ï', // latin capital letter I with
diaeresis
+ 'Ð' => 'Ð', // latin capital letter
ETH
+ 'Ñ' => 'Ñ', // latin capital letter N with
tilde
+ 'Ò' => 'Ò', // latin capital letter O with
grave
+ 'Ó' => 'Ó', // latin capital letter O with
acute
+ 'Ô' => 'Ô', // latin capital letter O with
circumflex
+ 'Õ' => 'Õ', // latin capital letter O with
tilde
+ 'Ö' => 'Ö', // latin capital letter O with
diaeresis
+ '×' => '×', // multiplication sign
+ 'Ø' => 'Ø', // latin capital letter O with
stroke
+ 'Ù' => 'Ù', // latin capital letter U with
grave
+ 'Ú' => 'Ú', // latin capital letter U with
acute
+ 'Û' => 'Û', // latin capital letter U with
circumflex
+ 'Ü' => 'Ü', // latin capital letter U with
diaeresis
+ 'Ý' => 'Ý', // latin capital letter Y with
acute
+ 'Þ' => 'Þ', // latin capital letter THORN
+ 'ß' => 'ß', // latin small letter sharp s
+ 'à' => 'à', // latin small letter a with
grave
+ 'á' => 'á', // latin small letter a with
acute
+ 'â' => 'â', // latin small letter a with
circumflex
+ 'ã' => 'ã', // latin small letter a with
tilde
+ 'ä' => 'ä', // latin small letter a with
diaeresis
+ 'å' => 'å', // latin small letter a with
ring above
+ 'æ' => 'æ', // latin small letter ae
+ 'ç' => 'ç', // latin small letter c with
cedilla
+ 'è' => 'è', // latin small letter e with
grave
+ 'é' => 'é', // latin small letter e with
acute
+ 'ê' => 'ê', // latin small letter e with
circumflex
+ 'ë' => 'ë', // latin small letter e with
diaeresis
+ 'ì' => 'ì', // latin small letter i with
grave
+ 'í' => 'í', // latin small letter i with
acute
+ 'î' => 'î', // latin small letter i with
circumflex
+ 'ï' => 'ï', // latin small letter i with
diaeresis
+ 'ð' => 'ð', // latin small letter
eth
+ 'ñ' => 'ñ', // latin small letter n with
tilde
+ 'ò' => 'ò', // latin small letter o with
grave
+ 'ó' => 'ó', // latin small letter o with
acute
+ 'ô' => 'ô', // latin small letter o with
circumflex
+ 'õ' => 'õ', // latin small letter o with
tilde
+ 'ö' => 'ö', // latin small letter o with
diaeresis
+ '÷' => '÷', // division sign
+ 'ø' => 'ø', // latin small letter o with
stroke
+ 'ù' => 'ù', // latin small letter u with
grave
+ 'ú' => 'ú', // latin small letter u with
acute
+ 'û' => 'û', // latin small letter u with
circumflex
+ 'ü' => 'ü', // latin small letter u with
diaeresis
+ 'ý' => 'ý', // latin small letter y with
acute
+ 'þ' => 'þ', // latin small letter thorn
+ 'ÿ' => 'ÿ', //
+ 'Œ' => 'Œ', // latin capital ligature OE
+ 'œ' => 'œ', // latin small ligature oe
+ 'Š' => 'Š', // latin capital letter S with
caron
+ 'š' => 'š', // latin small letter s with
caron
+ 'Ÿ' => 'Ÿ', // latin capital letter Y with
diaeresis
+ 'ƒ' => 'ƒ' , // latin small f with hook
+ 'ˆ' => 'ˆ', // modifier letter circumflex
accent
+ '˜' => '˜', // small tilde
+ 'Α' => 'Α', // greek capital letter alpha
+ 'Β' => 'Β', // greek capital letter beta
+ 'Γ' => 'Γ', // greek capital letter gamma
+ 'Δ' => 'Δ', // greek capital letter delta
+ 'Ε' => 'Ε', // greek capital letter epsilon
+ 'Ζ' => 'Ζ', // greek capital letter zeta
+ 'Η' => 'Η', // greek capital letter
eta
+ 'Θ' => 'Θ', // greek capital letter theta
+ 'Ι' => 'Ι', // greek capital letter iota
+ 'Κ' => 'Κ', // greek capital letter kappa
+ 'Λ' => 'Λ', // greek capital letter lambda
+ 'Μ' => 'Μ', // greek capital letter
mu
+ 'Ν' => 'Ν', // greek capital letter
nu
+ 'Ξ' => 'Ξ', // greek capital letter
xi
+ 'Ο' => 'Ο', // greek capital letter omicron
+ 'Π' => 'Π', // greek capital letter
pi
+ 'Ρ' => 'Ρ', // greek capital letter
rho
+ 'Σ' => 'Σ', // greek capital letter sigma
+ 'Τ' => 'Τ', // greek capital letter
tau
+ 'Υ' => 'Υ', // greek capital letter upsilon
+ 'Φ' => 'Φ', // greek capital letter
phi
+ 'Χ' => 'Χ', // greek capital letter
chi
+ 'Ψ' => 'Ψ', // greek capital letter
psi
+ 'Ω' => 'Ω', // greek capital letter omega
+ 'α' => 'α', // greek small letter alpha
+ 'β' => 'β', // greek small letter beta
+ 'γ' => 'γ', // greek small letter gamma
+ 'δ' => 'δ', // greek small letter delta
+ 'ε' => 'ε', // greek small letter epsilon
+ 'ζ' => 'ζ', // greek small letter zeta
+ 'η' => 'η', // greek small letter
eta
+ 'θ' => 'θ', // greek small letter theta
+ 'ι' => 'ι', // greek small letter iota
+ 'κ' => 'κ', // greek small letter kappa
+ 'λ' => 'λ', // greek small letter lambda
+ 'μ' => 'μ', // greek small letter mu
+ 'ν' => 'ν', // greek small letter nu
+ 'ξ' => 'ξ', // greek small letter xi
+ 'ο' => 'ο', // greek small letter omicron
+ 'π' => 'π', // greek small letter pi
+ 'ρ' => 'ρ', // greek small letter
rho
+ 'ς' => 'ς', // greek small letter final
sigma
+ 'σ' => 'σ', // greek small letter sigma
+ 'τ' => 'τ', // greek small letter
tau
+ 'υ' => 'υ', // greek small letter upsilon
+ 'φ' => 'φ', // greek small letter
phi
+ 'χ' => 'χ', // greek small letter
chi
+ 'ψ' => 'ψ', // greek small letter
psi
+ 'ω' => 'ω', // greek small letter omega
+ 'ϑ' => 'ϑ', // greek small letter
theta symbol
+ 'ϒ' => 'ϒ', // greek upsilon with hook
symbol
+ 'ϖ' => 'ϖ', // greek pi symbol
+ ' ' => ' ', // en space
+ ' ' => ' ', // em space
+ ' ' => ' ', // thin space
+ '‌' => '‌', // zero width non-joiner
+ '‍' => '‍', // zero width joiner
+ '‎' => '‎', // left-to-right mark
+ '‏' => '‏', // right-to-left mark
+ '–' => '–', // en dash
+ '—' => '—', // em dash
+ '‘' => '‘', // left single quotation mark
+ '’' => '’', // right single quotation mark
+ '‚' => '‚', // single low-9 quotation mark
+ '“' => '“', // left double quotation mark
+ '”' => '”', // right double quotation mark
+ '„' => '„', // double low-9 quotation mark
+ '†' => '†', // dagger
+ '‡' => '‡', // double dagger
+ '•' => '•', // bullet
+ '…' => '…', // horizontal ellipsis
+ '‰' => '‰', // per mille sign
+ '′' => '′', // primeminutes
+ '″' => '″', // double prime
+ '‹' => '‹', // single left-pointing angle
quotation mark
+ '›' => '›', // single right-pointing angle
quotation mark
+ '‾' => '‾', // overline
+ '⁄' => '⁄', // fraction slash
+ '€' => '€', // euro sign
+ 'ℑ' => 'ℑ', // blackletter capital I
+ '℘' => '℘', // script capital P
+ 'ℜ' => 'ℜ', // blackletter capital R
+ '™' => '™', // trade mark sign
+ 'ℵ' => 'ℵ', // alef symbol
+ '←' => '←', // leftwards arrow
+ '↑' => '↑', // upwards arrow
+ '→' => '→', // rightwards arrow
+ '↓' => '↓', // downwards arrow
+ '↔' => '↔', // left right arrow
+ '↵' => '↵', // downwards arrow with corner
leftwards
+ '⇐' => '⇐', // leftwards double arrow
+ '⇑' => '⇑', // upwards double arrow
+ '⇒' => '⇒', // rightwards double arrow
+ '⇓' => '⇓', // downwards double arrow
+ '⇔' => '⇔', // left right double arrow
+ '∀' => '∀', // for all
+ '∂' => '∂', // partial differential
+ '∃' => '∃', // there exists
+ '∅' => '∅', // empty set
+ '∇' => '∇', // nabla
+ '∈' => '∈', // element of
+ '∉' => '∉', // not an element of
+ '∋' => '∋', // contains as member
+ '∏' => '∏', // n-ary product
+ '∑' => '∑', // n-ary sumation
+ '−' => '−', // minus sign
+ '∗' => '∗', // asterisk operator
+ '√' => '√', // square root
+ '∝' => '∝', // proportional to
+ '∞' => '∞', // infinity
+ '∠' => '∠', // angle
+ '∧' => '∧', // logical and
+ '∨' => '∨', // logical or
+ '∩' => '∩', // intersection
+ '∪' => '∪', // union
+ '∫' => '∫', // integral
+ '∴' => '∴', // therefore
+ '∼' => '∼', // tilde operator
+ '≅' => '≅', // approximately equal to
+ '≈' => '≈', // almost equal to
+ '≠' => '≠', // not equal to
+ '≡' => '≡', // identical to
+ '≤' => '≤', // less-than or equal to
+ '≥' => '≥', // greater-than or
equal to
+ '⊂' => '⊂', // subset of
+ '⊃' => '⊃', // superset of
+ '⊄' => '⊄', // not a subset of
+ '⊆' => '⊆', // subset of or equal to
+ '⊇' => '⊇', // superset of or equal to
+ '⊕' => '⊕', // circled plus
+ '⊗' => '⊗', // circled times
+ '⊥' => '⊥', // up tack
+ '⋅' => '⋅', // dot operator
+ '⌈' => '⌈', // left ceiling
+ '⌉' => '⌉', // right ceiling
+ '⌊' => '⌊', // left floor
+ '⌋' => '⌋', // right floor
+ '〈' => '⟨', // left-pointing angle bracket
+ '〉' => '⟩', // right-pointing angle bracket
+ '◊' => '◊', // lozenge
+ '♠' => '♠', // black spade suit
+ '♣' => '♣', // black club suit
+ '♥' => '♥', // black heart suit
+ '♦' => '♦' // black diam suit
+ );
+
+ // split entities for use in str_replace()
+ foreach($codes as $unicode_entity => $html_entity) {
+ $unicode_entities[] = $unicode_entity;
+ $html_entities[] = $html_entity;
+ }
+ }
+ // transcode HTML entities to Unicode
+ if($to_unicode)
+ return str_replace($html_entities, $unicode_entities, $input);
+
+ // transcode Unicode entities to HTML entities
+ else
+ return str_replace($unicode_entities, $html_entities, $input);
+}
+
+/**
+ * transcode multi-byte characters to HTML representations for Unicode
+ *
+ * This function is aiming to preserve Unicode characters through storage in a
ISO-8859-1 compliant system.
+ *
+ * Every multi-byte UTF-8 character is transformed to its equivalent HTML
numerical entity (eg, &#4568;)
+ * that may be handled safely by PHP and by MySQL.
+ *
+ * Of course, this solution does not allow for full-text search in the
database and therefore, is not a
+ * definitive solution to internationalization issues.
+ * It does enable, however, practical use of Unicode to build pages in foreign
languages.
+ *
+ * Also, this function transforms HTML entities into their equivalent Unicode
entities.
+ * For example, w.bloggar posts pages using HTML entities.
+ * If you have to modify these pages using web forms, you would like to get
UTF-8 instead.
+ *
+ * @link
http://www.evolt.org/article/A_Simple_Character_Entity_Chart/17/21234/ A Simple
Character Entity Chart
+ *
+ * @param string the original UTF-8 string
+ * @return a string acceptable in an ISO-8859-1 storage system (ie., PHP4 +
MySQl 3)
+ */
+function to_unicode($input) {
+ // transcode HTML entities to Unicode entities
+ $input = transcode($input);
+ // scan the whole string
+ $output = '';
+ $index = 0;
+ while($index < strlen($input)) {
+ // look at one char
+ $char = ord($input[$index]);
+ // one byte (0xxxxxxx)
+ if ($char < 0x80) {
+ // some chars may be undefined
+ $output .= chr($char);
+ $index += 1;
+ // two bytes (110xxxxx 10xxxxxx)
+ } else if ($char < 0xE0) {
+ // strip weird sequences (eg, C0 80 -> NUL)
+ if($value = (($char % 0x20) * 0x40) + (ord($input[$index + 1]) % 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 2;
+ // three bytes (1110xxxx 10xxxxxx 10xxxxxx) example: euro sign =
\xE2\x82\xAC -> €
+ } else if ($char < 0xF0) {
+ // strip weird sequences
+ if($value = (($char % 0x10) * 0x1000) + ((ord($input[$index + 1]) %
0x40) * 0x40) + (ord($input[$index + 2]) % 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 3;
+ // four bytes (11110xxx 10xxxxxx 10xxxxxx 10xxxxxx)
+ } else if($char < 0xF8) {
+ // strip weird sequences
+ if ($value = (($char % 0x08) * 0x40000) + ((ord($input[$index + 1]) %
0x40) * 0x1000) + ((ord($input[$index + 2]) % 0x40) * 0x40)
+ + (ord($input[$index + 3]) % 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 4;
+ // five bytes (111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx)
+ } else if($char < 0xFC) {
+ // strip weird sequences
+ if ($value = (($char % 0x04) * 0x1000000) + ((ord($input[$index + 1]) %
0x40) * 0x40000) + ((ord($input[$index + 2]) % 0x40) * 0x1000)
+ + ((ord($input[$index + 3]) % 0x40) * 0x40) + (ord($input[$index + 4])
% 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 5;
+ // six bytes (1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx)
+ } else {
+ // strip weird sequences
+ if ($value = (($char % 0x02) * 0x40000000) + ((ord($input[$index + 1]) %
0x40) * 0x1000000) + ((ord($input[$index + 2]) % 0x40) * 0x40000)
+ + ((ord($input[$index + 3]) % 0x40) * 0x1000) + ((ord($input[$index +
4]) % 0x40) * 0x40) + (ord($input[$index + 4]) % 0x40))
+ $output .= '&#' . $value . ';';
+ $index += 6;
+ }
+ }
+ // return the translated string
+ return $output;
+}
+
+// returns either the translated string or the original string.
+// Assumes we are passed the original string as occurs in text; result
+// will be html tokenized by htmlentities() using UTF8.
+// $i18nHTMLhasTranslation is set to nonzero value if a translation is
+// available or failure connecting to database, otherwise it is set to
+// 0.
+function translation_query($a) {
+ global $connection;
+ global $lang;
+ global $i18nHTMLrecordMode;
+ global $i18nHTMLhasTranslation, $i18nHTMLsqlPrefix;
+
+ $i18nHTMLhasTranslation = 1; // assume translation until failure
+
+ if ($a == "")
+ return $a;
+ $a = fix($a);
+ $a_sql = quote_smart($a);
+ if (!$connection) {
+ // database not available, just print English
+ return $a;
+ }
+
+ if ("English" == $lang) {
+ // no need to translate english, that's the
+ // hard-wired source language!
+ if ($i18nHTMLrecordMode == 2) {
+ // if not already in pending table (and recordMode set to allow us)
+ // then insert this string into it
+ $query = "SELECT count FROM ".$i18nHTMLsqlPrefix."pending WHERE
c=\"$a_sql\" AND lang=\"$lang\"";
+ $result = mysql_query($query, $connection);
+ $num = 0;
+ if ($result)
+ $num = mysql_num_rows($result);
+ if (0 == $num) {
+ $query = "INSERT INTO ".$i18nHTMLsqlPrefix."pending VALUES(\"$a_sql\",
\"$lang\", 0)";
+ mysql_query($query, $connection);
+ }
+ }
+ return $a;
+ }
+ // attempt to get translations, ranked for best
+ $query = "SELECT translation FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$a_sql\" AND lang=\"$lang\" ORDER BY ranking DESC";
+ $result = mysql_query($query, $connection);
+ $num = 0;
+ if ($result)
+ $num = mysql_num_rows($result);
+ if (0 == $num) { // didn't find a translation
+ if ($i18nHTMLrecordMode > 0) {
+ // either insert untranslated item into pending table or update
+ // referenced count; count is used to display more used strings
+ // during mass translation before less common ones.
+ $query = "SELECT count FROM ".$i18nHTMLsqlPrefix."pending WHERE
c=\"$a_sql\" AND lang=\"$lang\"";
+ $result = mysql_query($query, $connection);
+ $num = 0;
+ if ($result)
+ $num = mysql_numrows($result);
+ $count = 0;
+ if ($num > 0) {
+ $row = mysql_fetch_array($result);
+ $count = $row["count"] + 1;
+ $query = "UPDATE ".$i18nHTMLsqlPrefix."pending SET count=$count WHERE
c=\"$a_sql\" AND lang=\"$lang\"";
+ } else {
+ $query = "INSERT INTO ".$i18nHTMLsqlPrefix."pending VALUES(\"$a_sql\",
\"$lang\", 1)";
+ }
+ mysql_query($query, $connection);
+
+ }
+ $i18nHTMLhasTranslation = 0; // no translation was found
+ return $a; // just return English string
+ } else { // translation available
+
+ $row = mysql_fetch_array($result);
+ return $row["translation"];
+ }
+}
+
+// *************************************************
+// Fundamental i18nHTML API functions
+// *************************************************
+
+// translate the sentence $a and return the result.
+function TRANSLATE_($a,$args=null) {
+ if ($a == "")
+ return 0;
+ return vsprintf(translation_query($a), $args);
+}
+
+// translate the sentence $a and output just
+// the translated text (without link to translate.php)
+function TRANSLATE($a,$args=null) {
+ echo TRANSLATE_($a);
+}
+
+// translate the sentence $a adding a link
+// to enable editing translations and return the result.
+function W_($a,$args=null) {
+ if ($a == "")
+ return 0;
+ return TRANSLATE_($a,$args) . translateLink_($a);
+}
+
+// translate the sentence $a appending a link
+// to enable edit the translation and output the
+// result.
+function W($a, $args=NULL) {
+ if ($a != "")
+ echo W_($a, $args) . "\n";
+}
+
+// create internationalized, internal link to
+// $a.php with description $b
+function intlink_($a, $b) {
+ global $lang;
+
+ $ret = "<a href=\"" . $a . "?xlang=" . $lang . "\">" . TRANSLATE_($b) .
"</a>";
+ $ret = $ret . translateLink_($b);
+ return $ret;
+}
+
+// create internationalized, internal link to
+// $a.php with description $b
+function intlink($a, $b) {
+ echo intlink_($a, $b);
+}
+
+// create internationalized, external link to
+// $a with description $b
+function extlink_($a, $b) {
+ $ret = "<a href=\"" . $a . "\">" . TRANSLATE_($b) . "</a>" .
translateLink_($b);
+ return $ret;
+}
+
+// create internationalized, external link to
+// $a with description $b
+function extlink($a, $b) {
+ echo extlink_($a, $b);
+}
+
+
+// *************************************************
+// global, call-once helper functions
+// *************************************************
+
+// outputs appropriate DOCTYPE declaration for the document
+// this should be the 1st line in your php file after including
+// i18nhtml.inc. Valid types are: HTML for HTML 4 documents,
+// XHTML1 for xhtml 1.0 documents, and XHTML1.1 for xhtml 1.1
+// defaulting to HTML4 if $type is blank or unknown. An optional
+// $mode may be specified, it must be one of "Transitional",
+// "Strict", or "Frameset", defaulting to "Transitional".
+// Note for XHTML1.1 $mode is ignored.
+// example:
+// include("i18nhtml.inc");
+// DOCTYPE("XHTML1");
+function DOCTYPE($type=null, $mode=null) {
+ // depending on $mode, use appropriate dtd
+ if ($mode == "Strict") {
+ $dtd = "strict";
+ if ($type != "XHTML1") // Strict not specified except for XHTML1.0
+ $mode = "";
+ } else if ($mode == "Frameset") {
+ $dtd = "frameset";
+ } else { // $mode == Transitional, default, or unknown
+ $dtd = "loose";
+ $mode = "Transitional";
+ }
+ if ($type == "XHTML1")
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 " . $mode . "//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" . $dtd . ".dtd\">\n";
+ else if ($type == "XHTML1.1")
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
+ else
+ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " . $mode . "//EN\"
\"http://www.w3.org/TR/html4/" . $dtd . ".dtd\">\n";
+}
+
+function TITLE($a,$b="") {
+ global $lang;
+ global $languagecodes;
+ echo "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"
>";
+ echo "<title>" . TRANSLATE_($a,$b) . "</title>\n";
+ if (isset($languagecodes[$lang])) {
+ echo "<meta name=\"content-language\" content=\"" .
+ $languagecodes[$lang] . "\">";
+ echo "<meta name=\"language\" content=\"" .
+ $languagecodes[$lang] . "\">";
+ }
+}
+
+// displays a list of all languages currently available with
+// at least 1 translated string.
+function generateLanguageBar() {
+ global $connection, $i18nHTMLsqlPrefix;
+
+ if ($connection) {
+ echo "<center>[";
+ $query = "SELECT DISTINCT lang FROM ".$i18nHTMLsqlPrefix."map ORDER BY
lang";
+// die($query);
+ $result = mysql_query($query, $connection);
+ $num = 0;
+ if ($result)
+ $num = mysql_numrows($result);
+ echo "<a href=\"?xlang=English\">";
+ W("English");
+ echo "</a>";
+ $last = "English";
+ for ($i=0;$i<$num;$i++) {
+ $row = mysql_fetch_array($result);
+ $next = $row["lang"];
+ if ($next == $last)
+ continue;
+ echo " | ";
+ echo "<a href=\"?xlang=$next\">" . W_($next) . "</a>";
+ $last = $next;
+ }
+ echo "]</center>";
+ }
+}
+
+
+// displays text at the bottom of the page to indicate
+// translation mode (including link to active) and
+// copyright notice for i18nHTML.
+function generateFooter() {
+ global $xlang;
+ global $editor;
+ global $HTTP_SERVER_VARS;
+
+ P();
+ echo "Translation engine based on <a
href=\"http://gnunet.org/i18nHTML/\">i18nHTML</a> (C) 2003, 2004, 2005
Christian Grothoff.<br />\n";
+ if ( ($xlang) && ($xlang != "English") ) {
+ $back = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] .
$HTTP_SERVER_VARS["REQUEST_URI"];
+ echo "<center><small>\n";
+ if ($editor != 1)
+ echo " <a href=\"$back&editor=1\">" . W_("enter translation mode") .
"</a>";
+ else
+ W(" Translation Mode Active (for this page only)");
+ echo "</small></center>\n";
+ }
+ echo "</p>\n";
+}
+
+
+
+// *************************************************
+// HTML construct helper functions
+// *************************************************
+
+function LI($a,$b="") {
+ echo "<li>" . W_($a,$b) . "</li>\n";
+}
+function TH($a,$b="") {
+ echo "<th>" . W_($a,$b) . "</th>\n";
+}
+function TD($a,$b="") {
+ echo "<td>" . W_($a,$b) . "</td>\n";
+}
+function DT($a,$b="") {
+ echo "<dt>" . W_($a,$b) . "</dt>\n";
+}
+function DD($a,$b="") {
+ echo "<dd>" . W_($a,$b) . "</dd>\n";
+}
+function H1($a,$b="") {
+ echo "<h1>" . W_($a,$b) . "</h1>\n";
+}
+function H2($a,$b="") {
+ echo "<h2>" . W_($a,$b) . "</h2>\n";
+}
+function H3($a,$b="") {
+ echo "<h3>" . W_($a,$b) . "</h3>\n";
+}
+function H4($a,$b="") {
+ echo "<h4>" . W_($a,$b) . "</h4>\n";
+}
+function H5($a,$b="") {
+ echo "<h5>" . W_($a,$b) . "</h5>\n";
+}
+function PRE($a) {
+ echo "<pre>" . $a . "</pre>";
+}
+// 'verbatim' (untranslated) "li"
+function LIV($a) {
+ echo "<li>" . $a . "</li>\n";
+}
+function P($attr="") {
+ echo "<p $attr>\n";
+}
+function BR($attr="") {
+ echo "<br $attr/>\n";
+}
+function HR() {
+ echo "<hr/>\n";
+}
+function DTDD($a,$b) {
+ DT($a);
+ DD($b);
+}
+function LILI($a,$b) {
+ echo "<li>" . extlink_($a,$b) . "</li>\n";
+}
+function ANCHOR($a) {
+ echo "<a name=\"$a\"></a>\n";
+}
+function IMG_($src, $alt, $align="CENTER", $width, $height, $border=0,
$hspace=0, $vspace=0) {
+ $ret = "";
+
+ if ($align == "CENTER")
+ $ret = $ret . "<p><center>\n";
+ $ret = $ret . "<img src=\"" . $src . "\" alt=\"";
+ $ret = $ret . TRANSLATE_($alt);
+ $ret = $ret . "\" align=\"" . $align . "\" width=$width height=$height
border=$border hspace=$hspace vspace=$vspace>\n";
+ $ret = $ret . translateLink_($alt);
+ if ($align == "CENTER")
+ $ret = $ret . "</center><p>\n";
+ return $ret;
+}
+function IMG($src, $alt, $align="CENTER", $width, $height, $border=0,
$hspace=0, $vspace=0) {
+ echo IMG_($src, $alt, $align, $width, $height, $border, $hspace, $vspace);
+}
+
+?>
\ No newline at end of file
Deleted: GNUnet-docs/WWW/i18nhtml_config.inc
===================================================================
--- GNUnet-docs/WWW/i18nhtml_config.inc 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/i18nhtml_config.inc 2005-05-25 12:05:16 UTC (rev 817)
@@ -1,35 +0,0 @@
-<?php
-/*
- (C) 2003, 2004 Christian Grothoff
-
- This code is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
- option) any later version.
-
- The code is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with the code; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
- // Use this file to configure i18nHTML
-
-// -- use 0 when /. comes...
-$i18nHTMLrecordMode = 2; // 1: only missing, 2: everything, 0: disable
-
-$i18nHTMLsqlServer = "localhost";
-$i18nHTMLsqlUser = "GNUnetWWW";
-$i18nHTMLsqlPass = "garlic";
-
-$i18nHTMLsqlDB = "translations"; // default is "translation"
-$i18nHTMLbase = ""; // base directory prepended to i18nHTML php pages used in
links
-$i18nHTMLmarker = "*"; // default value if never changed
-
-
-?>
Added: GNUnet-docs/WWW/i18nhtml_config.inc.php
===================================================================
--- GNUnet-docs/WWW/i18nhtml_config.inc.php 2005-05-25 11:52:28 UTC (rev
816)
+++ GNUnet-docs/WWW/i18nhtml_config.inc.php 2005-05-25 12:05:16 UTC (rev
817)
@@ -0,0 +1,36 @@
+<?php
+/*
+ (C) 2003, 2004 Christian Grothoff
+
+ This code is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ The code is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with the code; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+ // Use this file to configure i18nHTML
+
+// -- use 0 when /. comes...
+$i18nHTMLrecordMode = 2; // 1: only missing, 2: everything, 0: disable
+
+$i18nHTMLsqlServer = "localhost";
+$i18nHTMLsqlUser = "GNUnetWWW";
+$i18nHTMLsqlPass = "garlic";
+
+$i18nHTMLsqlDB = "translations"; // default is "translation"
+$i18nHTMLbase = ""; // base directory prepended to i18nHTML php pages used in
links
+$i18nHTMLmarker = "*"; // default value if never changed
+
+$i18nHTMLsqlPrefix = ""; // use this if you want to have a prefix for the SQL
table names used by i18nHTML
+
+?>
Modified: GNUnet-docs/WWW/scripts.inc
===================================================================
--- GNUnet-docs/WWW/scripts.inc 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/scripts.inc 2005-05-25 12:05:16 UTC (rev 817)
@@ -1,5 +1,5 @@
<?php
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
// GNUnet specific functions
Added: GNUnet-docs/WWW/start.php
===================================================================
--- GNUnet-docs/WWW/start.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/start.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,29 @@
+<?php
+include("i18nhtml.inc.php");
+DOCTYPE("HTML", "Transitional");
+echo "<html><head>\n";
+TITLE("Documentation");
+echo "</head><body>";
+generateLanguageBar();
+H2("Documentation");
+H3("i18nHTML");
+W("These webpages uses %s to internationalize the documentation.",
+ extlink_("http://gnunet.org/i18nHTML/", "i18nHTML"));
+W("Please feel encouraged to help, for example by translating some of the
pages to your native language.");
+W("Just view the pages in your language and click on the "*" after a
sentence to translate it.");
+W("You can start a new language by adding <tt>lang=LANGUAGE</tt> after the
<tt>.php3</tt> in the URL.");
+W("The translations incorporate a voting system, the highest ranked
translation is displayed.");
+W("English is always the source language.");
+W("Only developers can change the source, contact them if you find problems.");
+W("On the translation page, you find all other translations.");
+W("You can also vote for a specific translation by clicking on the respective
sentence.");
+W("You are allowed to vote multiple times for the same sentence, e.g. to
express strong feelings. :-)");
+W("The system logs your IP and allows the administrator to easily undo all
operations that were performed from a certain IP address.");
+if ($xlang && ($xlang != "English") ) {
+ W("You can translate the most commonly requested untranslated sentences for
your language using the %s.",
+ intlink_("editor.php", "mass translation page"));
+ }
+
+generateFooter();
+echo "</body></html>\n";
+?>
Modified: GNUnet-docs/WWW/status.php
===================================================================
--- GNUnet-docs/WWW/status.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/status.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -18,10 +18,10 @@
Boston, MA 02111-1307, USA.
*/
// This file can be used to obtain some statistics
- // about the progress of the translation.
+ // about the progress of the translation.
// It has no other purpose.
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down.";
die();
@@ -34,17 +34,17 @@
W("Language setting is %s.",
$lang);
P();
-$query = "SELECT count FROM pending WHERE lang=\"English\"";
+$query = "SELECT count FROM ".$i18nHTMLsqlPrefix."pending WHERE
lang=\"English\"";
$result = mysql_query($query, $connection);
$num = 0;
-if ($result)
+if ($result)
$num = mysql_numrows($result);
W("Sentences in the original English text: %s",
$num);
P();
if ($mode == 1) {
H2("All available translations");
- echo "<table border=5>\n";
+ echo "<table border='5'>\n";
echo "<tr>";
TH("Original");
TH("Language");
@@ -53,10 +53,10 @@
echo "</tr>\n";
}
$stats = ARRAY();
-$query = "SELECT name,ranking,translation,lang FROM map";
+$query = "SELECT name,ranking,translation,lang FROM ".$i18nHTMLsqlPrefix."map";
$result = mysql_query($query, $connection);
$num = 0;
-if ($result)
+if ($result)
$num = mysql_numrows($result);
for ($i=0;$i<$num;$i++) {
$row = mysql_fetch_array($result);
@@ -79,7 +79,7 @@
if ($mode == 1) {
echo "</table>";
P();
- HR();
+ HR();
P();
}
W("%s translated sentences in database.", $num);
Modified: GNUnet-docs/WWW/translate.php
===================================================================
--- GNUnet-docs/WWW/translate.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/translate.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -17,13 +17,13 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
}
$text = fix($_REQUEST['text']);
-$text_sql = mysql_real_escape_string($text);
+$text_sql = quote_smart($text);
$text_url = urlencode($text);
$back = $_REQUEST['back'];
DOCTYPE("HTML", "Transitional");
@@ -36,7 +36,7 @@
if ($lang == "English") {
echo "Cannot translate to English.";
die();
- }
+ }
H2("Original Text");
echo $text;
H2("Translation");
@@ -49,8 +49,8 @@
echo "<input type=hidden name=\"back\" value=\"$back\">\n";
W("Translated text:");
echo "<input size=\"80\" maxlength=\"65535\" name=\"translation\">\n";
-echo "<input type=submit value=\"" .
- TRANSLATE_("I hereby give this translation into the Public Domain
(commit)") .
+echo "<input type=submit value=\"" .
+ TRANSLATE_("I hereby give this translation into the Public Domain
(commit)") .
"\">\n";
echo "</form>\n";
P();
@@ -58,15 +58,15 @@
H2("All available translations");
echo "<table border=5 width=95%>\n";
echo "<tr><th>" . W_("Language") . "</th><th>" . W_("Translation") .
"</th></tr>\n";
-$query = "SELECT translation,lang FROM map WHERE name=\"$text_sql\" ORDER BY
ranking DESC";
+$query = "SELECT translation,lang FROM ".$i18nHTMLsqlPrefix."map WHERE
name=\"$text_sql\" ORDER BY ranking DESC";
$result = mysql_query($query, $connection);
$num = 0;
-if ($result)
+if ($result)
$num = mysql_num_rows($result);
for ($i=0;$i<$num;$i++) {
$row = mysql_fetch_array($result);
$translation = $row["translation"];
- printf("<tr><td>%s</td><td><a href=\"" . $i18nHTMLbase .
+ printf("<tr><td>%s</td><td><a href=\"" . $i18nHTMLbase .
"vote.php?xlang=%s&text=%s&translation=%s\">%s</a></td></tr>\n",
W_($row["lang"]),
urlencode($row["lang"]),
Added: GNUnet-docs/WWW/update0_1_0.php
===================================================================
--- GNUnet-docs/WWW/update0_1_0.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/update0_1_0.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,50 @@
+<?php
+include("i18nhtml.inc");
+?>
+# This script merely generates the SQL statements<br>
+# to do the update. You'll have to run the SQL<br>
+# commands yourself to prevent accidental data loss.<br>
+# <pre>
+<?php
+echo "use $i18nHTMLsqlDB;\n";
+$query = "SELECT * FROM map";
+$result = mysql_query($query, $connection);
+$num = 0;
+$loss = 0;
+if ($result)
+ $num = mysql_numrows($result);
+for ($ii=0;$ii<$num;$ii++) {
+ $row = mysql_fetch_array($result);
+ $la = mysql_real_escape_string($row["lang"]);
+ $src = mysql_real_escape_string($row["name"]); // urlencoded
+ $dst = $row["translation"]; // possibly urlencoded
+ $rank = $row["ranking"];
+ $rtrans = mysql_real_escape_string(to_unicode(urldecode($dst)));
+ // detect "bad" translations (where conversion failed)
+ // if more than 5 values in [0..9] follow => bad conversion
+ $txtCnt = count_chars(urldecode($src), 1);
+ $tCnt = count_chars($rtrans, 1);
+
+ // 3426
+ if (! ( ereg("&#[0-9]{6}", $rtrans) ||
+ ($txtCnt[ord('%')] != $tCnt[ord('%')]) ||
+ ( ( ($la != "Japanese") &&
+ ($la != "Traditional chinese") &&
+ ($la != "Russian") &&
+ ($la != "Ukrainian") &&
+ (ereg("&#[0-9]{4}", $rtrans)) ) ) ) ) {
+ $dst = mysql_real_escape_string($dst);
+ if ($rtrans != $dst) {
+ $subquery = "UPDATE map SET translation=\"$rtrans\" WHERE name=\"$src\"
AND lang=\"$la\" AND translation=\"$dst\" AND ranking=$rank;\n";
+ echo "$subquery\n";
+ }
+ } else {
+ $subquery = "DELETE FROM map WHERE name=\"$src\" AND lang=\"$la\" AND
translation=\"$dst\" AND ranking=$rank;\n";
+ echo "$subquery\n";
+ $loss++;
+ }
+ }
+echo "# Lost $loss out of $num translations.\n";
+?>
+# </pre>
+# end of conversion
Added: GNUnet-docs/WWW/update0_2_0.php
===================================================================
--- GNUnet-docs/WWW/update0_2_0.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/update0_2_0.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -0,0 +1,36 @@
+<?php
+include("i18nhtml.inc");
+?>
+# This script merely generates the SQL statements<br>
+# to do the update. You'll have to run the SQL<br>
+# commands yourself to prevent accidental data loss.<br>
+# <pre>
+<?php
+echo "use $i18nHTMLsqlDB;\n";
+$query = "SELECT * FROM map";
+$result = mysql_query($query, $connection);
+$num = 0;
+$loss = 0;
+if ($result)
+ $num = mysql_numrows($result);
+for ($ii=0;$ii<$num;$ii++) {
+ $row = mysql_fetch_array($result);
+ $la = mysql_real_escape_string($row["lang"]);
+ $src = $row["name"]; // urlencoded
+ $src_sql = mysql_real_escape_string($src);
+ $dst_sql = mysql_real_escape_string($row["translation"]);
+ $rank = $row["ranking"];
+ $rname = fix(urldecode($src));
+ $rname_sql = mysql_real_escape_string(fix(urldecode($src)));
+ // detect "bad" translations (where conversion failed)
+ // if more than 5 values in [0..9] follow => bad conversion
+ $txtCnt = count_chars(urldecode($src), 1);
+ $tCnt = count_chars($rtrans, 1);
+
+ $dst = mysql_real_escape_string($dst);
+ $subquery = "UPDATE map SET name=\"$rname_sql\" WHERE name=\"$src_sql\" AND
lang=\"$la\" AND translation=\"$dst_sql\" AND ranking=$rank;\n";
+ echo "$subquery";
+}
+?>
+# </pre>
+# end of conversion
Modified: GNUnet-docs/WWW/vote.php
===================================================================
--- GNUnet-docs/WWW/vote.php 2005-05-25 11:52:28 UTC (rev 816)
+++ GNUnet-docs/WWW/vote.php 2005-05-25 12:05:16 UTC (rev 817)
@@ -20,7 +20,7 @@
// This file records votes from users for translations.
// For sentences with multiple translations, the one with the most
// votes is displayed.
-include("i18nhtml.inc");
+include("i18nhtml.inc.php");
DOCTYPE("HTML", "Transitional");
echo "<html><head>";
TITLE("WWW translation: vote");
@@ -28,22 +28,22 @@
if (!$connection) {
echo "Database is down. Cannot edit translations.";
die();
- }
+ }
$text = fix(urldecode($_REQUEST['text']));
$translation = fix(urldecode($_REQUEST['translation']));
-$text_sql = mysql_real_escape_string($text);
-$translation_sql = mysql_real_escape_string(to_unicode($translation));
+$text_sql = quote_smart($text);
+$translation_sql = quote_smart(to_unicode($translation));
-$query = "SELECT ranking FROM map WHERE " .
+$query = "SELECT ranking FROM ".$i18nHTMLsqlPrefix."map WHERE " .
"name=\"$text_sql\" AND lang=\"$lang\" AND
translation=\"$translation_sql\"";
$result = mysql_query($query, $connection);
$num = 0;
-if ($result)
+if ($result)
$num = mysql_numrows($result);
if ($num > 0) {
$row = mysql_fetch_array($result);
$ranking = $row["ranking"] + 1;
- $query = "UPDATE map SET ranking=\"$ranking\" WHERE " .
+ $query = "UPDATE ".$i18nHTMLsqlPrefix."map SET ranking=\"$ranking\" WHERE " .
"name=\"$text_sql\" AND lang=\"$lang\" AND
translation=\"$translation_sql\"";
mysql_query($query, $connection);
W("Ranking of translation is now: ");
Modified: i18nHTML/AUTHORS
===================================================================
--- i18nHTML/AUTHORS 2005-05-25 11:52:28 UTC (rev 816)
+++ i18nHTML/AUTHORS 2005-05-25 12:05:16 UTC (rev 817)
@@ -1,3 +1,4 @@
Christian Grothoff <address@hidden>
Kenneth J. Davis <address@hidden>
Bernard Paques <address@hidden>
+Petko Yotov <address@hidden>
Modified: i18nHTML/ChangeLog
===================================================================
--- i18nHTML/ChangeLog 2005-05-25 11:52:28 UTC (rev 816)
+++ i18nHTML/ChangeLog 2005-05-25 12:05:16 UTC (rev 817)
@@ -1,3 +1,13 @@
+Tue May 24 18:02:41 EST 2005 PY
+ The main enhancement is the database table prefix, it allows to
+ group tables for the same script. Another enhancement is the
+ function quote_smart() and the script can now work even with magic
+ quotes on (useful if you cannot change php.ini). Also changed the
+ extensions from .inc to .php as some hosts will not parse .inc
+ files but will send them to the browser in clear
+ (passwords and such, a security issue). Additional some of the
+ interface translations to Bulgarian were added.
+
Mon Apr 11 01:28:49 EST 2005 CG
Big code cleanup, removing dead and redundant code.
Also fixed problems with voting and various problems
Modified: i18nHTML/README
===================================================================
--- i18nHTML/README 2005-05-25 11:52:28 UTC (rev 816)
+++ i18nHTML/README 2005-05-25 12:05:16 UTC (rev 817)
@@ -12,16 +12,17 @@
src/ contains the PHP scripts that need to be copied into the source
directory containing the webpage. Every page is suposed to include
-"i18nhtml.inc" and use the PHP functions defined therein to construct
-the page. Note: assuming you set $i18nHTMLbase correctly, you can
-place these files anywhere, then adjust the include path correctly
-and all should still work (ie no need to maintain a copy in each dir).
+"i18nhtml.inc.php" and use the PHP functions defined therein to
+construct the page. Note: assuming you set $i18nHTMLbase correctly,
+you can place these files anywhere, then adjust the include path
+correctly and all should still work (ie no need to maintain a copy in
+each dir).
First, make sure that get_magic_quotes is turned OFF for GET, POST,
COOKIE and SQL data (php.ini). Otherwise you will have subtle
problems.
-src/i18nhtml_config.inc must be edited to configure the database
+src/i18nhtml_config.inc.php must be edited to configure the database
access method. You need to configure the MySQL database like this:
$ mysql -u root -p
Modified: i18nHTML/contrib/populate.sql
===================================================================
--- i18nHTML/contrib/populate.sql 2005-05-25 11:52:28 UTC (rev 816)
+++ i18nHTML/contrib/populate.sql 2005-05-25 12:05:16 UTC (rev 817)
@@ -45,15 +45,53 @@
INSERT INTO map VALUES("Basque", "Russian",
"Баскский", 1, "");
INSERT INTO map VALUES("Basque", "Spanish", "Vasco", 42, "");
INSERT INTO map VALUES("Basque", "Swedish", "Baskiska", 37, "");
-INSERT INTO map VALUES("Bulgarian", "Dutch", "Bulgaars", 3, "");
-INSERT INTO map VALUES("Bulgarian", "French", "Bulgare", 7, "");
-INSERT INTO map VALUES("Bulgarian", "German", "Bulgarisch", 7, "");
-INSERT INTO map VALUES("Bulgarian", "Hungarian", "bolgár", 2, "");
-INSERT INTO map VALUES("Bulgarian", "Japanese",
"ブルガリア語", 6, "");
-INSERT INTO map VALUES("Bulgarian", "Polish", "Karol Wojtyla ", 3, "");
-INSERT INTO map VALUES("Bulgarian", "Portuguese", "Búlgaro", 2, "");
-INSERT INTO map VALUES("Bulgarian", "Russian",
"Болгарский", 3,
"");
-INSERT INTO map VALUES("Bulgarian", "Spanish", "Búlgaro", 2, "");
+INSERT INTO map VALUES ('Documentation', 'Bulgarian',
'Документация',
2, '81.67.88.59');
+INSERT INTO map VALUES ('Back...', 'Bulgarian',
'Обратно...', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Bulgarian', 'Bulgarian',
'Български', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('Remarks', 'Bulgarian',
'Забележки', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('All available translations', 'Bulgarian',
'Всички
налични
преводи', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Language', 'Bulgarian',
'Език', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Translation', 'Bulgarian',
'Превод', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Destination language: ', 'Bulgarian',
'Език - цел', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Original Text', 'Bulgarian',
'Оригинален
текст', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Destination language: ', 'Bulgarian',
'Език - цел:', 3, '81.67.88.59');
+INSERT INTO map VALUES ('Ranking of translation is now: ', 'Bulgarian',
'Текущите
гласове за
превода са:', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('English', 'Bulgarian',
'Английски', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('Translated text:', 'Bulgarian',
'Преведен
текст:', 1, '81.67.88.59');
+INSERT INTO map VALUES ('i18nHTML', 'Bulgarian', 'i18nHTML', 1, '81.67.88.59');
+INSERT INTO map VALUES ('The percent sign', 'Bulgarian',
'Знакът
процент', 1, '81.67.88.59');
+INSERT INTO map VALUES ('enter translation mode', 'Bulgarian',
'влизане в
режим
превод', 1, '81.67.88.59');
+INSERT INTO map VALUES ('The %% sign is a special character.', 'Bulgarian',
'Знакът %% е
специална
команда.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Mass translation to %s', 'Bulgarian',
'Масов превод
на %s', 1, '81.67.88.59');
+INSERT INTO map VALUES ('here', 'Bulgarian', 'тук', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('Statistics about translation progress can be found
%s.\n', 'Bulgarian',
'Статистика
за прогреса
на превода
можете да
прегледате %s.', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('WWW translation', 'Bulgarian',
'Интернет
превод', 1, '81.67.88.59');
+INSERT INTO map VALUES ('You must use %%%% in the text to print a single
percent sign.', 'Bulgarian', 'Трябва
да
използвате %%%%
в текста, за
да изпишете
знак за
процент.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('The sequence %%s is used as a placeholder for
links.', 'Bulgarian',
'Комбинацията
%%s се използва
за поставяне
на
препратки.', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('Language specific special characters', 'Bulgarian',
'Знаци,
специфични
за
различните
езици', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Various languages use special characters.',
'Bulgarian', 'Много
езици
използват
специални
знаци.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('The code has not been tested with certain character
sets, such as Chinese.', 'Bulgarian',
'Програмата
не е тествана
с някои
кодови
таблици,
например
китайски.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('If you are trying to translate the page to such a
language, please contact the developerws if you encounter any problems.',
'Bulgarian', 'Ако
превеждате
към такъв
език и имате
проблеми,
моля
свържете се с
разработчиците.',
1, '81.67.88.59');
+INSERT INTO map VALUES ('Copyright', 'Bulgarian',
'Авторско
право', 1, '81.67.88.59');
+INSERT INTO map VALUES ('The original english text is released under the GNU
Free Documentation License (FDL).', 'Bulgarian',
'Оригиналният
текст е
защитен от
Лиценза за
свободна
документация
на ГНУ (GNU FDL)', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Processing translations...', 'Bulgarian',
'Обработка на
преводите...', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('Currently, the translation can only access the links
in the same order as the original text.', 'Bulgarian',
'Засега
преводът
може да става
единствено
по реда на
оригиналния
текст.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Translations submitted to the webpage must be
released to the public domain to ensure that we will not have any legal
trouble.', 'Bulgarian',
'Преводите,
направени на
тази
страница,
трябва да са
освободени в
Общественото
достояние,
за да сме
сигурни, че
няма да
възникнат
юридически
проблеми.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('If you have concerns or remarks regarding this
policy, feel free to bring them to our attention.', 'Bulgarian',
'Ако имате
притеснения
или
забележки
към тази
политика,
можете да ги
споделите с
нас.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Help translating this webpage.', 'Bulgarian',
'Помогнете за
превода на
тази
страница.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('I hereby give this translation into the Public Domain
(commit)', 'Bulgarian',
'Освобождавам
този превод
в
Общественото
достояние
(съхранение)', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('Storing translation for "%s" =
"%s".', 'Bulgarian',
'Съхранение
на превода за
\\"%s\\" = \\"%s\\".\\"', 1, '81.67.88.59');
+INSERT INTO map VALUES ('This page is for translating lots of sentences at
once.', 'Bulgarian', 'На тази
страница се
превеждат
много
изречения
наведнъж.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('The sentences are ordered by the frequency that they
are requested by users.', 'Bulgarian', 'Тези
изречения са
подредени
според
честотата на
срещане.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('The page lists the top %s requested, untranslated
sentences in the selected language.', 'Bulgarian',
'Тази
страница
показва
най-честите %s
непреведени
изречения за
избрания
език.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Do not copy the quotes (") from the original
messages into the translations.', 'Bulgarian', 'Не
копиайте
кавичките (\\")
от
оригиналния
текст в
превода.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('Language setting is %s.', 'Bulgarian',
'Текущ език е %s.',
1, '81.67.88.59');
+INSERT INTO map VALUES ('Sentences in the original English text: %s',
'Bulgarian', 'Преводи в
оригиналния
текст на
английски: %s', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('%s translated sentences in database.', 'Bulgarian',
'%s преведени
изречения в
базата с
данни.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('%s translations available in %s.', 'Bulgarian', '%s
преведени
изречения на
%s.', 1, '81.67.88.59');
+INSERT INTO map VALUES ('These webpages uses %s to internationalize the
documentation.', 'Bulgarian', 'Тези
страници
използват %s
за превод на
документацията.',
1, '81.67.88.59');
+INSERT INTO map VALUES ('Please feel encouraged to help, for example by
translating some of the pages to your native language.', 'Bulgarian',
'Можете да
помогнете,
например
като
преведете
някои
страници на
вашия език.', 1,
'81.67.88.59');
+INSERT INTO map VALUES ('Just view the pages in your language and click on the
"*" after a sentence to translate it.', 'Bulgarian',
'Просто
отворете
страниците
на езика си и
натиснете на
\\"*\\" след
изречението,
за да го
преведете.', 1,
'81.67.88.59');
INSERT INTO map VALUES("Catalan", "Catalan", "Català", 142, "");
INSERT INTO map VALUES("Catalan", "Czech", "Katalánsky", 141, "");
INSERT INTO map VALUES("Catalan", "Danish", "Katalansk", 23, "");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r817 - Extractor-docs/WWW GNUnet-docs/WWW i18nHTML i18nHTML/contrib,
grothoff <=