Author: jtn
Date: Tue Aug  4 11:15:56 2015
New Revision: 29315

URL: http://svn.gna.org/viewcvs/freeciv?rev=29315&view=rev
Log:
Fix unit nationality text in tooltips.

See gna bug #23740.

Modified:
    trunk/client/text.c

Modified: trunk/client/text.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/text.c?rev=29315&r1=29314&r2=29315&view=diff
==============================================================================
--- trunk/client/text.c (original)
+++ trunk/client/text.c Tue Aug  4 11:15:56 2015
@@ -340,16 +340,26 @@
     if (!client_player() || owner == client_player()) {
       struct city *pcity = player_city_by_number(owner, punit->homecity);
 
-      if (pcity) {
-        /* TRANS: "Unit: <unit type> | <username>
-         * (<nation + team>, <homecity>)" */
-        astr_add_line(&str, _("Unit: %s | %s (%s, %s)"),
-                      utype_name_translation(ptype), username,
-                      nation, city_name(pcity));
-      } else {
-        /* TRANS: "Unit: <unit type> | <username> (<nation + team>)" */
-        astr_add_line(&str, _("Unit: %s | %s (%s)"),
-                      utype_name_translation(ptype), username, nation);
+      /* TRANS: "Unit: <unit type> | <username> (<nation + team>)" */
+      astr_add_line(&str, _("Unit: %s | %s (%s)"),
+                    utype_name_translation(ptype), username, nation);
+
+      if (game.info.citizen_nationality
+          && unit_nationality(punit) != unit_owner(punit)) {
+        if (pcity) {
+          /* TRANS: on own line immediately following \n, "from <city> |
+           * <nationality> people" */
+          astr_add_line(&str, _("from %s | %s people"), city_name(pcity),
+                        nation_adjective_for_player(unit_nationality(punit)));
+        } else {
+          /* TRANS: Nationality of the people comprising a unit, if
+           * different from owner. */
+          astr_add_line(&str, _("%s people"),
+                        nation_adjective_for_player(unit_nationality(punit)));
+        }
+      } else if (pcity) {
+        /* TRANS: on own line immediately following \n, ... <city> */
+        astr_add_line(&str, _("from %s"), city_name(pcity));
       }
     } else if (NULL != owner) {
       struct player_diplstate *ds = player_diplstate_get(client_player(),
@@ -476,6 +486,7 @@
 
 /****************************************************************************
   Returns the unit description.
+  Used in e.g. city report tooltips.
 
   FIXME: This function is not re-entrant because it returns a pointer to
   static data.
@@ -506,8 +517,9 @@
 
   if (pplayer == owner) {
     unit_upkeep_astr(punit, &str);
-  }
-  astr_add(&str, "\n");
+  } else {
+    astr_add(&str, "\n");
+  }
   unit_activity_astr(punit, &str);
 
   if (pcity) {
@@ -518,8 +530,10 @@
   }
   if (game.info.citizen_nationality) {
     if (nationality != NULL && owner != nationality) {
-      /* TRANS: Nationality of the soldiers in unit, can be different from 
owner. */
-      astr_add(&str, _("%s people"), nation_adjective_for_player(nationality));
+      /* TRANS: Nationality of the people comprising a unit, if
+       * different from owner. */
+      astr_add_line(&str, _("%s people"),
+                    nation_adjective_for_player(nationality));
     } else {
       astr_add(&str, "\n");
     }
@@ -1075,9 +1089,12 @@
 
       /* Line 5, nationality text */
       if (nationality != NULL && owner != nationality) {
-        astr_add(&str, _("%s people"), 
nation_adjective_for_player(nationality));
+        /* TRANS: Nationality of the people comprising a unit, if
+         * different from owner. */
+        astr_add_line(&str, _("%s people"),
+                      nation_adjective_for_player(nationality));
       } else {
-        astr_add(&str, " ");
+        astr_add_line(&str, " ");
       }
     }
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to