Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2002:
[Freeciv-Dev] Using gettext in client/helpdata.c (PR#1744)
Home

[Freeciv-Dev] Using gettext in client/helpdata.c (PR#1744)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Using gettext in client/helpdata.c (PR#1744)
From: SAWADA Katsuya <ama@xxxxxxxxxxx>
Date: Mon, 15 Jul 2002 12:14:25 -0700 (PDT)

Hi,

Following humble patch makes translation easily.
Old style is no good because I can't swap word order.

-- 
SAWADA, Katsuya

--- helpdata.c.~1.52.~  Fri Mar 29 07:37:42 2002
+++ helpdata.c  Sun Jul 14 03:35:05 2002
@@ -695,22 +695,47 @@
              " or has a 50%% risk of being lost at sea."));
   }
   if (utype->fuel>0) {
-    sprintf(buf+strlen(buf), _("* Must end "));
-    if (utype->fuel==2) {
-      sprintf(buf+strlen(buf), _("second "));
-    } else if (utype->fuel==3) {
-      sprintf(buf+strlen(buf), _("third "));
-    } else if (utype->fuel>=4) {
-      sprintf(buf+strlen(buf), _("%dth "), utype->fuel);
-    }
-    /* FIXME: should use something like get_units_with_flag_string() */
-    sprintf(buf+strlen(buf), _("turn in a city, or on a Carrier"));
+    char mcarrier_buf[128]="";
+    char *carrier=get_units_with_flag_string(F_CARRIER);
     if (unit_type_flag(i, F_MISSILE) &&
        num_role_units(F_MISSILE_CARRIER)>0 &&
        get_unit_type(get_role_unit(F_MISSILE_CARRIER,0))->transport_capacity > 
0) {
-      sprintf(buf+strlen(buf), _(" or Submarine"));
+      char *mcarrier=get_units_with_flag_string(F_MISSILE_CARRIER);
+      snprintf(mcarrier_buf, sizeof(mcarrier_buf),
+               /* TRANS: %1$s may be 'Submarine' */
+               Q_("?help_unit_describe: or %s"), mcarrier);
+      free(mcarrier);
+    } else {
+      snprintf(mcarrier_buf, sizeof(mcarrier_buf),
+               Q_("?help_unit_describe:"));
+    }
+
+    if (utype->fuel==1) {
+      sprintf(buf+strlen(buf),
+              /* TRANS: %1$s may be 'Carrier', %2$s is '?help_unit_describe:' 
*/
+              _("* Must end turn in a city, or on a %s%s"
+                ", or will run out of fuel and be lost.\n"),
+              carrier, mcarrier_buf);
+    } else if (utype->fuel==2) {
+      sprintf(buf+strlen(buf),
+              _("* Must second end turn in a city, or on a %s%s"
+                ", or will run out of fuel and be lost.\n"),
+              carrier, mcarrier_buf);
+    } else if (utype->fuel==3) {
+      sprintf(buf+strlen(buf),
+              _("* Must third end turn in a city, or on a %s%s"
+                ", or will run out of fuel and be lost.\n"),
+              carrier, mcarrier_buf);
+    } else if (utype->fuel>=4) {
+      sprintf(buf+strlen(buf),
+              _("* Must %dth end turn in a city, or on a %s%s"
+                ", or will run out of fuel and be lost.\n"),
+              utype->fuel, carrier, mcarrier_buf);
+    } else {
+      freelog(LOG_FATAL, "Unexpected value utype->fuel");
+      exit(EXIT_FAILURE);
     }
-    sprintf(buf+strlen(buf), _(", or will run out of fuel and be lost.\n"));
+    free(carrier);
   }
   if (strlen(buf) > 0) {
     sprintf(buf+strlen(buf), "\n");



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