<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40692 >
It was suggested on freeciv-i18n that the nation name looks bad in certain locales as an uncapitalized adjective in the civilization frame label (the frame just below the overview a.k.a. minimap). The attached patches changes the function update_info_label() to set the frame label using the nation plural name, and to capitalize the first letter of the translated string. The function my_toupper() is used to set the first char value of the string to uppercase; as far as I can see in the cases where there is no corresponding upper case form for the character, my_toupper() will just return the same value that was passed in, so there should not be any inadvertent string corruption. ----------------------------------------------------------------------- 文字化けしないでください。
diff --git a/client/gui-gtk-2.0/mapview.c b/client/gui-gtk-2.0/mapview.c index 4d4acc2..e691104 100644 --- a/client/gui-gtk-2.0/mapview.c +++ b/client/gui-gtk-2.0/mapview.c @@ -102,11 +102,22 @@ void update_timeout_label(void) void update_info_label( void ) { GtkWidget *label; + const struct player *pplayer = client.conn.playing; label = gtk_frame_get_label_widget(GTK_FRAME(main_frame_civ_name)); - if (NULL != client.conn.playing) { - gtk_label_set_text(GTK_LABEL(label), - nation_plural_for_player(client.conn.playing)); + if (pplayer != NULL) { + char nation[MAX_LEN_NAME]; + + /* Capitalize the first character of the translated nation + * plural name so that the frame label looks good. I assume + * that in the case that capitalization does not make sense + * (e.g. multi-byte characters or no "upper case" form in + * the translation language) my_toupper() will just return + * the same value as was passed into it. */ + sz_strlcpy(nation, nation_plural_for_player(pplayer)); + nation[0] = my_toupper(nation[0]); + + gtk_label_set_text(GTK_LABEL(label), nation); } else { gtk_label_set_text(GTK_LABEL(label), "-"); }
diff --git a/client/gui-gtk-2.0/mapview.c b/client/gui-gtk-2.0/mapview.c index 0c7ece5..0c9412a 100644 --- a/client/gui-gtk-2.0/mapview.c +++ b/client/gui-gtk-2.0/mapview.c @@ -98,11 +98,22 @@ void update_timeout_label(void) void update_info_label( void ) { GtkWidget *label; + const struct player *pplayer = game.player_ptr; label = gtk_frame_get_label_widget(GTK_FRAME(main_frame_civ_name)); - if (game.player_ptr) { - gtk_label_set_text(GTK_LABEL(label), - nation_adjective_for_player(game.player_ptr)); + if (pplayer != NULL) { + char nation[MAX_LEN_NAME]; + + /* Capitalize the first character of the translated nation + * plural name so that the frame label looks good. I assume + * that in the case that capitalization does not make sense + * (e.g. multi-byte characters or no "upper case" form in + * the translation language) my_toupper() will just return + * the same value as was passed into it. */ + sz_strlcpy(nation, nation_plural_for_player(pplayer)); + nation[0] = my_toupper(nation[0]); + + gtk_label_set_text(GTK_LABEL(label), nation); } else { gtk_label_set_text(GTK_LABEL(label), "-"); }
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev