<URL: http://bugs.freeciv.org/Ticket/Display.html?id=19049 >

On 7/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> #: client/text.c:176 client/gui-sdl/mapview.c:626
> msgid " with "
>
> This string needs a translator comment at the least, but it is also
> buggy: sentences of any sort should not be split up like this, they
> should be produced with e.g. "%s with %s" (and translator-commented) so
> that we can move the with to be somewhere else as well if needed.

 This patch improves this particular case a bit. We still produce
string with concatenating different strings instead of using any kind
of translatable format ("%s with %s, %s and %s"), but at least this
makes parts translatable.
 There is four translatable parts. First is start of list (" with "),
second is between most items (", "), third one is before last item ("
and ") and fourth one is in the end (nothing in English version).
 This improves also English version by providing 'and' instead of ','
between two last items.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/mapview.c freeciv/client/gui-sdl/mapview.c
--- freeciv/client/gui-sdl/mapview.c	2007-03-05 21:12:14.000000000 +0200
+++ freeciv/client/gui-sdl/mapview.c	2007-03-11 03:09:22.000000000 +0200
@@ -776,31 +776,34 @@
             	  
 	    citywall = city_got_citywalls(pTile->city);
                           
-#if 0                          
+#if 0       
+            /* This has hardcoded assumption that EFT_LAND_REGEN is always
+             * provided by *building* named *Barracks*. Similar assumptions for
+             * other effects. */     
 	    if (pplayers_allied(game.player_ptr, pOwner)) {
 	      barrack = (get_city_bonus(pTile->city, EFT_LAND_REGEN) > 0);
 	      airport = (get_city_bonus(pTile->city, EFT_AIR_VETERAN) > 0);
 	      port = (get_city_bonus(pTile->city, EFT_SEA_VETERAN) > 0);
 	    }
-	  
+
 	    if (citywall || barrack || airport || port) {
-	      cat_snprintf(buffer, sizeof(buffer), _(" with "));
+	      cat_snprintf(buffer, sizeof(buffer), Q_("?bliststart: with "));
 	      if (barrack) {
                 cat_snprintf(buffer, sizeof(buffer), _("Barracks"));
 	        if (port || airport || citywall) {
-	          cat_snprintf(buffer, sizeof(buffer), ", ");
+	          cat_snprintf(buffer, sizeof(buffer), Q_("?blistmore:, "));
 	        }
 	      }
 	      if (port) {
 	        cat_snprintf(buffer, sizeof(buffer), _("Port"));
 	        if (airport || citywall) {
-	          cat_snprintf(buffer, sizeof(buffer), ", ");
+	          cat_snprintf(buffer, sizeof(buffer), Q_("?blistmore:, "));
 	        }
 	      }
 	      if (airport) {
 	        cat_snprintf(buffer, sizeof(buffer), _("Airport"));
 	        if (citywall) {
-	          cat_snprintf(buffer, sizeof(buffer), ", ");
+	          cat_snprintf(buffer, sizeof(buffer), Q_("?blistmore:, "));
 	        }
 	      }
 	      if (citywall) {
diff -Nurd -X.diff_ignore freeciv/client/text.c freeciv/client/text.c
--- freeciv/client/text.c	2007-03-05 21:12:22.000000000 +0200
+++ freeciv/client/text.c	2007-03-11 03:09:23.000000000 +0200
@@ -142,6 +142,7 @@
      * borders are in use). */
     struct player *owner = city_owner(pcity);
     bool has_improvements = FALSE;
+    int prev_impr = B_LAST;
 
     if (!game.player_ptr || owner == game.player_ptr){
       /* TRANS: "City: Warsaw (Polish)" */
@@ -170,17 +171,29 @@
     impr_type_iterate(i) {
       if (is_improvement_visible(i) && city_got_building(pcity, i)) {
 	/* TRANS: previous lines gave other information about the city. */
-	if (has_improvements) {
-	  astr_add(&str, ", ");
-	} else {
-	  astr_add(&str, _(" with "));
-	}
-
-	astr_add(&str, get_improvement_name(i));
-	has_improvements = TRUE;
+        if (prev_impr != B_LAST) {
+          if (has_improvements) {
+            astr_add(&str, Q_("?blistmore:, "));
+          }
+          astr_add(&str, get_improvement_name(prev_impr));
+          has_improvements = TRUE;
+        } else {
+          astr_add(&str, Q_("?bliststart: with "));
+        }
+        prev_impr = i;
       }
     } impr_type_iterate_end;
 
+    if (prev_impr != B_LAST) {
+      if (has_improvements) {
+        /* More than one improvement */
+        /* TRANS: This does not appear if there is only one building in the list */
+        astr_add(&str, Q_("?blistlast: and "));
+      }
+      astr_add(&str, get_improvement_name(prev_impr));
+      astr_add(&str, Q_("?blistend:"));
+    }
+
     unit_list_iterate(get_units_in_focus(), pfocus_unit) {
       struct city *hcity = find_city_by_id(pfocus_unit->homecity);
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to