From 7ba41e21375a5350c6439fc8941483b10a62b226 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 4 Feb 2023 21:06:09 +0200 Subject: [PATCH 19/19] Qualify core domain "none" and "custom" Qualify "none" and "None" strings, also adjusting case as needed. For consistency with "none" cma settings, qualify also "custom" one. Ruledit strings not touched. See osdn #46001 Signed-off-by: Marko Lindqvist --- client/agents/cma_fec.c | 4 +-- client/gui-gtk-2.0/cityrep.c | 64 +++++++++++++++++---------------- client/gui-gtk-3.0/cityrep.c | 67 ++++++++++++++++++----------------- client/gui-gtk-3.22/cityrep.c | 60 ++++++++++++++++--------------- client/gui-qt/repodlgs.cpp | 30 ++++++++-------- client/gui-sdl2/citydlg.c | 6 ++-- client/text.c | 2 ++ 7 files changed, 122 insertions(+), 111 deletions(-) diff --git a/client/agents/cma_fec.c b/client/agents/cma_fec.c index 1452072f14..c6ed547ccb 100644 --- a/client/agents/cma_fec.c +++ b/client/agents/cma_fec.c @@ -223,7 +223,7 @@ const char *cmafec_get_short_descr_of_city(const struct city *pcity) struct cm_parameter parameter; if (!cma_is_city_under_agent(pcity, ¶meter)) { - return _("none"); + return Q_("?cma:none"); } else { return cmafec_get_short_descr(¶meter); } @@ -239,7 +239,7 @@ const char *cmafec_get_short_descr(const struct cm_parameter *const int idx = cmafec_preset_get_index_of_parameter(parameter); if (idx == -1) { - return _("custom"); + return Q_("?cma:custom"); } else { return cmafec_preset_get_descr(idx); } diff --git a/client/gui-gtk-2.0/cityrep.c b/client/gui-gtk-2.0/cityrep.c index 3bcf0b7c34..5a11919d0e 100644 --- a/client/gui-gtk-2.0/cityrep.c +++ b/client/gui-gtk-2.0/cityrep.c @@ -61,8 +61,8 @@ #define NEG_VAL(x) ((x)<0 ? (x) : (-x)) /* Some versions of gcc have problems with negative values here (PR#39722). */ -#define CMA_NONE (10000) -#define CMA_CUSTOM (10001) +#define CMA_NONE (10000) +#define CMA_CUSTOM (10001) struct sell_data { int count; /* Number of cities. */ @@ -734,10 +734,10 @@ static void select_cma_callback(GtkWidget * w, gpointer data) } /**************************************************************** - Create the cma entries in the change menu and the select menu. The - indices CMA_NONE and CMA_CUSTOM are special. - CMA_NONE signifies a preset of "none" and CMA_CUSTOM a - "custom" preset. + Create the cma entries in the change menu and the select menu. + The indices CMA_NONE and CMA_CUSTOM are special. + CMA_NONE signifies a preset of "none" and CMA_CUSTOM a + "custom" preset. *****************************************************************/ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) { @@ -759,7 +759,7 @@ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) gtk_menu_item_set_submenu(parent_item, menu); if (change_cma) { - w = gtk_menu_item_new_with_label(_("none")); + w = gtk_menu_item_new_with_label(Q_("?cma:none")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback), GINT_TO_POINTER(CMA_NONE)); @@ -773,69 +773,71 @@ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) fc_assert(GPOINTER_TO_INT(GINT_TO_POINTER(i)) == i); } } else { - /* search for a "none" */ + /* Search for a "none" */ int found; found = 0; city_list_iterate(client.conn.playing->cities, pcity) { if (!cma_is_city_under_agent(pcity, NULL)) { - found = 1; - break; + found = 1; + break; } } city_list_iterate_end; if (found) { - w = gtk_menu_item_new_with_label(_("none")); + w = gtk_menu_item_new_with_label(Q_("?cma:none")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback), - GINT_TO_POINTER(CMA_NONE)); + GINT_TO_POINTER(CMA_NONE)); } - /* + /* * Search for a city that's under custom (not preset) agent. Might * take a lonnggg time. */ found = 0; city_list_iterate(client.conn.playing->cities, pcity) { if (cma_is_city_under_agent(pcity, ¶meter) && - cmafec_preset_get_index_of_parameter(¶meter) == -1) { - found = 1; - break; + cmafec_preset_get_index_of_parameter(¶meter) == -1) { + found = 1; + break; } } city_list_iterate_end; if (found) { - /* we found city that's under agent but not a preset */ - w = gtk_menu_item_new_with_label(_("custom")); + /* We found city that's under agent but not a preset */ + w = gtk_menu_item_new_with_label(Q_("?cma:custom")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", - G_CALLBACK(select_cma_callback), GINT_TO_POINTER(CMA_CUSTOM)); + G_CALLBACK(select_cma_callback), + GINT_TO_POINTER(CMA_CUSTOM)); } - /* only fill in presets that are being used. */ + /* Only fill in presets that are being used. */ for (i = 0; i < cmafec_preset_num(); i++) { found = 0; city_list_iterate(client.conn.playing->cities, pcity) { - if (cma_is_city_under_agent(pcity, ¶meter) && - cm_are_parameter_equal(¶meter, - cmafec_preset_get_parameter(i))) { - found = 1; - break; - } + if (cma_is_city_under_agent(pcity, ¶meter) && + cm_are_parameter_equal(¶meter, + cmafec_preset_get_parameter(i))) { + found = 1; + break; + } } city_list_iterate_end; + if (found) { - w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i)); + w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i)); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); - g_signal_connect(w, "activate", - G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i)); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); + g_signal_connect(w, "activate", + G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i)); } } } g_object_set_data(G_OBJECT(menu), "freeciv_change_cma", - GINT_TO_POINTER(change_cma)); + GINT_TO_POINTER(change_cma)); gtk_widget_show_all(menu); } diff --git a/client/gui-gtk-3.0/cityrep.c b/client/gui-gtk-3.0/cityrep.c index 5a8ac19541..b50e08c30b 100644 --- a/client/gui-gtk-3.0/cityrep.c +++ b/client/gui-gtk-3.0/cityrep.c @@ -61,8 +61,8 @@ #define NEG_VAL(x) ((x)<0 ? (x) : (-x)) /* Some versions of gcc have problems with negative values here (PR#39722). */ -#define CMA_NONE (10000) -#define CMA_CUSTOM (10001) +#define CMA_NONE (10000) +#define CMA_CUSTOM (10001) struct sell_data { int count; /* Number of cities. */ @@ -742,12 +742,13 @@ static void select_cma_callback(GtkWidget * w, gpointer data) } /**************************************************************** - Create the cma entries in the change menu and the select menu. The - indices CMA_NONE and CMA_CUSTOM are special. - CMA_NONE signifies a preset of "none" and CMA_CUSTOM a - "custom" preset. + Create the cma entries in the change menu and the select menu. + The indices CMA_NONE and CMA_CUSTOM are special. + CMA_NONE signifies a preset of "none" and CMA_CUSTOM a + "custom" preset. *****************************************************************/ -static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) +static void append_cma_to_menu_item(GtkMenuItem *parent_item, + bool change_cma) { GtkWidget *menu; int i; @@ -767,7 +768,7 @@ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) gtk_menu_item_set_submenu(parent_item, menu); if (change_cma) { - w = gtk_menu_item_new_with_label(_("none")); + w = gtk_menu_item_new_with_label(Q_("?cma:none")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback), GINT_TO_POINTER(CMA_NONE)); @@ -781,69 +782,71 @@ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) fc_assert(GPOINTER_TO_INT(GINT_TO_POINTER(i)) == i); } } else { - /* search for a "none" */ + /* Search for a "none" */ int found; found = 0; city_list_iterate(client.conn.playing->cities, pcity) { if (!cma_is_city_under_agent(pcity, NULL)) { - found = 1; - break; + found = 1; + break; } } city_list_iterate_end; if (found) { - w = gtk_menu_item_new_with_label(_("none")); + w = gtk_menu_item_new_with_label(Q_("?cma:none")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback), - GINT_TO_POINTER(CMA_NONE)); + GINT_TO_POINTER(CMA_NONE)); } - /* + /* * Search for a city that's under custom (not preset) agent. Might * take a lonnggg time. */ found = 0; city_list_iterate(client.conn.playing->cities, pcity) { if (cma_is_city_under_agent(pcity, ¶meter) && - cmafec_preset_get_index_of_parameter(¶meter) == -1) { - found = 1; - break; + cmafec_preset_get_index_of_parameter(¶meter) == -1) { + found = 1; + break; } } city_list_iterate_end; if (found) { - /* we found city that's under agent but not a preset */ - w = gtk_menu_item_new_with_label(_("custom")); + /* We found city that's under agent but not a preset */ + w = gtk_menu_item_new_with_label(Q_("?cma:custom")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", - G_CALLBACK(select_cma_callback), GINT_TO_POINTER(CMA_CUSTOM)); + G_CALLBACK(select_cma_callback), + GINT_TO_POINTER(CMA_CUSTOM)); } - /* only fill in presets that are being used. */ + /* Only fill in presets that are being used. */ for (i = 0; i < cmafec_preset_num(); i++) { found = 0; city_list_iterate(client.conn.playing->cities, pcity) { - if (cma_is_city_under_agent(pcity, ¶meter) && - cm_are_parameter_equal(¶meter, - cmafec_preset_get_parameter(i))) { - found = 1; - break; - } + if (cma_is_city_under_agent(pcity, ¶meter) && + cm_are_parameter_equal(¶meter, + cmafec_preset_get_parameter(i))) { + found = 1; + break; + } } city_list_iterate_end; + if (found) { - w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i)); + w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i)); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); - g_signal_connect(w, "activate", - G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i)); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); + g_signal_connect(w, "activate", + G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i)); } } } g_object_set_data(G_OBJECT(menu), "freeciv_change_cma", - GINT_TO_POINTER(change_cma)); + GINT_TO_POINTER(change_cma)); gtk_widget_show_all(menu); } diff --git a/client/gui-gtk-3.22/cityrep.c b/client/gui-gtk-3.22/cityrep.c index 6bd6449009..611fda2fcd 100644 --- a/client/gui-gtk-3.22/cityrep.c +++ b/client/gui-gtk-3.22/cityrep.c @@ -61,8 +61,8 @@ #define NEG_VAL(x) ((x)<0 ? (x) : (-x)) /* Some versions of gcc have problems with negative values here (PR#39722). */ -#define CMA_NONE (10000) -#define CMA_CUSTOM (10001) +#define CMA_NONE (10000) +#define CMA_CUSTOM (10001) struct sell_data { int count; /* Number of cities. */ @@ -742,10 +742,10 @@ static void select_cma_callback(GtkWidget * w, gpointer data) } /**************************************************************** - Create the cma entries in the change menu and the select menu. The - indices CMA_NONE and CMA_CUSTOM are special. - CMA_NONE signifies a preset of "none" and CMA_CUSTOM a - "custom" preset. + Create the cma entries in the change menu and the select menu. + The indices CMA_NONE and CMA_CUSTOM are special. + CMA_NONE signifies a preset of "none" and CMA_CUSTOM a + "custom" preset. *****************************************************************/ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) { @@ -767,7 +767,7 @@ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) gtk_menu_item_set_submenu(parent_item, menu); if (change_cma) { - w = gtk_menu_item_new_with_label(_("none")); + w = gtk_menu_item_new_with_label(Q_("?cma:none")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback), GINT_TO_POINTER(CMA_NONE)); @@ -781,69 +781,71 @@ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) fc_assert(GPOINTER_TO_INT(GINT_TO_POINTER(i)) == i); } } else { - /* search for a "none" */ + /* Search for a "none" */ int found; found = 0; city_list_iterate(client.conn.playing->cities, pcity) { if (!cma_is_city_under_agent(pcity, NULL)) { - found = 1; - break; + found = 1; + break; } } city_list_iterate_end; if (found) { - w = gtk_menu_item_new_with_label(_("none")); + w = gtk_menu_item_new_with_label(Q_("?cma:none")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback), - GINT_TO_POINTER(CMA_NONE)); + GINT_TO_POINTER(CMA_NONE)); } - /* + /* * Search for a city that's under custom (not preset) agent. Might * take a lonnggg time. */ found = 0; city_list_iterate(client.conn.playing->cities, pcity) { if (cma_is_city_under_agent(pcity, ¶meter) && - cmafec_preset_get_index_of_parameter(¶meter) == -1) { - found = 1; - break; + cmafec_preset_get_index_of_parameter(¶meter) == -1) { + found = 1; + break; } } city_list_iterate_end; if (found) { - /* we found city that's under agent but not a preset */ - w = gtk_menu_item_new_with_label(_("custom")); + /* We found city that's under agent but not a preset */ + w = gtk_menu_item_new_with_label(Q_("?cma:custom")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", - G_CALLBACK(select_cma_callback), GINT_TO_POINTER(CMA_CUSTOM)); + G_CALLBACK(select_cma_callback), + GINT_TO_POINTER(CMA_CUSTOM)); } - /* only fill in presets that are being used. */ + /* Only fill in presets that are being used. */ for (i = 0; i < cmafec_preset_num(); i++) { found = 0; city_list_iterate(client.conn.playing->cities, pcity) { - if (cma_is_city_under_agent(pcity, ¶meter) && - cm_are_parameter_equal(¶meter, - cmafec_preset_get_parameter(i))) { - found = 1; - break; + if (cma_is_city_under_agent(pcity, ¶meter) && + cm_are_parameter_equal(¶meter, + cmafec_preset_get_parameter(i))) { + found = 1; + break; } } city_list_iterate_end; + if (found) { - w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i)); + w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i)); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), w); g_signal_connect(w, "activate", - G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i)); + G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i)); } } } g_object_set_data(G_OBJECT(menu), "freeciv_change_cma", - GINT_TO_POINTER(change_cma)); + GINT_TO_POINTER(change_cma)); gtk_widget_show_all(menu); } diff --git a/client/gui-qt/repodlgs.cpp b/client/gui-qt/repodlgs.cpp index d97310de88..0b935872b3 100644 --- a/client/gui-qt/repodlgs.cpp +++ b/client/gui-qt/repodlgs.cpp @@ -1156,20 +1156,22 @@ void real_science_report_dialog_update(void *unused) bool blk = false; QWidget *w; QString str; - - if (NULL != client.conn.playing) { - struct research *research = research_get(client_player()); - if (research->researching == A_UNSET) { - str = QString(_("none")); - } else if (research->client.researching_cost != 0) { - str = research_advance_name_translation(research,research->researching); - percent = 100 *research->bulbs_researched / research->client.researching_cost; - str = str + "\n (" + QString::number(percent) + "%)"; - } - if (research->researching == A_UNSET && research->tech_goal == A_UNSET - && research->techs_researched < game.control.num_tech_types) { - blk = true; - } + struct player *plr = client_player(); + + if (NULL != plr) { + struct research *research = research_get(plr); + + if (research->researching == A_UNSET) { + str = QString(Q_("?tech:None")); + } else if (research->client.researching_cost != 0) { + str = research_advance_name_translation(research,research->researching); + percent = 100 *research->bulbs_researched / research->client.researching_cost; + str = str + "\n (" + QString::number(percent) + "%)"; + } + if (research->researching == A_UNSET && research->tech_goal == A_UNSET + && research->techs_researched < game.control.num_tech_types) { + blk = true; + } } else { str = " "; } diff --git a/client/gui-sdl2/citydlg.c b/client/gui-sdl2/citydlg.c index 8f0135ad20..0ef3695f52 100644 --- a/client/gui-sdl2/citydlg.c +++ b/client/gui-sdl2/citydlg.c @@ -2006,7 +2006,7 @@ static void redraw_info_city_dialog(struct widget *pCityWindow, alphablit(pSurf, NULL, pCityWindow->dst->surface, &dest, 255); - /* blit trade icon */ + /* Blit trade icon */ dest.x += pSurf->w + adj_size(3); dest.y += adj_size(4); alphablit(pIcons->pTrade, NULL, pCityWindow->dst->surface, &dest, 255); @@ -2018,7 +2018,7 @@ static void redraw_info_city_dialog(struct widget *pCityWindow, FREESURFACE(pSurf); } trade_routes_iterate_end; - if (step) { + if (step > 0) { fc_snprintf(cBuf, sizeof(cBuf), _("Trade: +%d"), step); copy_chars_to_utf8_str(pstr, cBuf); @@ -2031,7 +2031,7 @@ static void redraw_info_city_dialog(struct widget *pCityWindow, FREESURFACE(pSurf); } else { - fc_snprintf(cBuf, sizeof(cBuf), _("none")); + fc_snprintf(cBuf, sizeof(cBuf), Q_("?trade:None")); copy_chars_to_utf8_str(pstr, cBuf); diff --git a/client/text.c b/client/text.c index e8f1a41d17..770013d8b6 100644 --- a/client/text.c +++ b/client/text.c @@ -1814,9 +1814,11 @@ const char *text_happiness_nationality(const struct city *pcity) } if (enemies == 0) { + /* TRANS: No enemy nationalities, as there's no enemies present. */ astr_add(&str, _("None.")); } } else { + /* TRANS: No nationalities present. */ astr_add(&str, _("Disabled.")); } -- 2.39.1