Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] Re: (PR#7006) Re: [freeciv-i18n] header of the .po file pr
Home

[Freeciv-Dev] Re: (PR#7006) Re: [freeciv-i18n] header of the .po file pr

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7006) Re: [freeciv-i18n] header of the .po file printed on tech help
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Sun, 30 Nov 2003 23:50:31 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7006 >

On Sun, Nov 30, 2003 at 02:58:21PM -0800, Christian Knoke wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7006 >
> 
> On Sun, Nov 30, 2003 at 09:03:07PM +0100, Genevieve Gracian wrote:
> > 
> > I recently noticed that the header of the .po file is printed in the
> > help screens about techs. I don't know if I messed up the fr.po of if
> > this is due to delta patch. Can other translators say to me if that also
> > happens for other languages ?
> 
> Yes, it does (for de.po).
> 
> Probably a soure code bug.

Yes. The helptext field is now (with delta) always defined. This
causes the existing checks in helpdata.c to be flawed. The empty
helptext ("") is translated causing the problems mentioned above.

See attached fix.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Your mail could not be delivered to the following Address:
  VTCMC.VTLPR@xxxxxxxxxxxxx        ** Unassigned error message **"

Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.67
diff -u -u -r1.67 helpdata.c
--- client/helpdata.c   2003/11/28 17:37:19     1.67
+++ client/helpdata.c   2003/12/01 07:45:06
@@ -521,8 +521,8 @@
     sprintf(buf+strlen(buf), _("Allows a city to grow larger than size %d.  "),
           game.sewer_size);
   }
-  if (imp->helptext) {
-    sprintf(buf+strlen(buf), "%s  ", _(imp->helptext));
+  if (imp->helptext[0] != '\0') {
+    sprintf(buf + strlen(buf), "%s  ", _(imp->helptext));
   }
   if(which==B_BARRACKS
      && tech_exists(improvement_types[B_BARRACKS].obsolete_by)
@@ -567,8 +567,8 @@
           _("Allows all players with knowledge of %s to build %s units.  "),
           advances[t].name, get_unit_type(u)->name);
   }
-  if (imp->helptext) {
-    sprintf(buf+strlen(buf), "%s  ", _(imp->helptext));
+  if (imp->helptext[0] != '\0') {
+    sprintf(buf + strlen(buf), "%s  ", _(imp->helptext));
   }
   if (strcmp(user_text, "")!=0) {
     sprintf(buf+strlen(buf), "\n\n%s", user_text);
@@ -775,8 +775,8 @@
   if (strlen(buf) > 0) {
     sprintf(buf+strlen(buf), "\n");
   } 
-  if (utype->helptext) {
-    sprintf(buf+strlen(buf), "%s\n\n", _(utype->helptext));
+  if (utype->helptext[0] != '\0') {
+    sprintf(buf + strlen(buf), "%s\n\n", _(utype->helptext));
   }
   strcpy(buf+strlen(buf), user_text);
   wordwrap_string(buf, 68);
@@ -885,6 +885,12 @@
            units_str);
     free((void *) units_str);
   }
+  if (advances[i].helptext[0] != '\0') {
+    if (strlen(buf) > 0) {
+      sprintf(buf + strlen(buf), "\n");
+    }
+    sprintf(buf + strlen(buf), "%s\n", _(advances[i].helptext));
+  }
 }
 
 /****************************************************************
@@ -900,7 +906,7 @@
     return;
 
   pt = &tile_types[i];
-  if (pt->helptext) {
+  if (pt->helptext[0] != '\0') {
     sprintf(buf, "%s\n\n", _(pt->helptext));
   }
   strcat(buf, user_text);
@@ -916,7 +922,7 @@
   
   buf[0] = '\0';
   
-  if (gov->helptext) {
+  if (gov->helptext[0] != '\0') {
     sprintf(buf, "%s\n\n", _(gov->helptext));
   }
   strcat(buf, user_text);
Index: client/gui-gtk/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/helpdlg.c,v
retrieving revision 1.63
diff -u -u -r1.63 helpdlg.c
--- client/gui-gtk/helpdlg.c    2003/04/04 15:47:46     1.63
+++ client/gui-gtk/helpdlg.c    2003/12/01 07:45:06
@@ -816,10 +816,6 @@
     gtk_widget_show_all(help_tree_buttons_hbox);
 
     helptext_tech(buf, i, pitem->text);
-    if (advances[i].helptext) {
-      if (strlen(buf)) strcat(buf, "\n");
-      sprintf(buf+strlen(buf), "%s\n", _(advances[i].helptext));
-    }
     wordwrap_string(buf, 68);
 
     w = gtk_label_new(buf);
Index: client/gui-gtk-2.0/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/helpdlg.c,v
retrieving revision 1.25
diff -u -u -r1.25 helpdlg.c
--- client/gui-gtk-2.0/helpdlg.c        2003/06/03 20:51:29     1.25
+++ client/gui-gtk-2.0/helpdlg.c        2003/12/01 07:45:07
@@ -871,12 +871,6 @@
 
     helptext_tech(buf, i, pitem->text);
     len = strlen(buf);
-    if (advances[i].helptext) {
-      if (len) strcat(buf, "\n");
-      sprintf(buf+len, "%s\n", _(advances[i].helptext));
-      len = strlen(buf);
-    }
-
     my_chomp(buf, len);
 
     w = gtk_text_view_new();
Index: client/gui-win32/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/helpdlg.c,v
retrieving revision 1.16
diff -u -u -r1.16 helpdlg.c
--- client/gui-win32/helpdlg.c  2003/04/04 15:47:48     1.16
+++ client/gui-win32/helpdlg.c  2003/12/01 07:45:08
@@ -765,10 +765,6 @@
          TECH_TREE_EXPANDED_DEPTH, NULL);
     */
     helptext_tech(buf, i, pitem->text);
-    if (advances[i].helptext) {
-      if (strlen(buf)) strcat(buf, "\n");
-      sprintf(buf+strlen(buf), "%s\n", _(advances[i].helptext));
-    }
     wordwrap_string(buf, 68);
     fcwin_box_add_static(helpdlg_page_vbox,buf,0,SS_LEFT,FALSE,FALSE,5);
 

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