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

Re: [E-devel] trivial patch



Le Thu, 11 May 2006 23:02:52 +0900, dans son message intitulé Re:
[E-devel] trivial patch, Carsten Haitzler (The Rasterman)
<raster@rasterman.com> a eu le courage de nous raconter :

> On Sat, 06 May 2006 18:54:57 +0200 Massimo Maiurana
> <maiurana@gmail.com> babbled:
> 
> > do you remember when the "about e..." dialog was never translated
> > due to a copyright glyph which gettext did not like?
> > well, the same now happens with the three_points character; strings
> > containing that character are never translated.
> > patch attached.
> 
> thanks! committed.
> 
> > -- 
> >        Massimo Maiurana         massimo<at>ragusa.linux.it
> >        http://massimo.solira.org       GPG keyID #7044D601
> > 
> > Articolo 11 - L'Italia ripudia la guerra come strumento di offesa
> > alla libertà degli altri popoli e come mezzo di risoluzione delle
> > controversie internazionali....
> > 
> 
> 
> -- 
> ------------- Codito, ergo sum - "I code, therefore I am"
> -------------- The Rasterman (Carsten Haitzler)
> raster@rasterman.com _________
> Tokyo, Japan (______ ______)
> 

 Hello!

 Well, apologizes, it's my fault. Strangely, it is working fine in my
box with translation (gettext 0.14.4)... Well, here are a patch
attached to add &hellip; and some other missing escape charaters
support to evas_textblock, so that it can be used.

 Cheers!

                                       ilLogict
Index: libs/evas/src/lib/canvas/evas_object_textblock.c
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/lib/canvas/evas_object_textblock.c,v
retrieving revision 1.126
diff -u -r1.126 evas_object_textblock.c
--- libs/evas/src/lib/canvas/evas_object_textblock.c	1 Mar 2006 03:48:02 -0000	1.126
+++ libs/evas/src/lib/canvas/evas_object_textblock.c	9 May 2006 18:24:32 -0000
@@ -440,7 +440,7 @@
      }
 }
 
-/* table of html escapes (that i can find) this shoudl be ordered with the
+/* table of html escapes (that i can find) this should be ordered with the
  * most common first as it's a linear search to match - no hash for this
  */
 static const char *_escapes[] = 
@@ -449,11 +449,12 @@
      "&lt;", "<",
      "&gt;", ">",
      "&amp;", "&",
-     "&nbsp;", " ", /* NOTE: we will allow nbsp's to break as we map early - maybe map to ascii 0x01 and then make the rendring code think 0x01 -> 0x20 */
+     "&nbsp;", " ", /* NOTE: we will allow nbsp's to break as we map early - maybe map to ascii 0x01 and then make the rendering code think 0x01 -> 0x20 */
      "&quot;", "\"",
      /* all the rest */
      "&copy;", "©",
      "&reg;", "®",
+     "&hellip;", "â?¦",
      "&Ntilde;", "Ã?",
      "&ntilde;", "ñ",
      "&Ccedil;", "Ã?",
@@ -471,6 +472,7 @@
      "&pound;", "£",
      "&curren;", "¤",
      "&yen;", "Â¥",
+     "&euro;", "â?¬",
      "&sect;", "§",
      "&para;", "¶",
      "&laquo;", "«",
@@ -583,6 +585,7 @@
      "&theta;", "θ",
      "&iota;", "ι",
      "&kappa;", "κ",
+     "&lambda;", "λ",
      "&mu;", "μ",
      "&nu;", "ν",
      "&omicron;", "ο",
@@ -596,6 +599,30 @@
      "&chi;", "Ï?",
      "&psi;", "Ï?",
      "&omega;", "Ï?"
+     "&Alpha;", "Î?",
+     "&Beta;", "Î?",
+     "&Gamma;", "Î?",
+     "&Delta;", "Î?",
+     "&Epsilon;", "Î?",
+     "&Zeta;", "Î?",
+     "&Eta;", "Î?",
+     "&Theta;", "Î?",
+     "&Iota;", "Î?",
+     "&Kappa;", "Î?",
+     "&Lambda;", "Î?",
+     "&Mu;", "Î?",
+     "&Nu;", "Î?",
+     "&Omicron;", "Î?",
+     "&Xi;", "Î?",
+     "&Pi;", "Π",
+     "&Rho;", "Ρ",
+     "&Sigma;", "Σ",
+     "&Tau;", "Τ",
+     "&Upsilon;", "Î¥",
+     "&Phi;", "Φ",
+     "&Chi;", "Χ",
+     "&Psi;", "Ψ",
+     "&Omega;", "Ω"
 };
 
 static int
@@ -784,7 +811,7 @@
 	    ((fmt->font.fallbacks) && (strcmp(fmt->font.fallbacks, param))))
 	  {
 	     /* policy - when we say "fallbacks" do we prepend and use prior
-	      * fallbacks... or shoudl we replace. for nwo we replace
+	      * fallbacks... or should we replace. for now we replace
 	      */
 	     if (fmt->font.fallbacks) evas_stringshare_del(fmt->font.fallbacks);
 	     fmt->font.fallbacks = evas_stringshare_add(param);
@@ -1079,7 +1106,7 @@
 	     if (item)
 	       {
 		  ds = item;
-		  for (ds = item, ss = s1; ss < s2; ss++, ds++)
+		  for (ss = s1; ss < s2; ss++, ds++)
 		    {
 		       if ((*ss == '\\') && (ss < (s2 - 1))) ss++;
 		       *ds = *ss;
@@ -1102,7 +1129,7 @@
    
    s = str;
 
-   /* get rid of anything +'s or -'s off the start of the string */
+   /* get rid of anything +s or -s off the start of the string */
    while ((*s == ' ') || (*s == '+') || (*s == '-')) s++;
 
    while ((item = _format_parse(&s)))
@@ -1855,7 +1882,7 @@
 	if (h_ret) *h_ret = 0;
 	return;
      }
-   /* run thru all text and format nodes generating lines */
+   /* run through all text and format nodes generating lines */
    for (l = (Evas_Object_List *)c->o->nodes; l; l = l->next)
      {
 	Evas_Object_Textblock_Node *n;
@@ -2461,37 +2488,26 @@
 							    &slen, &salloc);
 			    break;
 			 }
-		       else if (*p == '<')
-			 {
-			    o->markup_text = _strbuf_append_n(o->markup_text,
-							      ps, p - ps,
-							      &slen, &salloc);
-			    o->markup_text = _strbuf_append(o->markup_text,
-							    "&lt;",
-							    &slen, &salloc);
-			    ps = p + 1;
-			 }
-		       else if (*p == '>')
-			 {
-			    o->markup_text = _strbuf_append_n(o->markup_text,
-							      ps, p - ps,
-							      &slen, &salloc);
-			    o->markup_text = _strbuf_append(o->markup_text,
-							    "&gt;",
-							    &slen, &salloc);
-			    ps = p + 1;
-			 }
-		       else if (*p == '&')
+		       else
 			 {
-			    o->markup_text = _strbuf_append_n(o->markup_text,
-							      ps, p - ps,
-							      &slen, &salloc);
-			    o->markup_text = _strbuf_append(o->markup_text,
-							    "&amp;",
-							    &slen, &salloc);
-			    ps = p + 1;
+			    int i;
+
+			    for (i = 1; i < (sizeof(_escapes) / sizeof(char *)); i += 2)
+			      {
+				 if (!strncmp(_escapes[i], p,
+					      strlen(_escapes[i])))
+				   {
+				      o->markup_text = _strbuf_append_n(o->markup_text,
+									ps, p - ps,
+									&slen, &salloc);
+				      o->markup_text = _strbuf_append(o->markup_text,
+								      _escapes[i-1],
+								      &slen, &salloc);
+				      ps = p + strlen(_escapes[i]);
+				      p += strlen(_escapes[i]) - 1;
+				   }
+			      }
 			 }
-		       /* FIXME: learn how to do all the other escapes */
 		       /* FIXME: strip extra whitespace ala HTML */
 		       p++;
 		    }

Attachment: pgpQVH1sCe9wU.pgp
Description: PGP signature