gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r587 - in i18nHTML: . doc src


From: grothoff
Subject: [GNUnet-SVN] r587 - in i18nHTML: . doc src
Date: Sun, 3 Apr 2005 23:47:27 -0700 (PDT)

Author: grothoff
Date: 2005-04-03 23:47:24 -0700 (Sun, 03 Apr 2005)
New Revision: 587

Modified:
   i18nHTML/README
   i18nHTML/doc/example.php
   i18nHTML/doc/example2.php
   i18nHTML/src/commitMassTranslation.php
   i18nHTML/src/commitTranslation.php
   i18nHTML/src/editor.php
   i18nHTML/src/i18nhtml.inc
   i18nHTML/src/update.php
Log:
bugfix

Modified: i18nHTML/README
===================================================================
--- i18nHTML/README     2005-04-04 03:55:29 UTC (rev 586)
+++ i18nHTML/README     2005-04-04 06:47:24 UTC (rev 587)
@@ -20,7 +20,7 @@
 src/i18nhtml_config.inc must be edited to configure the database
 access method.  You need to configure the MySQL database like this:
 
-# mysql -u root -p 
+$ mysql -u root -p 
 CREATE DATABASE translation;
 GRANT select,insert,update,delete,create,alter,drop
      ON translation.* TO address@hidden;

Modified: i18nHTML/doc/example.php
===================================================================
--- i18nHTML/doc/example.php    2005-04-04 03:55:29 UTC (rev 586)
+++ i18nHTML/doc/example.php    2005-04-04 06:47:24 UTC (rev 587)
@@ -12,9 +12,9 @@
   ARRAY("foo", "bar"));
 P(); // <p>
 W("A sentence with a %s that CAN be translated.",
-  extlink_("http://ovmj.org/i18nHTML/";, "link text"));
+  extlink_("http://gnunet.org/i18nHTML/";, "link text"));
 W("A %s to another translatable page.",
-  intlink_("http://ovmj.org/i18nHTML/index";, "link")); // .php is added 
automatically!
+  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.");

Modified: i18nHTML/doc/example2.php
===================================================================
--- i18nHTML/doc/example2.php   2005-04-04 03:55:29 UTC (rev 586)
+++ i18nHTML/doc/example2.php   2005-04-04 06:47:24 UTC (rev 587)
@@ -40,9 +40,9 @@
 $myvar = $myvar . "foo" . TRANSLATE_(" that is not translatable.");
 echo $myvar;
 W("A sentence with a %s that CAN be translated.",
-  extlink_("http://ovmj.org/i18nHTML/";, "link text"));
+  extlink_("http://gnunet.org/i18nHTML/";, "link text"));
 W("A %s to another translatable page.",
-  intlink_("http://ovmj.org/i18nHTML/index";, "link")); // .php is added 
automatically!
+  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.");

Modified: i18nHTML/src/commitMassTranslation.php
===================================================================
--- i18nHTML/src/commitMassTranslation.php      2005-04-04 03:55:29 UTC (rev 
586)
+++ i18nHTML/src/commitMassTranslation.php      2005-04-04 06:47:24 UTC (rev 
587)
@@ -32,7 +32,7 @@
 W("Processing translations...");
 P();
 $done = 0;
-foreach($_GET as $dec=>$val) {
+foreach($_POST as $dec=>$val) {
   if ($val == "")
     continue;
   if ( ($dec == "xlang") || ($dec == "start") )
@@ -65,7 +65,9 @@
   if ($result) 
     $num = mysql_numrows($result);
   if ($num == 0) {
-    if (array_count_values($enc)['%'] != array_count_values($t)['%']) {
+    $txtCnt = count_chars(urldecode($enc), 1);
+    $tCnt = count_chars($t, 1);
+    if ($txtCnt[ord('%')] != $tCnt[ord('%')]) {
       W("Commit '%s->%s' failed.", $enc, $t);
       W("The number of percent signs in source text and translation do not 
match.");     
       W("Note that you must preserve all %%s expressions unchanged.");

Modified: i18nHTML/src/commitTranslation.php
===================================================================
--- i18nHTML/src/commitTranslation.php  2005-04-04 03:55:29 UTC (rev 586)
+++ i18nHTML/src/commitTranslation.php  2005-04-04 06:47:24 UTC (rev 587)
@@ -47,9 +47,9 @@
   generateFooter();
   echo "</body></html>";
 } else {
-  $txtCnt = count_chars($text, 1);
-  $tCnt = count_chars($text, 1);
-  if ($txtCnt['%'] != $tCnt['%']) {
+  $txtCnt = count_chars(urldecode($text), 1);
+  $tCnt = count_chars($t, 1);
+  if ($txtCnt[ord('%')] != $tCnt[ord('%')]) {
       echo "<html><head>";
       TITLE("Commit failed.");
       echo "</head><body>";

Modified: i18nHTML/src/editor.php
===================================================================
--- i18nHTML/src/editor.php     2005-04-04 03:55:29 UTC (rev 586)
+++ i18nHTML/src/editor.php     2005-04-04 06:47:24 UTC (rev 587)
@@ -65,7 +65,7 @@
     ARRAY($start, $end));
   P();
 
-  echo "<form method="POST" action=\"" . $i18nHTMLbase . 
"commitMassTranslation.php\">";
+  echo "<form method=\"POST\" action=\"" . $i18nHTMLbase . 
"commitMassTranslation.php\">";
   echo "<input type=hidden name=\"xlang\" value=\"$xlang\">";
   $endp = $end + 1;
   echo "<input type=hidden name=\"start\" value=\"$endp\">";

Modified: i18nHTML/src/i18nhtml.inc
===================================================================
--- i18nHTML/src/i18nhtml.inc   2005-04-04 03:55:29 UTC (rev 586)
+++ i18nHTML/src/i18nhtml.inc   2005-04-04 06:47:24 UTC (rev 587)
@@ -780,7 +780,7 @@
     return fix($a);              // just return English string
   } else { // translation available
     $row = mysql_fetch_array($result);
-    return fix(from_unicode($row["translation"]));
+    return $row["translation"];
   }
 }
 

Modified: i18nHTML/src/update.php
===================================================================
--- i18nHTML/src/update.php     2005-04-04 03:55:29 UTC (rev 586)
+++ i18nHTML/src/update.php     2005-04-04 06:47:24 UTC (rev 587)
@@ -22,8 +22,17 @@
   $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
-  $ok = 0 == preg_match("&#[0..9][0..9][0..9][0..9][0..9][0..9]", $rtrans);
-  if ($ok) {
+  $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";





reply via email to

[Prev in Thread] Current Thread [Next in Thread]