Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2005:
[Freeciv-Dev] Re: (PR#14708) gettext not working correctly in nation sel
Home

[Freeciv-Dev] Re: (PR#14708) gettext not working correctly in nation sel

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: himasaram@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#14708) gettext not working correctly in nation selection dialog
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 27 Nov 2005 18:06:39 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Daniel Markstedt wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=14708 >
> 
> As I mentioned in another ticket, certain strings in the nation 
> selection dialog is not translated correctly. As seen in attached 
> screen, neither nation names nor city styles is translated into the 
> Swedish locale. This applies to nation names in the pregame dialog too, 
> as seen in the background.
> 
> Well in the game erything is translated correctly, though.

Translation isn't done until the game starts apparently.  This patch 
should fix it, though it's not really the best solution: I added a FIXME 
comment to translate_data_names.

Can you check if this bug is present in 2.0?  I suspect it is. 
Obnoxiously I can't get different locales to work now so I can't check.

-jason

Index: common/game.c
===================================================================
--- common/game.c       (revision 11280)
+++ common/game.c       (working copy)
@@ -573,6 +573,13 @@
   (These could be in the separate modules, but since they are
   all almost the same, and all needed together, it seems a bit
   easier to just do them all here.)
+
+  FIXME: Because of the way translate_data_names works, ruleset names
+  aren't normally translated at the client until the game starts.  Obviously
+  this is incorrect.  The current workaround is to duplicate the translation
+  inside packhand.c.  The real solution though is to get rid of the
+  translate_data_names function  and do all translation when the text is
+  first generated.
 ***************************************************************/
 void translate_data_names(void)
 {
Index: client/packhand.c
===================================================================
--- client/packhand.c   (revision 11280)
+++ client/packhand.c   (working copy)
@@ -2082,7 +2082,7 @@
   u = get_unit_type(p->id);
 
   sz_strlcpy(u->name_orig, p->name);
-  u->name = u->name_orig;
+  u->name = Q_(u->name_orig); /* See translate_data_names */
   sz_strlcpy(u->graphic_str, p->graphic_str);
   sz_strlcpy(u->graphic_alt, p->graphic_alt);
   sz_strlcpy(u->sound_move, p->sound_move);
@@ -2143,7 +2143,7 @@
   a = &advances[p->id];
 
   sz_strlcpy(a->name_orig, p->name);
-  a->name = a->name_orig;
+  a->name = Q_(a->name_orig); /* See translate_data_names */
   sz_strlcpy(a->graphic_str, p->graphic_str);
   sz_strlcpy(a->graphic_alt, p->graphic_alt);
   a->req[0] = p->req[0];
@@ -2174,7 +2174,7 @@
 
   b->genus = p->genus;
   sz_strlcpy(b->name_orig, p->name);
-  b->name = b->name_orig;
+  b->name = Q_(b->name_orig); /* See translate_data_names */
   sz_strlcpy(b->graphic_str, p->graphic_str);
   sz_strlcpy(b->graphic_alt, p->graphic_alt);
   for (i = 0; i < p->reqs_count; i++) {
@@ -2259,7 +2259,7 @@
   gov->num_ruler_titles    = p->num_ruler_titles;
     
   sz_strlcpy(gov->name_orig, p->name);
-  gov->name = gov->name_orig;
+  gov->name = Q_(gov->name_orig); /* See translate_data_names */
   sz_strlcpy(gov->graphic_str, p->graphic_str);
   sz_strlcpy(gov->graphic_alt, p->graphic_alt);
 
@@ -2288,11 +2288,13 @@
   }
   gov->ruler_titles[p->id].nation = get_nation_by_idx(p->nation);
   sz_strlcpy(gov->ruler_titles[p->id].male_title_orig, p->male_title);
+  /* See translate_data_names */
   gov->ruler_titles[p->id].male_title
-    = gov->ruler_titles[p->id].male_title_orig;
+    = Q_(gov->ruler_titles[p->id].male_title_orig);
   sz_strlcpy(gov->ruler_titles[p->id].female_title_orig, p->female_title);
+  /* See translate_data_names */
   gov->ruler_titles[p->id].female_title
-    = gov->ruler_titles[p->id].female_title_orig;
+    = Q_(gov->ruler_titles[p->id].female_title_orig);
 }
 
 /**************************************************************************
@@ -2310,7 +2312,7 @@
   }
 
   sz_strlcpy(pterrain->name_orig, p->name_orig);
-  pterrain->name = pterrain->name_orig;
+  pterrain->name = Q_(pterrain->name_orig); /* See translate_data_names */
   sz_strlcpy(pterrain->graphic_str, p->graphic_str);
   sz_strlcpy(pterrain->graphic_alt, p->graphic_alt);
   pterrain->movement_cost = p->movement_cost;
@@ -2323,10 +2325,12 @@
   } output_type_iterate_end;
 
   sz_strlcpy(pterrain->special[0].name_orig, p->special_1_name);
-  pterrain->special[0].name = pterrain->special[0].name_orig;
+  /* See translate_data_names */
+  pterrain->special[0].name = Q_(pterrain->special[0].name_orig);
 
   sz_strlcpy(pterrain->special[1].name_orig, p->special_2_name);
-  pterrain->special[1].name = pterrain->special[1].name_orig;
+  /* See translate_data_names */
+  pterrain->special[1].name = Q_(pterrain->special[1].name_orig);
 
   sz_strlcpy(pterrain->special[0].graphic_str, p->graphic_str_special_1);
   sz_strlcpy(pterrain->special[0].graphic_alt, p->graphic_alt_special_1);
@@ -2383,9 +2387,9 @@
   pl = get_nation_by_idx(p->id);
 
   sz_strlcpy(pl->name_orig, p->name);
-  pl->name = pl->name_orig;
+  pl->name = Q_(pl->name_orig); /* See translate_data_names */
   sz_strlcpy(pl->name_plural_orig, p->name_plural);
-  pl->name_plural = pl->name_plural_orig;
+  pl->name_plural = Q_(pl->name_plural_orig); /* See translate_data_names */
   sz_strlcpy(pl->flag_graphic_str, p->graphic_str);
   sz_strlcpy(pl->flag_graphic_alt, p->graphic_alt);
   pl->leader_count = p->leader_count;
@@ -2446,7 +2450,7 @@
   cs->replaced_by = packet->replaced_by;
 
   sz_strlcpy(cs->name_orig, packet->name);
-  cs->name = cs->name_orig;
+  cs->name = Q_(cs->name_orig); /* See translate_data_names */
   sz_strlcpy(cs->graphic, packet->graphic);
   sz_strlcpy(cs->graphic_alt, packet->graphic_alt);
   sz_strlcpy(cs->citizens_graphic, packet->citizens_graphic);

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