From 4f88ff500ce47c2746e5d1d008d352fa124ce91a Mon Sep 17 00:00:00 2001 From: Hleb Valoshka <375gnu@gmail.com> Date: Tue, 3 Sep 2019 22:59:53 +0300 Subject: [PATCH] Localization for gtk+ frontend --- src/celestia/gtk/actions.cpp | 74 +++++----- src/celestia/gtk/common.cpp | 8 +- src/celestia/gtk/common.h | 25 ++-- src/celestia/gtk/dialog-eclipse.cpp | 20 +-- src/celestia/gtk/dialog-eclipse.h | 26 ++-- src/celestia/gtk/dialog-goto.cpp | 12 +- src/celestia/gtk/dialog-goto.h | 6 +- src/celestia/gtk/dialog-options.cpp | 29 ++-- src/celestia/gtk/dialog-options.h | 12 +- src/celestia/gtk/dialog-solar.cpp | 26 ++-- src/celestia/gtk/dialog-solar.h | 4 +- src/celestia/gtk/dialog-star.cpp | 14 +- src/celestia/gtk/dialog-star.h | 18 +-- src/celestia/gtk/dialog-time.cpp | 32 ++--- src/celestia/gtk/dialog-tour.cpp | 6 +- src/celestia/gtk/main.cpp | 37 +++-- src/celestia/gtk/menu-context.cpp | 38 ++--- src/celestia/gtk/settings-file.cpp | 4 +- src/celestia/gtk/splash.cpp | 2 +- src/celestia/gtk/ui.h | 216 ++++++++++++++-------------- 20 files changed, 309 insertions(+), 300 deletions(-) diff --git a/src/celestia/gtk/actions.cpp b/src/celestia/gtk/actions.cpp index 2dece47c9..2b692d26a 100644 --- a/src/celestia/gtk/actions.cpp +++ b/src/celestia/gtk/actions.cpp @@ -79,7 +79,7 @@ void actionCopyURL(GtkAction*, AppData* app) /* File -> Open URL */ void actionOpenURL(GtkAction*, AppData* app) { - GtkWidget* dialog = gtk_dialog_new_with_buttons("Enter cel:// URL", + GtkWidget* dialog = gtk_dialog_new_with_buttons(_("Enter cel:// URL"), GTK_WINDOW(app->mainWindow), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, @@ -106,7 +106,7 @@ void actionOpenURL(GtkAction*, AppData* app) /* File -> Open Script... */ void actionOpenScript(GtkAction*, AppData* app) { - GtkWidget* fs = gtk_file_chooser_dialog_new("Open Script.", + GtkWidget* fs = gtk_file_chooser_dialog_new(_("Open Script."), GTK_WINDOW(app->mainWindow), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -121,7 +121,7 @@ void actionOpenScript(GtkAction*, AppData* app) gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fs), g_get_home_dir()); GtkFileFilter* filter = gtk_file_filter_new(); - gtk_file_filter_set_name(filter, "Celestia Scripts"); + gtk_file_filter_set_name(filter, _("Celestia Scripts")); gtk_file_filter_add_pattern(filter, "*.cel"); @@ -146,7 +146,7 @@ void actionOpenScript(GtkAction*, AppData* app) /* File -> Capture Image... */ void actionCaptureImage(GtkAction*, AppData* app) { - GtkWidget* fs = gtk_file_chooser_dialog_new("Save Image to File", + GtkWidget* fs = gtk_file_chooser_dialog_new(_("Save Image to File"), GTK_WINDOW(app->mainWindow), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -154,7 +154,7 @@ void actionCaptureImage(GtkAction*, AppData* app) NULL); GtkFileFilter* filter = gtk_file_filter_new(); - gtk_file_filter_set_name(filter, "PNG and JPEG Images"); + gtk_file_filter_set_name(filter, _("PNG and JPEG Images")); gtk_file_filter_add_pattern(filter, "*.jpeg"); gtk_file_filter_add_pattern(filter, "*.jpg"); gtk_file_filter_add_pattern(filter, "*.png"); @@ -196,13 +196,13 @@ void actionCaptureMovie(GtkAction*, AppData* app) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Stop current movie capture before starting another one."); + _("Stop current movie capture before starting another one.")); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); return; } - GtkWidget* fs = gtk_file_chooser_dialog_new("Save Ogg Theora Movie to File", + GtkWidget* fs = gtk_file_chooser_dialog_new(_("Save Ogg Theora Movie to File"), GTK_WINDOW(app->mainWindow), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -210,7 +210,7 @@ void actionCaptureMovie(GtkAction*, AppData* app) NULL); GtkFileFilter* filter = gtk_file_filter_new(); - gtk_file_filter_set_name(filter, "Ogg Files"); + gtk_file_filter_set_name(filter, _("Ogg Files")); gtk_file_filter_add_pattern(filter, "*.ogg"); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fs), filter); @@ -224,18 +224,18 @@ void actionCaptureMovie(GtkAction*, AppData* app) GtkWidget* hbox = gtk_hbox_new(FALSE, CELSPACING); gtk_container_set_border_width(GTK_CONTAINER(hbox), CELSPACING); - GtkWidget* rlabel = gtk_label_new("Aspect Ratio:"); + GtkWidget* rlabel = gtk_label_new(_("Aspect Ratio:")); gtk_box_pack_start(GTK_BOX(hbox), rlabel, TRUE, TRUE, 0); GtkWidget* aspectmenubox = gtk_combo_box_new_text(); - gtk_combo_box_append_text(GTK_COMBO_BOX(aspectmenubox), "1:1"); - gtk_combo_box_append_text(GTK_COMBO_BOX(aspectmenubox), "4:3"); - gtk_combo_box_append_text(GTK_COMBO_BOX(aspectmenubox), "16:9"); - gtk_combo_box_append_text(GTK_COMBO_BOX(aspectmenubox), "Display"); + gtk_combo_box_append_text(GTK_COMBO_BOX(aspectmenubox), _("1:1")); + gtk_combo_box_append_text(GTK_COMBO_BOX(aspectmenubox), _("4:3")); + gtk_combo_box_append_text(GTK_COMBO_BOX(aspectmenubox), _("16:9")); + gtk_combo_box_append_text(GTK_COMBO_BOX(aspectmenubox), _("Display")); gtk_combo_box_set_active(GTK_COMBO_BOX(aspectmenubox), 0); gtk_box_pack_start(GTK_BOX(hbox), aspectmenubox, FALSE, FALSE, 0); - GtkWidget* flabel = gtk_label_new("Frame Rate:"); + GtkWidget* flabel = gtk_label_new(_("Frame Rate:")); gtk_box_pack_start(GTK_BOX(hbox), flabel, TRUE, TRUE, 0); GtkWidget* fpsspin = gtk_spin_button_new_with_range(5.0, 30.0, 0.01); @@ -243,7 +243,7 @@ void actionCaptureMovie(GtkAction*, AppData* app) gtk_spin_button_set_value(GTK_SPIN_BUTTON(fpsspin), 12.0); gtk_spin_button_set_increments(GTK_SPIN_BUTTON(fpsspin), 0.01, 1.0); - GtkWidget* qlabel = gtk_label_new("Video Quality:"); + GtkWidget* qlabel = gtk_label_new(_("Video Quality:")); gtk_box_pack_start(GTK_BOX(hbox), qlabel, TRUE, TRUE, 0); GtkWidget* qspin = gtk_spin_button_new_with_range(0.0, 10.0, 1.0); @@ -275,7 +275,7 @@ void actionCaptureMovie(GtkAction*, AppData* app) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Movie support was not included. To use re-build with --enable-theora."); + _("Movie support was not included. To use re-build with --enable-theora.")); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); #endif @@ -308,7 +308,7 @@ void actionTourGuide(GtkAction*, AppData* app) void actionSearchObject(GtkAction*, AppData* app) { - GtkWidget* dialog = gtk_dialog_new_with_buttons("Select Object", + GtkWidget* dialog = gtk_dialog_new_with_buttons(_("Select Object"), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, @@ -319,7 +319,7 @@ void actionSearchObject(GtkAction*, AppData* app) gtk_container_set_border_width(GTK_CONTAINER(box), CELSPACING); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), box, TRUE, TRUE, 0); - GtkWidget* label = gtk_label_new("Object name"); + GtkWidget* label = gtk_label_new(_("Object name")); gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0); GtkWidget* entry = gtk_entry_new(); @@ -454,7 +454,7 @@ void actionViewerSize(GtkAction*, AppData* app) currentX = app->glArea->allocation.width; currentY = app->glArea->allocation.height; - dialog = gtk_dialog_new_with_buttons("Set Viewer Size...", + dialog = gtk_dialog_new_with_buttons(_("Set Viewer Size..."), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -464,7 +464,7 @@ void actionViewerSize(GtkAction*, AppData* app) GtkWidget* vbox = gtk_vbox_new(FALSE, CELSPACING); gtk_container_set_border_width(GTK_CONTAINER(vbox), CELSPACING); - GtkWidget* label = gtk_label_new("Dimensions for Main Window:"); + GtkWidget* label = gtk_label_new(_("Dimensions for Main Window:")); gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); GtkWidget* menubox = gtk_combo_box_new_text(); @@ -476,12 +476,12 @@ void actionViewerSize(GtkAction*, AppData* app) { if (position == -1 && resolutions[i-1] < currentX && resolutions[i] >= currentX) { - sprintf(res, "%d x %d (current)", currentX, currentY); + sprintf(res, _("%d x %d (current)"), currentX, currentY); position = i - 1; } else if (resolutions[i] < screenX) { - sprintf(res, "%d x %d", resolutions[i], int(0.75 * resolutions[i])); + sprintf(res, _("%d x %d"), resolutions[i], int(0.75 * resolutions[i])); i++; } else @@ -645,7 +645,7 @@ void actionRunDemo(GtkAction*, AppData* app) void actionHelpControls(GtkAction*, AppData* app) { char *txt = readFromFile("controls.txt"); - textInfoDialog(txt, "Mouse and Keyboard Controls", app); + textInfoDialog(txt, _("Mouse and Keyboard Controls"), app); g_free(txt); } @@ -659,17 +659,17 @@ void actionHelpOpenGL(GtkAction*, AppData* app) char* ext = (char*) glGetString(GL_EXTENSIONS); string s; - s = "Vendor: "; + s = _("Vendor: "); if (vendor != NULL) s += vendor; s += "\n"; - s += "Renderer: "; + s += _("Renderer: "); if (render != NULL) s += render; s += "\n"; - s += "Version: "; + s += _("Version: "); if (version != NULL) s += version; s += "\n"; @@ -678,15 +678,15 @@ void actionHelpOpenGL(GtkAction*, AppData* app) GLint simTextures = 1; if (ExtensionSupported("GL_ARB_multitexture")) glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &simTextures); - sprintf(buf, "Max simultaneous textures: %d\n", simTextures); + sprintf(buf, _("Max simultaneous textures: %d\n"), simTextures); s += buf; GLint maxTextureSize = 0; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); - sprintf(buf, "Max texture size: %d\n\n", maxTextureSize); + sprintf(buf, _("Max texture size: %d\n\n"), maxTextureSize); s += buf; - s += "Supported Extensions:\n "; + s += _("Supported Extensions:\n "); if (ext != NULL) { string extString(ext); @@ -699,7 +699,7 @@ void actionHelpOpenGL(GtkAction*, AppData* app) s += extString; } - textInfoDialog(s.c_str(), "Open GL Info", app); + textInfoDialog(s.c_str(), _("Open GL Info"), app); } @@ -1026,7 +1026,7 @@ static void openScript(const char* filename, AppData* app) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Error opening script file."); + _("Error opening script file.")); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); } @@ -1043,7 +1043,7 @@ static void openScript(const char* filename, AppData* app) GtkWidget* errBox = gtk_message_dialog_new(GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, "%s", + GTK_BUTTONS_OK, _("%s"), errorMsg); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); @@ -1062,7 +1062,7 @@ static void openScript(const char* filename, AppData* app) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Bad File Type. Use *.(cel|celx|clx)."); + _("Bad File Type. Use *.(cel|celx|clx).")); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); } @@ -1085,7 +1085,7 @@ static void captureImage(const char* filename, AppData* app) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Unable to determine image file type from name, please use a name ending in '.jpg' or '.png'."); + _("Unable to determine image file type from name, please use a name ending in '.jpg' or '.png'.")); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); return; @@ -1108,7 +1108,7 @@ static void captureImage(const char* filename, AppData* app) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Currently screen capturing to only JPEG or PNG files is supported."); + _("Currently screen capturing to only JPEG or PNG files is supported.")); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); return; @@ -1120,7 +1120,7 @@ static void captureImage(const char* filename, AppData* app) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Error writing captured image."); + _("Error writing captured image.")); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); } @@ -1163,7 +1163,7 @@ static void captureMovie(const char* filename, int aspect, float fps, float qual GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Error initializing movie capture."); + _("Error initializing movie capture.")); gtk_dialog_run(GTK_DIALOG(errBox)); gtk_widget_destroy(errBox); } diff --git a/src/celestia/gtk/common.cpp b/src/celestia/gtk/common.cpp index e77d5673e..c4a621317 100644 --- a/src/celestia/gtk/common.cpp +++ b/src/celestia/gtk/common.cpp @@ -52,7 +52,7 @@ void updateTimeZone(AppData* app, gboolean local) /* Creates a button. Used in several dialogs. */ gint buttonMake(GtkWidget *hbox, const char *txt, GtkSignalFunc func, gpointer data) { - GtkWidget* button = gtk_button_new_with_label(txt); + GtkWidget* button = gtk_button_new_with_label(_(txt)); gtk_box_pack_start(GTK_BOX (hbox), button, TRUE, TRUE, 0); g_signal_connect(GTK_OBJECT(button), "pressed", func, data); @@ -68,7 +68,7 @@ void makeRadioItems(const char* const *labels, GtkWidget *box, GtkSignalFunc sig for (gint i=0; labels[i]; i++) { - GtkWidget *button = gtk_radio_button_new_with_label(group, labels[i]); + GtkWidget *button = gtk_radio_button_new_with_label(group, _(labels[i])); if (gads) gads[i] = GTK_TOGGLE_BUTTON(button); @@ -93,9 +93,9 @@ char *readFromFile(const char *fname) string s(""); if (!textFile.is_open()) { - s = "Unable to open file '"; + s = _("Unable to open file '"); s += fname ; - s += "', probably due to improper installation !\n"; + s += _("', probably due to improper installation !\n"); } char c; diff --git a/src/celestia/gtk/common.h b/src/celestia/gtk/common.h index 8ed1de8dc..8f1ce4771 100644 --- a/src/celestia/gtk/common.h +++ b/src/celestia/gtk/common.h @@ -17,6 +17,7 @@ #include #endif /* HAVE_CONFIG_H */ +#include #include #ifdef GNOME @@ -104,18 +105,18 @@ void setDefaultRenderFlags(AppData* app); /* Constants used throughout */ const char * const monthOptions[] = { - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December", + N_("January"), + N_("February"), + N_("March"), + N_("April"), + N_("May"), + N_("June"), + N_("July"), + N_("August"), + N_("September"), + N_("October"), + N_("November"), + N_("December"), NULL }; diff --git a/src/celestia/gtk/dialog-eclipse.cpp b/src/celestia/gtk/dialog-eclipse.cpp index 6ccc19705..c842527c0 100644 --- a/src/celestia/gtk/dialog-eclipse.cpp +++ b/src/celestia/gtk/dialog-eclipse.cpp @@ -50,7 +50,7 @@ void dialogEclipseFinder(AppData* app) sprintf(ed->body, "%s", eclipsePlanetTitles[0]); ed->sel = NULL; - ed->window = GTK_DIALOG(gtk_dialog_new_with_buttons("Eclipse Finder", + ed->window = GTK_DIALOG(gtk_dialog_new_with_buttons(_("Eclipse Finder"), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, @@ -97,7 +97,7 @@ void dialogEclipseFinder(AppData* app) /* Add the columns */ for (int i=0; i<5; i++) { renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes (eclipseTitles[i], renderer, "text", i, NULL); + column = gtk_tree_view_column_new_with_attributes (_(eclipseTitles[i]), renderer, "text", i, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(ed->eclipseList), column); } @@ -112,7 +112,7 @@ void dialogEclipseFinder(AppData* app) /* -------------------------------- */ hbox = gtk_hbox_new(FALSE, CELSPACING); - label = gtk_label_new("Find"); + label = gtk_label_new(_("Find")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); GtkWidget* menuTypeBox = gtk_option_menu_new(); @@ -128,7 +128,7 @@ void dialogEclipseFinder(AppData* app) /* -------------------------------- */ hbox = gtk_hbox_new(FALSE, CELSPACING); - label = gtk_label_new("From"); + label = gtk_label_new(_("From")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); /* Get current date */ @@ -149,7 +149,7 @@ void dialogEclipseFinder(AppData* app) g_object_set_data(G_OBJECT(date1Button), "eclipsedata", ed->d1); gtk_box_pack_start(GTK_BOX(hbox), date1Button, FALSE, FALSE, 0); - label = gtk_label_new("to"); + label = gtk_label_new(_("to")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); GtkWidget* date2Button = gtk_toggle_button_new(); @@ -162,9 +162,9 @@ void dialogEclipseFinder(AppData* app) /* Common Buttons */ hbox = gtk_hbox_new(TRUE, CELSPACING); - if (buttonMake(hbox, "Compute", (GtkSignalFunc)eclipseCompute, ed)) + if (buttonMake(hbox, N_("Compute"), (GtkSignalFunc)eclipseCompute, ed)) return; - if (buttonMake(hbox, "Set Date and Go to Planet", (GtkSignalFunc)eclipseGoto, ed)) + if (buttonMake(hbox, N_("Set Date and Go to Planet"), (GtkSignalFunc)eclipseGoto, ed)) return; gtk_box_pack_start(GTK_BOX(mainbox), hbox, FALSE, FALSE, 0); @@ -174,7 +174,7 @@ void dialogEclipseFinder(AppData* app) GtkWidget* menuType = gtk_menu_new(); for (int i = 0; eclipseTypeTitles[i] != NULL; i++) { - item = gtk_menu_item_new_with_label(eclipseTypeTitles[i]); + item = gtk_menu_item_new_with_label(_(eclipseTypeTitles[i])); gtk_menu_append(GTK_MENU(menuType), item); gtk_widget_show(item); } @@ -183,7 +183,7 @@ void dialogEclipseFinder(AppData* app) GtkWidget* menuBody = gtk_menu_new(); for (int i = 0; eclipsePlanetTitles[i] != NULL; i++) { - item = gtk_menu_item_new_with_label(eclipsePlanetTitles[i]); + item = gtk_menu_item_new_with_label(_(eclipsePlanetTitles[i])); gtk_menu_append(GTK_MENU(menuBody), item); gtk_widget_show(item); } @@ -469,7 +469,7 @@ static void eclipseDestroy(GtkWidget* w, gint, EclipseData* ed) static void setButtonDateString(GtkToggleButton *button, int year, int month, int day) { char date[50]; - sprintf(date, "%d %s %d", day, monthOptions[month - 1], year); + sprintf(date, "%d %s %d", day, _(monthOptions[month - 1]), year); gtk_button_set_label(GTK_BUTTON(button), date); } diff --git a/src/celestia/gtk/dialog-eclipse.h b/src/celestia/gtk/dialog-eclipse.h index 4f784c18b..4f246c927 100644 --- a/src/celestia/gtk/dialog-eclipse.h +++ b/src/celestia/gtk/dialog-eclipse.h @@ -55,29 +55,29 @@ struct _EclipseData { const char * const eclipseTitles[] = { - "Planet", - "Satellite", - "Date", - "Start", - "End", + N_("Planet"), + N_("Satellite"), + N_("Date"), + N_("Start"), + N_("End"), NULL }; const char * const eclipseTypeTitles[] = { - "solar", - "moon", + N_("solar"), + N_("moon"), NULL }; const char * const eclipsePlanetTitles[] = { - "Earth", - "Jupiter", - "Saturn", - "Uranus", - "Neptune", - "Pluto", + N_("Earth"), + N_("Jupiter"), + N_("Saturn"), + N_("Uranus"), + N_("Neptune"), + N_("Pluto"), NULL }; diff --git a/src/celestia/gtk/dialog-goto.cpp b/src/celestia/gtk/dialog-goto.cpp index 16a4e2111..cd0412c92 100644 --- a/src/celestia/gtk/dialog-goto.cpp +++ b/src/celestia/gtk/dialog-goto.cpp @@ -35,10 +35,10 @@ void dialogGotoObject(AppData* app) gotoObjectData *data = g_new0(gotoObjectData, 1); data->app = app; - data->dialog = gtk_dialog_new_with_buttons("Goto Object", + data->dialog = gtk_dialog_new_with_buttons(_("Goto Object"), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, - "Go To", + _( "Go To"), GTK_RESPONSE_OK, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, @@ -87,7 +87,7 @@ void dialogGotoObject(AppData* app) /* Object name label and entry */ align = gtk_alignment_new(1, 0, 0, 0); hbox = gtk_hbox_new(FALSE, CELSPACING); - label = gtk_label_new("Object name:"); + label = gtk_label_new(_("Object name:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), data->nameEntry, FALSE, TRUE, 0); gtk_container_add(GTK_CONTAINER(align), hbox); @@ -96,7 +96,7 @@ void dialogGotoObject(AppData* app) /* Latitude and longitude */ align = gtk_alignment_new(1, 0, 0, 0); hbox = gtk_hbox_new(FALSE, CELSPACING); - label = gtk_label_new("Latitude:"); + label = gtk_label_new(_("Latitude:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), data->latEntry, FALSE, TRUE, 0); gtk_container_add(GTK_CONTAINER(align), hbox); @@ -104,7 +104,7 @@ void dialogGotoObject(AppData* app) align = gtk_alignment_new(1, 0, 0, 0); hbox = gtk_hbox_new(FALSE, CELSPACING); - label = gtk_label_new("Longitude:"); + label = gtk_label_new(_("Longitude:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), data->longEntry, FALSE, TRUE, 0); gtk_container_add(GTK_CONTAINER(align), hbox); @@ -113,7 +113,7 @@ void dialogGotoObject(AppData* app) /* Distance */ align = gtk_alignment_new(1, 0, 0, 0); hbox = gtk_hbox_new(FALSE, CELSPACING); - label = gtk_label_new("Distance:"); + label = gtk_label_new(_("Distance:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), data->distEntry, FALSE, TRUE, 0); gtk_container_add(GTK_CONTAINER(align), hbox); diff --git a/src/celestia/gtk/dialog-goto.h b/src/celestia/gtk/dialog-goto.h index 0a1a0284c..8ee70fbd2 100644 --- a/src/celestia/gtk/dialog-goto.h +++ b/src/celestia/gtk/dialog-goto.h @@ -38,9 +38,9 @@ struct _gotoObjectData { static const char * const unitLabels[] = { - "km", - "radii", - "au", + N_("km"), + N_("radii"), + N_("au"), NULL }; diff --git a/src/celestia/gtk/dialog-options.cpp b/src/celestia/gtk/dialog-options.cpp index bbc57ed06..10af0416f 100644 --- a/src/celestia/gtk/dialog-options.cpp +++ b/src/celestia/gtk/dialog-options.cpp @@ -45,7 +45,7 @@ void dialogViewOptions(AppData* app) return; } - app->optionDialog = gtk_dialog_new_with_buttons("View Options", + app->optionDialog = gtk_dialog_new_with_buttons(_("View Options"), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, @@ -58,13 +58,13 @@ void dialogViewOptions(AppData* app) GtkWidget* miscBox = gtk_vbox_new(FALSE, CELSPACING); /* Create all of the frames */ - GtkWidget* showFrame = gtk_frame_new("Show"); - GtkWidget* orbitFrame = gtk_frame_new("Orbits"); - GtkWidget* labelFrame = gtk_frame_new("Label"); - GtkWidget* limitFrame = gtk_frame_new("Filter Stars"); - GtkWidget* textureFrame = gtk_frame_new("Texture Detail"); - GtkWidget* infoFrame = gtk_frame_new("Info Text"); - GtkWidget* ambientFrame = gtk_frame_new("Ambient Light"); + GtkWidget* showFrame = gtk_frame_new(_("Show")); + GtkWidget* orbitFrame = gtk_frame_new(_("Orbits")); + GtkWidget* labelFrame = gtk_frame_new(_("Label")); + GtkWidget* limitFrame = gtk_frame_new(_("Filter Stars")); + GtkWidget* textureFrame = gtk_frame_new(_("Texture Detail")); + GtkWidget* infoFrame = gtk_frame_new(_("Info Text")); + GtkWidget* ambientFrame = gtk_frame_new(_("Ambient Light")); /* Create the boxes that go in the frames */ GtkWidget* showBox = gtk_vbox_new(FALSE, 0); @@ -167,8 +167,9 @@ static gint changeDistanceLimit(GtkRange *slider, AppData* app) float limit = makeDistanceLimit(gtk_range_get_value(slider)); app->renderer->setDistanceLimit(limit); - char labeltext[16] = "100000 ly"; - sprintf(labeltext, "%ld ly", (long)(limit + 0.5)); + char labeltext[32] = "100000 ly"; + /* TRANSLATORS: use short form (`ly' NOT `light years') here */ + sprintf(labeltext, _("%ld ly"), (long)(limit + 0.5)); gtk_label_set_text(GTK_LABEL(magLabel), labeltext); #ifdef GNOME @@ -197,10 +198,10 @@ static gint changeTextureResolution(GtkRange *slider, AppData* app) static gchar* formatTextureSlider(GtkRange*, gdouble value) { switch ((int)value) { - case 0: return g_strdup("Low"); - case 1: return g_strdup("Medium"); - case 2: return g_strdup("High"); - default: return g_strdup("Error"); + case 0: return g_strdup(_("Low")); + case 1: return g_strdup(_("Medium")); + case 2: return g_strdup(_("High")); + default: return g_strdup(_("Error")); } } diff --git a/src/celestia/gtk/dialog-options.h b/src/celestia/gtk/dialog-options.h index 0f080cccf..e8eeab444 100644 --- a/src/celestia/gtk/dialog-options.h +++ b/src/celestia/gtk/dialog-options.h @@ -22,17 +22,17 @@ void dialogViewOptions(AppData* app); /* Local data */ static const char * const ambientLabels[]= { - "None", - "Low", - "Medium", + N_("None"), + N_("Low"), + N_("Medium"), NULL }; static const char * const infoLabels[]= { - "None", - "Terse", - "Verbose", + N_("None"), + N_("Terse"), + N_("Verbose"), NULL }; diff --git a/src/celestia/gtk/dialog-solar.cpp b/src/celestia/gtk/dialog-solar.cpp index cac717843..4079970a9 100644 --- a/src/celestia/gtk/dialog-solar.cpp +++ b/src/celestia/gtk/dialog-solar.cpp @@ -41,7 +41,7 @@ void dialogSolarBrowser(AppData* app) GtkWidget *solarTree = NULL; GtkTreeStore *solarTreeStore = NULL; - GtkWidget *browser = gtk_dialog_new_with_buttons("Solar System Browser", + GtkWidget *browser = gtk_dialog_new_with_buttons(_("Solar System Browser"), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, @@ -74,7 +74,7 @@ void dialogSolarBrowser(AppData* app) for (int i = 0; i < 2; i++) { renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes (ssTitles[i], renderer, "text", i, NULL); + column = gtk_tree_view_column_new_with_attributes (_(ssTitles[i]), renderer, "text", i, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(solarTree), column); gtk_tree_view_column_set_min_width(column, 200); } @@ -86,9 +86,9 @@ void dialogSolarBrowser(AppData* app) /* Common Buttons */ GtkWidget *hbox = gtk_hbox_new(TRUE, CELSPACING); - if (buttonMake(hbox, "Center", (GtkSignalFunc)actionCenterSelection, app)) + if (buttonMake(hbox, N_("Center"), (GtkSignalFunc)actionCenterSelection, app)) return; - if (buttonMake(hbox, "Go To", (GtkSignalFunc)actionGotoSelection, app)) + if (buttonMake(hbox, N_("Go To"), (GtkSignalFunc)actionGotoSelection, app)) return; gtk_box_pack_start(GTK_BOX(mainbox), hbox, FALSE, FALSE, 0); @@ -128,7 +128,7 @@ static void treeSolarSelect(GtkTreeSelection* sel, AppData* app) else if (type == Selection::Type_Body) app->simulation->setSelection(Selection((Body *)item)); else - g_warning("Unexpected selection type selected."); + g_warning(_("Unexpected selection type selected.")); } @@ -150,23 +150,23 @@ static void addPlanetarySystemToTree(const PlanetarySystem* sys, GtkTreeStore* s switch(world->getClassification()) { case Body::Planet: - type = "Planet"; + type = _("Planet"); break; case Body::Moon: - type = "Moon"; + type = _("Moon"); break; case Body::Asteroid: - type = "Asteroid"; + type = _("Asteroid"); break; case Body::Comet: - type = "Comet"; + type = _("Comet"); break; case Body::Spacecraft: - type = "Spacecraft"; + type = _("Spacecraft"); break; case Body::Unknown: default: - type = "-"; + type = _("-"); break; } @@ -211,7 +211,7 @@ static void loadNearestStarSystem(AppData* app, GtkWidget* solarTree, GtkTreeSto name = g_strdup(stardb->getStarName(*nearestStar).c_str()); - sprintf(type, "%s Star", nearestStar->getSpectralType()); + sprintf(type, _("%s Star"), nearestStar->getSpectralType()); /* Set up the top-level node. */ gtk_tree_store_set(solarTreeStore, &top, @@ -230,5 +230,5 @@ static void loadNearestStarSystem(AppData* app, GtkWidget* solarTree, GtkTreeSto gtk_tree_view_expand_row(GTK_TREE_VIEW(solarTree), path, FALSE); } else - gtk_tree_store_set(solarTreeStore, &top, 0, "No Planetary Bodies", -1); + gtk_tree_store_set(solarTreeStore, &top, 0, _("No Planetary Bodies"), -1); } diff --git a/src/celestia/gtk/dialog-solar.h b/src/celestia/gtk/dialog-solar.h index a7a6933cc..34cf68a62 100644 --- a/src/celestia/gtk/dialog-solar.h +++ b/src/celestia/gtk/dialog-solar.h @@ -27,8 +27,8 @@ void dialogSolarBrowser(AppData* app); /* Local Data */ static const char * const ssTitles[] = { - "Name", - "Type" + N_("Name"), + N_("Type") }; #endif /* GTK_DIALOG_SOLAR_H */ diff --git a/src/celestia/gtk/dialog-star.cpp b/src/celestia/gtk/dialog-star.cpp index 7fd3c0a8f..43db899c1 100644 --- a/src/celestia/gtk/dialog-star.cpp +++ b/src/celestia/gtk/dialog-star.cpp @@ -46,7 +46,7 @@ void dialogStarBrowser(AppData* app) sb->app = app; sb->numListStars = 100; - GtkWidget *browser = gtk_dialog_new_with_buttons("Star System Browser", + GtkWidget *browser = gtk_dialog_new_with_buttons(_("Star System Browser"), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, @@ -84,7 +84,7 @@ void dialogStarBrowser(AppData* app) /* Add the columns */ for (int i=0; i<5; i++) { renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes (sbTitles[i], renderer, "text", i, NULL); + column = gtk_tree_view_column_new_with_attributes (_(sbTitles[i]), renderer, "text", i, NULL); if (i > 0 && i < 4) { /* Right align */ gtk_tree_view_column_set_alignment(column, 1.0); @@ -101,7 +101,7 @@ void dialogStarBrowser(AppData* app) g_signal_connect(selection, "changed", G_CALLBACK(listStarSelect), app); /* From now on, it's the bottom-of-the-window controls */ - GtkWidget *frame = gtk_frame_new("Star Search Criteria"); + GtkWidget *frame = gtk_frame_new(_("Star Search Criteria")); gtk_box_pack_start(GTK_BOX(mainbox), frame, FALSE, FALSE, 0); GtkWidget *hbox = gtk_hbox_new(FALSE, CELSPACING); @@ -111,7 +111,7 @@ void dialogStarBrowser(AppData* app) /* List viewing preference settings */ GtkWidget *vbox = gtk_vbox_new(FALSE, 0); GtkWidget *hbox2 = gtk_hbox_new(FALSE, CELSPACING); - GtkWidget *label = gtk_label_new("Maximum Stars Displayed in List"); + GtkWidget *label = gtk_label_new(_("Maximum Stars Displayed in List")); gtk_box_pack_start(GTK_BOX(hbox2), label, TRUE, FALSE, 0); sb->entry = gtk_entry_new_with_max_length(3); gtk_entry_set_width_chars(GTK_ENTRY(sb->entry), 5); @@ -141,11 +141,11 @@ void dialogStarBrowser(AppData* app) /* Common Buttons */ hbox = gtk_hbox_new(TRUE, CELSPACING); - if (buttonMake(hbox, "Center", (GtkSignalFunc)actionCenterSelection, app)) + if (buttonMake(hbox, N_("Center"), (GtkSignalFunc)actionCenterSelection, app)) return; - if (buttonMake(hbox, "Go To", (GtkSignalFunc)actionGotoSelection, app)) + if (buttonMake(hbox, N_("Go To"), (GtkSignalFunc)actionGotoSelection, app)) return; - if (buttonMake(hbox, "Refresh", (GtkSignalFunc)refreshBrowser, sb)) + if (buttonMake(hbox, N_("Refresh"), (GtkSignalFunc)refreshBrowser, sb)) return; gtk_box_pack_start(GTK_BOX(mainbox), hbox, FALSE, FALSE, 0); diff --git a/src/celestia/gtk/dialog-star.h b/src/celestia/gtk/dialog-star.h index 17e8db935..0ac17dddd 100644 --- a/src/celestia/gtk/dialog-star.h +++ b/src/celestia/gtk/dialog-star.h @@ -41,19 +41,19 @@ struct _sbData { static const char * const sbTitles[] = { - "Name", - "Distance(LY)", - "App. Mag", - "Abs. Mag", - "Type" + N_("Name"), + N_("Distance(LY)"), + N_("App. Mag"), + N_("Abs. Mag"), + N_("Type") }; static const char * const sbRadioLabels[] = { - "Nearest", - "Brightest (App.)", - "Brightest (Abs.)", - "With Planets", + N_("Nearest"), + N_("Brightest (App.)"), + N_("Brightest (Abs.)"), + N_("With Planets"), NULL }; diff --git a/src/celestia/gtk/dialog-time.cpp b/src/celestia/gtk/dialog-time.cpp index 211a5d928..b18f51168 100644 --- a/src/celestia/gtk/dialog-time.cpp +++ b/src/celestia/gtk/dialog-time.cpp @@ -21,7 +21,7 @@ /* Labels for TimeZone dropdown */ -static const char* timeOptions[] = { "UTC", "Local", NULL }; +static const char* timeOptions[] = { N_("UTC"), N_("Local"), NULL }; /* Declarations: Callbacks */ static gboolean intAdjChanged(GtkAdjustment* adj, int *val); @@ -40,12 +40,12 @@ void dialogSetTime(AppData* app) { int timezone = 1; - GtkWidget *stimedialog = gtk_dialog_new_with_buttons("Set Time", + GtkWidget *stimedialog = gtk_dialog_new_with_buttons(_("Set Time"), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, - "Set Current Time", + _("Set Current Time"), GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -55,7 +55,7 @@ void dialogSetTime(AppData* app) timezone = 2; GtkWidget *hbox = gtk_hbox_new(FALSE, 6); - GtkWidget *frame = gtk_frame_new("Time"); + GtkWidget *frame = gtk_frame_new(_("Time")); GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0); astro::Date date(app->simulation->getTime() + @@ -69,31 +69,31 @@ void dialogSetTime(AppData* app) gtk_box_pack_start(GTK_BOX(GTK_DIALOG(stimedialog)->vbox), frame, FALSE, FALSE, 0); int seconds = (int)date.seconds; - intSpin(hbox, "Hour", 0, 23, &date.hour, ":"); - intSpin(hbox, "Minute", 0, 59, &date.minute, ":"); - intSpin(hbox, "Second", 0, 59, &seconds, " "); + intSpin(hbox, N_("Hour"), 0, 23, &date.hour, N_(":")); + intSpin(hbox, N_("Minute"), 0, 59, &date.minute, N_(":")); + intSpin(hbox, N_("Second"), 0, 59, &seconds, N_(" ")); chooseOption(hbox, - "Timezone", + N_("Timezone"), (char **)timeOptions, &timezone, GTK_SIGNAL_FUNC(zoneChosen)); gtk_widget_show_all(hbox); hbox = gtk_hbox_new(FALSE, 6); - frame = gtk_frame_new("Date"); + frame = gtk_frame_new(_("Date")); align=gtk_alignment_new(0.5, 0.5, 0.0, 0.0); gtk_container_set_border_width (GTK_CONTAINER (frame), 7); chooseOption(hbox, - "Month", + N_("Month"), (char **)monthOptions, &date.month, GTK_SIGNAL_FUNC(monthChosen)); /* (Hopefully, noone will need to go beyond these years :-) */ - intSpin(hbox, "Day", 1, 31, &date.day, ","); - intSpin(hbox, "Year", -9999, 9999, &date.year, " "); + intSpin(hbox, N_("Day"), 1, 31, &date.day, N_(",")); + intSpin(hbox, N_("Year"), -9999, 9999, &date.year, N_(" ")); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(stimedialog)->vbox), frame, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(align),GTK_WIDGET(hbox)); @@ -152,13 +152,13 @@ static gboolean monthChosen(GtkComboBox *menu, int* month) static void chooseOption(GtkWidget *hbox, const char *str, char *choices[], int *val, GtkSignalFunc chosen) { GtkWidget *vbox = gtk_vbox_new(FALSE, 0); - GtkWidget *label = gtk_label_new(str); + GtkWidget *label = gtk_label_new(_(str)); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); GtkWidget* combo = gtk_combo_box_new_text(); for(unsigned int i = 0; choices[i]; i++) { - gtk_combo_box_append_text(GTK_COMBO_BOX(combo), choices[i]); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _(choices[i])); } gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0); @@ -175,7 +175,7 @@ static void chooseOption(GtkWidget *hbox, const char *str, char *choices[], int static void intSpin(GtkWidget *hbox, const char *str, int min, int max, int *val, const char *sep) { GtkWidget *vbox = gtk_vbox_new(FALSE, 0); - GtkWidget *label = gtk_label_new(str); + GtkWidget *label = gtk_label_new(_(str)); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); GtkAdjustment *adj = (GtkAdjustment *) gtk_adjustment_new ((float)*val, (float) min, (float) max, 1.0, 5.0, 0.0); @@ -192,7 +192,7 @@ static void intSpin(GtkWidget *hbox, const char *str, int min, int max, int *val { gtk_widget_show (label); GtkWidget *hbox2 = gtk_hbox_new(FALSE, 3); - label = gtk_label_new(sep); + label = gtk_label_new(_(sep)); gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); gtk_box_pack_start (GTK_BOX (hbox2), spinner, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0); diff --git a/src/celestia/gtk/dialog-tour.cpp b/src/celestia/gtk/dialog-tour.cpp index 11f0bffbf..d4505aac4 100644 --- a/src/celestia/gtk/dialog-tour.cpp +++ b/src/celestia/gtk/dialog-tour.cpp @@ -32,7 +32,7 @@ void dialogTourGuide(AppData* app) TourData* td = g_new0(TourData, 1); td->app = app; - GtkWidget* dialog = gtk_dialog_new_with_buttons("Tour Guide...", + GtkWidget* dialog = gtk_dialog_new_with_buttons(_("Tour Guide..."), GTK_WINDOW(app->mainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, @@ -42,13 +42,13 @@ void dialogTourGuide(AppData* app) GtkWidget* hbox = gtk_hbox_new(FALSE, CELSPACING); gtk_container_set_border_width(GTK_CONTAINER(hbox), CELSPACING); - GtkWidget* label = gtk_label_new("Select your destination:"); + GtkWidget* label = gtk_label_new(_("Select your destination:")); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); GtkWidget* menubox = gtk_option_menu_new(); gtk_box_pack_start(GTK_BOX(hbox), menubox, TRUE, TRUE, 0); - GtkWidget* gotoButton = gtk_button_new_with_label("Go To"); + GtkWidget* gotoButton = gtk_button_new_with_label(_("Go To")); gtk_box_pack_start(GTK_BOX(hbox), gotoButton, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, TRUE, 0); diff --git a/src/celestia/gtk/main.cpp b/src/celestia/gtk/main.cpp index dc90e733a..091355711 100644 --- a/src/celestia/gtk/main.cpp +++ b/src/celestia/gtk/main.cpp @@ -83,11 +83,11 @@ static gboolean noSplash = FALSE; /* Command-Line Options specification */ static GOptionEntry optionEntries[] = { - { "conf", 'c', 0, G_OPTION_ARG_FILENAME, &configFile, "Alternate configuration file", "file" }, - { "dir", 'd', 0, G_OPTION_ARG_FILENAME, &installDir, "Alternate installation directory", "directory" }, - { "extrasdir", 'e', 0, G_OPTION_ARG_FILENAME_ARRAY, &extrasDir, "Additional \"extras\" directory", "directory" }, - { "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullScreen, "Start full-screen", NULL }, - { "nosplash", 's', 0, G_OPTION_ARG_NONE, &noSplash, "Disable splash screen", NULL }, + { "conf", 'c', 0, G_OPTION_ARG_FILENAME, &configFile, N_("Alternate configuration file"), N_("file") }, + { "dir", 'd', 0, G_OPTION_ARG_FILENAME, &installDir, N_("Alternate installation directory"), N_("directory") }, + { "extrasdir", 'e', 0, G_OPTION_ARG_FILENAME_ARRAY, &extrasDir, N_("Additional \"extras\" directory"), N_("directory") }, + { "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullScreen, N_("Start full-screen"), NULL }, + { "nosplash", 's', 0, G_OPTION_ARG_NONE, &noSplash, N_("Disable splash screen"), NULL }, { NULL, '\0', 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }, }; @@ -100,12 +100,19 @@ static void createMainMenu(GtkWidget* window, AppData* app) GError *error; app->agMain = gtk_action_group_new ("MenuActions"); + gtk_action_group_set_translation_domain(app->agMain, PACKAGE); app->agRender = gtk_action_group_new("RenderActions"); + gtk_action_group_set_translation_domain(app->agRender, PACKAGE); app->agLabel = gtk_action_group_new("LabelActions"); + gtk_action_group_set_translation_domain(app->agLabel, PACKAGE); app->agOrbit = gtk_action_group_new("OrbitActions"); + gtk_action_group_set_translation_domain(app->agOrbit, PACKAGE); app->agVerbosity = gtk_action_group_new("VerbosityActions"); + gtk_action_group_set_translation_domain(app->agVerbosity, PACKAGE); app->agStarStyle = gtk_action_group_new("StarStyleActions"); + gtk_action_group_set_translation_domain(app->agStarStyle, PACKAGE); app->agAmbient = gtk_action_group_new("AmbientActions"); + gtk_action_group_set_translation_domain(app->agAmbient, PACKAGE); /* All actions have the AppData structure passed */ gtk_action_group_add_actions(app->agMain, actionsPlain, G_N_ELEMENTS(actionsPlain), app); @@ -132,7 +139,7 @@ static void createMainMenu(GtkWidget* window, AppData* app) error = NULL; if (!gtk_ui_manager_add_ui_from_file(ui_manager, "celestiaui.xml", &error)) { - g_message("Building menus failed: %s", error->message); + g_message(_("Building menus failed: %s"), error->message); g_error_free(error); exit(EXIT_FAILURE); } @@ -223,7 +230,7 @@ static void initRealize(GtkWidget* widget, AppData* app) { if (!app->core->initRenderer()) { - cerr << "Failed to initialize renderer.\n"; + cerr << _("Failed to initialize renderer.\n"); } /* Read/Apply Settings */ @@ -298,13 +305,13 @@ int main(int argc, char* argv[]) /* Command line option parsing */ GError *error = NULL; GOptionContext* context = g_option_context_new(""); - g_option_context_add_main_entries(context, optionEntries, NULL); + g_option_context_add_main_entries(context, optionEntries, PACKAGE); g_option_context_add_group(context, gtk_get_option_group(TRUE)); g_option_context_parse(context, &argc, &argv, &error); if (error != NULL) { - g_print("Error in command line options. Use --help for full list.\n"); + g_print(_("Error in command line options. Use --help for full list.\n")); exit(1); } @@ -321,7 +328,7 @@ int main(int argc, char* argv[]) installDir = (gchar*)CONFIG_DATA_DIR; if (chdir(installDir) == -1) - cerr << "Cannot chdir to '" << installDir << "', probably due to improper installation.\n"; + cerr << _("Cannot chdir to '") << installDir << _("', probably due to improper installation.\n"); #ifdef GNOME /* GNOME Initialization */ @@ -335,14 +342,14 @@ int main(int argc, char* argv[]) /* Turn on the splash screen */ SplashData* ss = splashStart(app, !noSplash); - splashSetText(ss, "Initializing..."); + splashSetText(ss, _("Initializing...")); SetDebugVerbosity(0); app->core = new CelestiaCore(); if (app->core == NULL) { - cerr << "Failed to initialize Celestia core.\n"; + cerr << _("Failed to initialize Celestia core.\n"); return 1; } @@ -403,15 +410,15 @@ int main(int argc, char* argv[]) if (glconfig == NULL) { - g_print("*** Cannot find the double-buffered visual.\n"); - g_print("*** Trying single-buffered visual.\n"); + g_print(_("*** Cannot find the double-buffered visual.\n")); + g_print(_("*** Trying single-buffered visual.\n")); /* Try single-buffered visual */ glconfig = gdk_gl_config_new_by_mode(static_cast (GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH)); if (glconfig == NULL) { - g_print ("*** No appropriate OpenGL-capable visual found.\n"); + g_print (_("*** No appropriate OpenGL-capable visual found.\n")); exit(1); } } diff --git a/src/celestia/gtk/menu-context.cpp b/src/celestia/gtk/menu-context.cpp index c8ca96a5e..d60c25cbd 100644 --- a/src/celestia/gtk/menu-context.cpp +++ b/src/celestia/gtk/menu-context.cpp @@ -61,9 +61,9 @@ void menuContext(float, float, Selection sel) name = sel.body()->getName(); AppendMenu(popup, NULL, name.c_str(), gtk_action_group_get_action(app->agMain, "CenterSelection")); AppendMenu(popup, NULL, NULL, 0); - AppendMenu(popup, NULL, "_Goto", gtk_action_group_get_action(app->agMain, "GotoSelection")); - AppendMenu(popup, NULL, "_Follow", gtk_action_group_get_action(app->agMain, "FollowSelection")); - AppendMenu(popup, NULL, "S_ync Orbit", gtk_action_group_get_action(app->agMain, "SyncSelection")); + AppendMenu(popup, NULL, N_("_Goto"), gtk_action_group_get_action(app->agMain, "GotoSelection")); + AppendMenu(popup, NULL, N_("_Follow"), gtk_action_group_get_action(app->agMain, "FollowSelection")); + AppendMenu(popup, NULL, N_("S_ync Orbit"), gtk_action_group_get_action(app->agMain, "SyncSelection")); /* Add info eventually: * AppendMenu(popup, NULL, "_Info", 0); */ @@ -71,7 +71,7 @@ void menuContext(float, float, Selection sel) if (satellites != NULL && satellites->getSystemSize() != 0) { GtkMenu* satMenu = CreatePlanetarySystemMenu(name, satellites); - gtk_menu_item_set_submenu(AppendMenu(popup, NULL, "_Satellites", 0), GTK_WIDGET(satMenu)); + gtk_menu_item_set_submenu(AppendMenu(popup, NULL, N_("_Satellites"), 0), GTK_WIDGET(satMenu)); } vector* altSurfaces = sel.body()->getAlternateSurfaceNames(); @@ -80,7 +80,7 @@ void menuContext(float, float, Selection sel) if (altSurfaces->size() > 0) { GtkMenu* surfMenu = CreateAlternateSurfaceMenu(*altSurfaces); - gtk_menu_item_set_submenu(AppendMenu(popup, NULL, "_Alternate Surfaces", 0), GTK_WIDGET(surfMenu)); + gtk_menu_item_set_submenu(AppendMenu(popup, NULL, N_("_Alternate Surfaces"), 0), GTK_WIDGET(surfMenu)); delete altSurfaces; } } @@ -93,7 +93,7 @@ void menuContext(float, float, Selection sel) name = ReplaceGreekLetterAbbr(sim->getUniverse()->getStarCatalog()->getStarName(*(sel.star()))); AppendMenu(popup, NULL, name.c_str(), gtk_action_group_get_action(app->agMain, "CenterSelection")); AppendMenu(popup, NULL, NULL, 0); - AppendMenu(popup, NULL, "_Goto", gtk_action_group_get_action(app->agMain, "GotoSelection")); + AppendMenu(popup, NULL, N_("_Goto"), gtk_action_group_get_action(app->agMain, "GotoSelection")); /* Add info eventually: * AppendMenu(popup, NULL, "_Info", 0); */ @@ -115,8 +115,8 @@ void menuContext(float, float, Selection sel) { AppendMenu(popup, NULL, app->simulation->getUniverse()->getDSOCatalog()->getDSOName(sel.deepsky()).c_str(), gtk_action_group_get_action(app->agMain, "CenterSelection")); AppendMenu(popup, NULL, NULL, 0); - AppendMenu(popup, NULL, "_Goto", gtk_action_group_get_action(app->agMain, "GotoSelection")); - AppendMenu(popup, NULL, "_Follow", gtk_action_group_get_action(app->agMain, "FollowSelection")); + AppendMenu(popup, NULL, N_("_Goto"), gtk_action_group_get_action(app->agMain, "GotoSelection")); + AppendMenu(popup, NULL, N_("_Follow"), gtk_action_group_get_action(app->agMain, "FollowSelection")); /* Add info eventually: * AppendMenu(popup, NULL, "_Info", 0); */ } @@ -130,9 +130,9 @@ void menuContext(float, float, Selection sel) } if (app->simulation->getUniverse()->isMarked(sel, 1)) - AppendMenu(popup, menuUnMark, "_Unmark", 0); + AppendMenu(popup, menuUnMark, N_("_Unmark"), 0); else - AppendMenu(popup, menuMark, "_Mark", 0); + AppendMenu(popup, menuMark, N_("_Mark"), 0); app->simulation->setSelection(sel); @@ -237,7 +237,7 @@ static GtkMenuItem* AppendMenu(GtkWidget* parent, GtkSignalFunc callback, const if (name == NULL) menuitem = gtk_separator_menu_item_new(); else - menuitem = gtk_menu_item_new_with_mnemonic(name); + menuitem = gtk_menu_item_new_with_mnemonic(_(name)); /* If no callback was provided, pass GtkAction, else convert to pointer */ if (callback == NULL && extra != 0) @@ -330,17 +330,17 @@ static GtkMenu* CreatePlanetarySystemMenu(string parentName, const PlanetarySyst /* Add each vector of PlanetarySystem bodies to a vector to iterate over */ objects.push_back(asteroids); - menuNames.push_back("Asteroids"); + menuNames.push_back(_("Asteroids")); objects.push_back(comets); - menuNames.push_back("Comets"); + menuNames.push_back(_("Comets")); objects.push_back(invisibles); - menuNames.push_back("Invisibles"); + menuNames.push_back(_("Invisibles")); objects.push_back(moons); - menuNames.push_back("Moons"); + menuNames.push_back(_("Moons")); objects.push_back(planets); - menuNames.push_back("Planets"); + menuNames.push_back(_("Planets")); objects.push_back(spacecraft); - menuNames.push_back("Spacecraft"); + menuNames.push_back(_("Spacecraft")); /* Now sort each vector and generate submenus */ IntStrPairComparePredicate pred; @@ -374,7 +374,7 @@ static GtkMenu* CreatePlanetarySystemMenu(string parentName, const PlanetarySyst { /* Skip sorting if we are dealing with the planets in our own * Solar System. */ - if (parentName != "Sol" || *menuName != "Planets") + if (parentName != _("Sol") || *menuName != _("Planets")) sort(obj->begin(), obj->end(), pred); if (numSubMenus > 1) @@ -407,7 +407,7 @@ static GtkMenu* CreateAlternateSurfaceMenu(const vector& surfaces) { GtkWidget* menu = gtk_menu_new(); - AppendMenu(menu, GTK_SIGNAL_FUNC(handleContextSurface), "Normal", 0); + AppendMenu(menu, GTK_SIGNAL_FUNC(handleContextSurface), _("Normal"), 0); for (guint i = 0; i < surfaces.size(); i++) { AppendMenu(menu, GTK_SIGNAL_FUNC(handleContextSurface), surfaces[i].c_str(), GINT_TO_POINTER(i+1)); diff --git a/src/celestia/gtk/settings-file.cpp b/src/celestia/gtk/settings-file.cpp index 5ba52bf48..3febfc837 100644 --- a/src/celestia/gtk/settings-file.cpp +++ b/src/celestia/gtk/settings-file.cpp @@ -38,7 +38,7 @@ void initSettingsFile(AppData* app) * error code. */ if (error != NULL && g_file_test(fn, G_FILE_TEST_EXISTS)) { - g_print("Error reading '%s': %s.\n", fn, error->message); + g_print(_("Error reading '%s': %s.\n"), fn, error->message); exit(1); } @@ -300,7 +300,7 @@ void saveSettingsFile(AppData* app) outfile = fopen(fn, "w"); if (outfile == NULL) - g_print("Error writing '%s'.\n", fn); + g_print(_("Error writing '%s'.\n"), fn); fputs(g_key_file_to_data(file, NULL, NULL), outfile); diff --git a/src/celestia/gtk/splash.cpp b/src/celestia/gtk/splash.cpp index 316d63719..0b95ce124 100644 --- a/src/celestia/gtk/splash.cpp +++ b/src/celestia/gtk/splash.cpp @@ -125,7 +125,7 @@ void splashSetText(SplashData* ss, const char* text) if (!ss->splash) return; - sprintf(message, "Version " VERSION "\n%s", text); + sprintf(message, _("Version " VERSION "\n%s"), text); gtk_label_set_text(GTK_LABEL(ss->label), message); diff --git a/src/celestia/gtk/ui.h b/src/celestia/gtk/ui.h index 7d4b7eb38..2f6b8f5c4 100644 --- a/src/celestia/gtk/ui.h +++ b/src/celestia/gtk/ui.h @@ -22,166 +22,166 @@ /* Regular Actions */ static const GtkActionEntry actionsPlain[] = { - { "FileMenu", NULL, "_File", NULL, NULL, NULL }, - { "CopyURL", GTK_STOCK_COPY, "Copy _URL", NULL, NULL, G_CALLBACK(actionCopyURL) }, - { "OpenURL", NULL, "Open UR_L", NULL, NULL, G_CALLBACK(actionOpenURL) }, - { "OpenScript", GTK_STOCK_OPEN, "_Open Script...", NULL, NULL, G_CALLBACK(actionOpenScript) }, - { "CaptureImage", GTK_STOCK_SAVE_AS, "_Capture Image...", NULL, NULL, G_CALLBACK(actionCaptureImage) }, - { "CaptureMovie", GTK_STOCK_SAVE_AS, "Capture _Movie...", NULL, NULL, G_CALLBACK(actionCaptureMovie) }, - { "Quit", GTK_STOCK_QUIT, "_Quit", "Q", NULL, G_CALLBACK(actionQuit) }, + { "FileMenu", NULL, N_("_File"), NULL, NULL, NULL }, + { "CopyURL", GTK_STOCK_COPY, N_("Copy _URL"), NULL, NULL, G_CALLBACK(actionCopyURL) }, + { "OpenURL", NULL, N_("Open UR_L"), NULL, NULL, G_CALLBACK(actionOpenURL) }, + { "OpenScript", GTK_STOCK_OPEN, N_("_Open Script..."), NULL, NULL, G_CALLBACK(actionOpenScript) }, + { "CaptureImage", GTK_STOCK_SAVE_AS, N_("_Capture Image..."), NULL, NULL, G_CALLBACK(actionCaptureImage) }, + { "CaptureMovie", GTK_STOCK_SAVE_AS, N_("Capture _Movie..."), NULL, NULL, G_CALLBACK(actionCaptureMovie) }, + { "Quit", GTK_STOCK_QUIT, N_("_Quit"), "Q", NULL, G_CALLBACK(actionQuit) }, - { "NavigationMenu", NULL, "_Navigation", NULL, NULL, NULL }, - { "SelectSol", GTK_STOCK_HOME, "Select _Sol", "H", NULL, G_CALLBACK(actionSelectSol) }, - { "TourGuide", NULL, "Tour G_uide...", NULL, NULL, G_CALLBACK(actionTourGuide) }, - { "SearchObject", GTK_STOCK_FIND, "Search for _Object...", NULL, NULL, G_CALLBACK(actionSearchObject) }, - { "GotoObject", NULL, "Go to Object...", NULL, NULL, G_CALLBACK(actionGotoObject) }, - { "CenterSelection", NULL, "_Center Selection", "c", NULL, G_CALLBACK(actionCenterSelection) }, - { "GotoSelection", GTK_STOCK_JUMP_TO, "_Go to Selection", "G", NULL, G_CALLBACK(actionGotoSelection) }, - { "FollowSelection", NULL, "_Follow Selection", "F", NULL, G_CALLBACK(actionFollowSelection) }, - { "SyncSelection", NULL, "S_ync Orbit Selection", "Y", NULL, G_CALLBACK(actionSyncSelection) }, - { "TrackSelection", NULL, "_Track Selection", "T", NULL, G_CALLBACK(actionTrackSelection) }, - { "SystemBrowser", NULL, "Solar System _Browser...", NULL, NULL, G_CALLBACK(actionSystemBrowser) }, - { "StarBrowser", NULL, "Star B_rowser...", NULL, NULL, G_CALLBACK(actionStarBrowser) }, - { "EclipseFinder", NULL, "_Eclipse Finder...", NULL, NULL, G_CALLBACK(actionEclipseFinder) }, + { "NavigationMenu", NULL, N_("_Navigation"), NULL, NULL, NULL }, + { "SelectSol", GTK_STOCK_HOME, N_("Select _Sol"), "H", NULL, G_CALLBACK(actionSelectSol) }, + { "TourGuide", NULL, N_("Tour G_uide..."), NULL, NULL, G_CALLBACK(actionTourGuide) }, + { "SearchObject", GTK_STOCK_FIND, N_("Search for _Object..."), NULL, NULL, G_CALLBACK(actionSearchObject) }, + { "GotoObject", NULL, N_("Go to Object..."), NULL, NULL, G_CALLBACK(actionGotoObject) }, + { "CenterSelection", NULL, N_("_Center Selection"), "c", NULL, G_CALLBACK(actionCenterSelection) }, + { "GotoSelection", GTK_STOCK_JUMP_TO, N_("_Go to Selection"), "G", NULL, G_CALLBACK(actionGotoSelection) }, + { "FollowSelection", NULL, N_("_Follow Selection"), "F", NULL, G_CALLBACK(actionFollowSelection) }, + { "SyncSelection", NULL, N_("S_ync Orbit Selection"), "Y", NULL, G_CALLBACK(actionSyncSelection) }, + { "TrackSelection", NULL, N_("_Track Selection"), "T", NULL, G_CALLBACK(actionTrackSelection) }, + { "SystemBrowser", NULL, N_("Solar System _Browser..."), NULL, NULL, G_CALLBACK(actionSystemBrowser) }, + { "StarBrowser", NULL, N_("Star B_rowser..."), NULL, NULL, G_CALLBACK(actionStarBrowser) }, + { "EclipseFinder", NULL, N_("_Eclipse Finder..."), NULL, NULL, G_CALLBACK(actionEclipseFinder) }, - { "TimeMenu", NULL, "_Time", NULL, NULL, NULL }, - { "TimeFaster", NULL, "10x _Faster", "L", NULL, G_CALLBACK(actionTimeFaster) }, - { "TimeSlower", NULL, "10x _Slower", "K", NULL, G_CALLBACK(actionTimeSlower) }, - { "TimeFreeze", NULL, "Free_ze", "space", NULL, G_CALLBACK(actionTimeFreeze) }, - { "TimeReal", NULL, "_Real Time", "backslash", NULL, G_CALLBACK(actionTimeReal) }, - { "TimeReverse", NULL, "Re_verse Time", "J", NULL, G_CALLBACK(actionTimeReverse) }, - { "TimeSet", NULL, "Set _Time...", NULL, NULL, G_CALLBACK(actionTimeSet) }, + { "TimeMenu", NULL, N_("_Time"), NULL, NULL, NULL }, + { "TimeFaster", NULL, N_("10x _Faster"), "L", NULL, G_CALLBACK(actionTimeFaster) }, + { "TimeSlower", NULL, N_("10x _Slower"), "K", NULL, G_CALLBACK(actionTimeSlower) }, + { "TimeFreeze", NULL, N_("Free_ze"), "space", NULL, G_CALLBACK(actionTimeFreeze) }, + { "TimeReal", NULL, N_("_Real Time"), "backslash", NULL, G_CALLBACK(actionTimeReal) }, + { "TimeReverse", NULL, N_("Re_verse Time"), "J", NULL, G_CALLBACK(actionTimeReverse) }, + { "TimeSet", NULL, N_("Set _Time..."), NULL, NULL, G_CALLBACK(actionTimeSet) }, /* "Show Local Time" in toggle actions */ - { "OptionsMenu", NULL, "_Options", NULL, NULL, NULL }, - { "ViewOptions", GTK_STOCK_PREFERENCES, "View _Options...", NULL, NULL, G_CALLBACK(actionViewOptions) }, - { "ShowObjectsMenu", NULL, "Show Objects", NULL, NULL, NULL }, - { "ShowGridsMenu", NULL, "Show Grids", NULL, NULL, NULL }, - { "ShowLabelsMenu", NULL, "Show Labels", NULL, NULL, NULL }, - { "ShowOrbitsMenu", NULL, "Show Orbits", NULL, NULL, NULL }, - { "InfoTextMenu", NULL, "Info Text", NULL, NULL, NULL }, + { "OptionsMenu", NULL, N_("_Options"), NULL, NULL, NULL }, + { "ViewOptions", GTK_STOCK_PREFERENCES, N_("View _Options..."), NULL, NULL, G_CALLBACK(actionViewOptions) }, + { "ShowObjectsMenu", NULL, N_("Show Objects"), NULL, NULL, NULL }, + { "ShowGridsMenu", NULL, N_("Show Grids"), NULL, NULL, NULL }, + { "ShowLabelsMenu", NULL, N_("Show Labels"), NULL, NULL, NULL }, + { "ShowOrbitsMenu", NULL, N_("Show Orbits"), NULL, NULL, NULL }, + { "InfoTextMenu", NULL, N_("Info Text"), NULL, NULL, NULL }, /* "Info Text" in radio actions */ - { "StarStyleMenu", NULL, "Star St_yle", NULL, NULL, NULL }, + { "StarStyleMenu", NULL, N_("Star St_yle"), NULL, NULL, NULL }, /* "Star Style" in radio actions */ - { "AmbientLightMenu", NULL, "_Ambient Light", NULL, NULL, NULL }, + { "AmbientLightMenu", NULL, N_("_Ambient Light"), NULL, NULL, NULL }, /* "Ambient Light" in radio actions */ - { "StarsMore", NULL, "_More Stars Visible", "bracketright", NULL, G_CALLBACK(actionStarsMore) }, - { "StarsFewer", NULL, "_Fewer Stars Visible", "bracketleft", NULL, G_CALLBACK(actionStarsFewer) }, + { "StarsMore", NULL, N_("_More Stars Visible"), "bracketright", NULL, G_CALLBACK(actionStarsMore) }, + { "StarsFewer", NULL, N_("_Fewer Stars Visible"), "bracketleft", NULL, G_CALLBACK(actionStarsFewer) }, /* "VideoSync" in toggle actions */ - { "WindowMenu", NULL, "_Window", NULL, NULL, NULL }, - { "ViewerSize", GTK_STOCK_ZOOM_FIT, "Set Window Size...", NULL, NULL, G_CALLBACK(actionViewerSize) }, + { "WindowMenu", NULL, N_("_Window"), NULL, NULL, NULL }, + { "ViewerSize", GTK_STOCK_ZOOM_FIT, N_("Set Window Size..."), NULL, NULL, G_CALLBACK(actionViewerSize) }, /* "Full Screen" in toggle actions */ - { "MultiSplitH", NULL, "Split _Horizontally", "R", NULL, G_CALLBACK(actionMultiSplitH) }, - { "MultiSplitV", NULL, "Split _Vertically", "U", NULL, G_CALLBACK(actionMultiSplitV) }, - { "MultiCycle", NULL, "Cycle View", "Tab", NULL, G_CALLBACK(actionMultiCycle) }, - { "MultiDelete", NULL, "_Delete Active View", "Delete", NULL, G_CALLBACK(actionMultiDelete) }, - { "MultiSingle", NULL, "_Single View", "D", NULL, G_CALLBACK(actionMultiSingle) }, + { "MultiSplitH", NULL, N_("Split _Horizontally"), "R", NULL, G_CALLBACK(actionMultiSplitH) }, + { "MultiSplitV", NULL, N_("Split _Vertically"), "U", NULL, G_CALLBACK(actionMultiSplitV) }, + { "MultiCycle", NULL, N_("Cycle View"), "Tab", NULL, G_CALLBACK(actionMultiCycle) }, + { "MultiDelete", NULL, N_("_Delete Active View"), "Delete", NULL, G_CALLBACK(actionMultiDelete) }, + { "MultiSingle", NULL, N_("_Single View"), "D", NULL, G_CALLBACK(actionMultiSingle) }, /* "Show Frames" in toggle actions */ /* "Synchronize Time" in toggle actions */ - { "HelpMenu", NULL, "_Help", NULL, NULL, NULL }, - { "RunDemo", GTK_STOCK_EXECUTE, "Run _Demo", "D", NULL, G_CALLBACK(actionRunDemo) }, - { "HelpControls", GTK_STOCK_HELP, "_Controls", NULL, NULL, G_CALLBACK(actionHelpControls) }, + { "HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL }, + { "RunDemo", GTK_STOCK_EXECUTE, N_("Run _Demo"), "D", NULL, G_CALLBACK(actionRunDemo) }, + { "HelpControls", GTK_STOCK_HELP, N_("_Controls"), NULL, NULL, G_CALLBACK(actionHelpControls) }, #if GTK_CHECK_VERSION(2, 7, 0) - { "HelpOpenGL", GTK_STOCK_INFO, "OpenGL _Info", NULL, NULL, G_CALLBACK(actionHelpOpenGL) }, + { "HelpOpenGL", GTK_STOCK_INFO, N_("OpenGL _Info"), NULL, NULL, G_CALLBACK(actionHelpOpenGL) }, #else - { "HelpOpenGL", NULL, "OpenGL _Info", NULL, NULL, G_CALLBACK(actionHelpOpenGL) }, + { "HelpOpenGL", NULL, N_("OpenGL _Info"), NULL, NULL, G_CALLBACK(actionHelpOpenGL) }, #endif - { "HelpAbout", GTK_STOCK_ABOUT, "_About", NULL, NULL, G_CALLBACK(actionHelpAbout) }, + { "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, G_CALLBACK(actionHelpAbout) }, }; /* Regular Checkbox Actions */ static const GtkToggleActionEntry actionsToggle[] = { - { "TimeLocal", NULL, "Show _Local Time", NULL, NULL, G_CALLBACK(actionTimeLocal), FALSE }, + { "TimeLocal", NULL, N_("Show _Local Time"), NULL, NULL, G_CALLBACK(actionTimeLocal), FALSE }, #if GTK_CHECK_VERSION(2, 7, 0) - { "FullScreen", GTK_STOCK_FULLSCREEN, "_Full Screen", "Return", NULL, G_CALLBACK(actionFullScreen), FALSE }, + { "FullScreen", GTK_STOCK_FULLSCREEN, N_("_Full Screen"), "Return", NULL, G_CALLBACK(actionFullScreen), FALSE }, #else - { "FullScreen", NULL, "_Full Screen", "Return", NULL, G_CALLBACK(actionFullScreen), FALSE }, + { "FullScreen", NULL, N_("_Full Screen"), "Return", NULL, G_CALLBACK(actionFullScreen), FALSE }, #endif /* GTK_CHECK_VERSION */ - { "MenuBarVisible", NULL, "_Menu Bar", "M", NULL, G_CALLBACK(actionMenuBarVisible), TRUE }, - { "MultiShowFrames", NULL, "Show _Frames", NULL, NULL, G_CALLBACK(actionMultiShowFrames), FALSE }, - { "MultiShowActive", NULL, "Active Frame Highlighted", NULL, NULL, G_CALLBACK(actionMultiShowActive), FALSE }, - { "MultiSyncTime", NULL, "Synchronize _Time", NULL, NULL, G_CALLBACK(actionMultiSyncTime), FALSE }, - { "VideoSync", NULL, "_Limit Frame Rate", NULL, NULL, G_CALLBACK(actionVideoSync), TRUE }, + { "MenuBarVisible", NULL, N_("_Menu Bar"), "M", NULL, G_CALLBACK(actionMenuBarVisible), TRUE }, + { "MultiShowFrames", NULL, N_("Show _Frames"), NULL, NULL, G_CALLBACK(actionMultiShowFrames), FALSE }, + { "MultiShowActive", NULL, N_("Active Frame Highlighted"), NULL, NULL, G_CALLBACK(actionMultiShowActive), FALSE }, + { "MultiSyncTime", NULL, N_("Synchronize _Time"), NULL, NULL, G_CALLBACK(actionMultiSyncTime), FALSE }, + { "VideoSync", NULL, N_("_Limit Frame Rate"), NULL, NULL, G_CALLBACK(actionVideoSync), TRUE }, }; /* Regular Radio Button Actions */ static const GtkRadioActionEntry actionsVerbosity[] = { - { "HudNone", NULL, "_None", NULL, NULL, 0 }, - { "HudTerse", NULL, "_Terse", NULL, NULL, 1}, - { "HudVerbose", NULL, "_Verbose", NULL, NULL, 2}, + { "HudNone", NULL, N_("_None"), NULL, NULL, 0 }, + { "HudTerse", NULL, N_("_Terse"), NULL, NULL, 1}, + { "HudVerbose", NULL, N_("_Verbose"), NULL, NULL, 2}, }; static const GtkRadioActionEntry actionsStarStyle[] = { - { "StarsFuzzy", NULL, "_Fuzzy Points", NULL, NULL, Renderer::FuzzyPointStars }, - { "StarsPoints", NULL, "_Points", NULL, NULL, Renderer::PointStars }, - { "StarsDiscs", NULL, "Scaled _Discs", NULL, NULL, Renderer::ScaledDiscStars }, + { "StarsFuzzy", NULL, N_("_Fuzzy Points"), NULL, NULL, Renderer::FuzzyPointStars }, + { "StarsPoints", NULL, N_("_Points"), NULL, NULL, Renderer::PointStars }, + { "StarsDiscs", NULL, N_("Scaled _Discs"), NULL, NULL, Renderer::ScaledDiscStars }, }; static const GtkRadioActionEntry actionsAmbientLight[] = { - { "AmbientNone", NULL, "_None", NULL, NULL, 0 }, - { "AmbientLow", NULL, "_Low", NULL, NULL, 1 }, - { "AmbientMedium", NULL, "_Medium", NULL, NULL, 2}, + { "AmbientNone", NULL, N_("_None"), NULL, NULL, 0 }, + { "AmbientLow", NULL, N_("_Low"), NULL, NULL, 1 }, + { "AmbientMedium", NULL, N_("_Medium"), NULL, NULL, 2}, }; /* Render-Flag Actions */ static const GtkToggleActionEntry actionsRenderFlags[] = { - { "RenderAA", NULL, "Antialiasing", "X", NULL, G_CALLBACK(actionRenderAA), FALSE }, - { "RenderAtmospheres", NULL, "Atmospheres", "A", NULL, G_CALLBACK(actionRenderAtmospheres), FALSE }, - { "RenderAutoMagnitude", NULL, "Auto Magnitude", "Y", NULL, G_CALLBACK(actionRenderAutoMagnitude), FALSE }, - { "RenderClouds", NULL, "Clouds", "I", NULL, G_CALLBACK(actionRenderClouds), FALSE }, - { "RenderCometTails", NULL, "Comet Tails", "T", NULL, G_CALLBACK(actionRenderCometTails), FALSE }, - { "RenderConstellationBoundaries", NULL, "Constellation Boundaries", NULL, NULL, G_CALLBACK(actionRenderConstellationBoundaries), FALSE }, - { "RenderConstellations", NULL, "Constellations", "slash", NULL, G_CALLBACK(actionRenderConstellations), FALSE }, - { "RenderEclipseShadows", NULL, "Eclipse Shadows", "E", NULL, G_CALLBACK(actionRenderEclipseShadows), FALSE }, - { "RenderGalaxies", NULL, "Galaxies", "U", NULL, G_CALLBACK(actionRenderGalaxies), FALSE }, - { "RenderGlobulars", NULL, "Globulars", "U", NULL, G_CALLBACK(actionRenderGlobulars), FALSE }, - { "RenderCelestialGrid", NULL, "Grid: Celestial", "semicolon", NULL, G_CALLBACK(actionRenderCelestialGrid), FALSE }, - { "RenderEclipticGrid", NULL, "Grid: Ecliptic", NULL, NULL, G_CALLBACK(actionRenderEclipticGrid), FALSE }, - { "RenderGalacticGrid", NULL, "Grid: Galactic", NULL, NULL, G_CALLBACK(actionRenderGalacticGrid), FALSE }, - { "RenderHorizontalGrid", NULL, "Grid: Horizontal", NULL, NULL, G_CALLBACK(actionRenderHorizontalGrid), FALSE }, - { "RenderMarkers", NULL, "Markers", "M", NULL, G_CALLBACK(actionRenderMarkers), FALSE }, - { "RenderNebulae", NULL, "Nebulae", "asciicircum", NULL, G_CALLBACK(actionRenderNebulae), FALSE }, - { "RenderNightLights", NULL, "Night Side Lights", "L", NULL, G_CALLBACK(actionRenderNightLights), FALSE }, - { "RenderOpenClusters", NULL, "Open Clusters", NULL, NULL, G_CALLBACK(actionRenderOpenClusters), FALSE }, - { "RenderOrbits", NULL, "Orbits", "O", NULL, G_CALLBACK(actionRenderOrbits), FALSE }, - { "RenderPlanets", NULL, "Planets", NULL, NULL, G_CALLBACK(actionRenderPlanets), FALSE }, - { "RenderRingShadows", NULL, "Ring Shadows", NULL, NULL, G_CALLBACK(actionRenderRingShadows), FALSE }, - { "RenderStars", NULL, "Stars", NULL, NULL, G_CALLBACK(actionRenderStars), FALSE }, + { "RenderAA", NULL, N_("Antialiasing"), "X", NULL, G_CALLBACK(actionRenderAA), FALSE }, + { "RenderAtmospheres", NULL, N_("Atmospheres"), "A", NULL, G_CALLBACK(actionRenderAtmospheres), FALSE }, + { "RenderAutoMagnitude", NULL, N_("Auto Magnitude"), "Y", NULL, G_CALLBACK(actionRenderAutoMagnitude), FALSE }, + { "RenderClouds", NULL, N_("Clouds"), "I", NULL, G_CALLBACK(actionRenderClouds), FALSE }, + { "RenderCometTails", NULL, N_("Comet Tails"), "T", NULL, G_CALLBACK(actionRenderCometTails), FALSE }, + { "RenderConstellationBoundaries", NULL, N_("Constellation Boundaries"), NULL, NULL, G_CALLBACK(actionRenderConstellationBoundaries), FALSE }, + { "RenderConstellations", NULL, N_("Constellations"), "slash", NULL, G_CALLBACK(actionRenderConstellations), FALSE }, + { "RenderEclipseShadows", NULL, N_("Eclipse Shadows"), "E", NULL, G_CALLBACK(actionRenderEclipseShadows), FALSE }, + { "RenderGalaxies", NULL, N_("Galaxies"), "U", NULL, G_CALLBACK(actionRenderGalaxies), FALSE }, + { "RenderGlobulars", NULL, N_("Globulars"), "U", NULL, G_CALLBACK(actionRenderGlobulars), FALSE }, + { "RenderCelestialGrid", NULL, N_("Grid: Celestial"), "semicolon", NULL, G_CALLBACK(actionRenderCelestialGrid), FALSE }, + { "RenderEclipticGrid", NULL, N_("Grid: Ecliptic"), NULL, NULL, G_CALLBACK(actionRenderEclipticGrid), FALSE }, + { "RenderGalacticGrid", NULL, N_("Grid: Galactic"), NULL, NULL, G_CALLBACK(actionRenderGalacticGrid), FALSE }, + { "RenderHorizontalGrid", NULL, N_("Grid: Horizontal"), NULL, NULL, G_CALLBACK(actionRenderHorizontalGrid), FALSE }, + { "RenderMarkers", NULL, N_("Markers"), "M", NULL, G_CALLBACK(actionRenderMarkers), FALSE }, + { "RenderNebulae", NULL, N_("Nebulae"), "asciicircum", NULL, G_CALLBACK(actionRenderNebulae), FALSE }, + { "RenderNightLights", NULL, N_("Night Side Lights"), "L", NULL, G_CALLBACK(actionRenderNightLights), FALSE }, + { "RenderOpenClusters", NULL, N_("Open Clusters"), NULL, NULL, G_CALLBACK(actionRenderOpenClusters), FALSE }, + { "RenderOrbits", NULL, N_("Orbits"), "O", NULL, G_CALLBACK(actionRenderOrbits), FALSE }, + { "RenderPlanets", NULL, N_("Planets"), NULL, NULL, G_CALLBACK(actionRenderPlanets), FALSE }, + { "RenderRingShadows", NULL, N_("Ring Shadows"), NULL, NULL, G_CALLBACK(actionRenderRingShadows), FALSE }, + { "RenderStars", NULL, N_("Stars"), NULL, NULL, G_CALLBACK(actionRenderStars), FALSE }, }; /* Orbit-Flag Actions */ static const GtkToggleActionEntry actionsOrbitFlags[] = { - { "OrbitAsteroids", NULL, "Asteroids", NULL, NULL, G_CALLBACK(actionOrbitAsteroids), FALSE }, - { "OrbitComets", NULL, "Comets", NULL, NULL, G_CALLBACK(actionOrbitComets), FALSE }, - { "OrbitMoons", NULL, "Moons", NULL, NULL, G_CALLBACK(actionOrbitMoons), FALSE }, - { "OrbitPlanets", NULL, "Planets", NULL, NULL, G_CALLBACK(actionOrbitPlanets), FALSE }, - { "OrbitSpacecraft", NULL, "Spacecraft", NULL, NULL, G_CALLBACK(actionOrbitSpacecraft), FALSE }, + { "OrbitAsteroids", NULL, N_("Asteroids"), NULL, NULL, G_CALLBACK(actionOrbitAsteroids), FALSE }, + { "OrbitComets", NULL, N_("Comets"), NULL, NULL, G_CALLBACK(actionOrbitComets), FALSE }, + { "OrbitMoons", NULL, N_("Moons"), NULL, NULL, G_CALLBACK(actionOrbitMoons), FALSE }, + { "OrbitPlanets", NULL, N_("Planets"), NULL, NULL, G_CALLBACK(actionOrbitPlanets), FALSE }, + { "OrbitSpacecraft", NULL, N_("Spacecraft"), NULL, NULL, G_CALLBACK(actionOrbitSpacecraft), FALSE }, }; /* Label-Flag Actions */ static const GtkToggleActionEntry actionsLabelFlags[] = { - { "LabelAsteroids", NULL, "Asteroids", "W", NULL, G_CALLBACK(actionLabelAsteroids), FALSE }, - { "LabelComets", NULL, "Comets", "W", NULL, G_CALLBACK(actionLabelComets), FALSE }, - { "LabelConstellations", NULL, "Constellations", "equal", NULL, G_CALLBACK(actionLabelConstellations), FALSE }, - { "LabelGalaxies", NULL, "Galaxies", "E", NULL, G_CALLBACK(actionLabelGalaxies), FALSE }, - { "LabelGlobulars", NULL, "Globulars", "E", NULL, G_CALLBACK(actionLabelGlobulars), FALSE }, - { "LabelLocations", NULL, "Locations", NULL, NULL, G_CALLBACK(actionLabelLocations), FALSE }, - { "LabelMoons", NULL, "Moons", "M", NULL, G_CALLBACK(actionLabelMoons), FALSE }, - { "LabelNebulae", NULL, "Nebulae", NULL, NULL, G_CALLBACK(actionLabelNebulae), FALSE }, - { "LabelOpenClusters", NULL, "Open Clusters", NULL, NULL, G_CALLBACK(actionLabelOpenClusters), FALSE }, - { "LabelPlanets", NULL, "Planets", "P", NULL, G_CALLBACK(actionLabelPlanets), FALSE }, - { "LabelSpacecraft", NULL, "Spacecraft", "N", NULL, G_CALLBACK(actionLabelSpacecraft), FALSE }, - { "LabelStars", NULL, "Stars", "B", NULL, G_CALLBACK(actionLabelStars), FALSE }, + { "LabelAsteroids", NULL, N_("Asteroids"), "W", NULL, G_CALLBACK(actionLabelAsteroids), FALSE }, + { "LabelComets", NULL, N_("Comets"), "W", NULL, G_CALLBACK(actionLabelComets), FALSE }, + { "LabelConstellations", NULL, N_("Constellations"), "equal", NULL, G_CALLBACK(actionLabelConstellations), FALSE }, + { "LabelGalaxies", NULL, N_("Galaxies"), "E", NULL, G_CALLBACK(actionLabelGalaxies), FALSE }, + { "LabelGlobulars", NULL, N_("Globulars"), "E", NULL, G_CALLBACK(actionLabelGlobulars), FALSE }, + { "LabelLocations", NULL, N_("Locations"), NULL, NULL, G_CALLBACK(actionLabelLocations), FALSE }, + { "LabelMoons", NULL, N_("Moons"), "M", NULL, G_CALLBACK(actionLabelMoons), FALSE }, + { "LabelNebulae", NULL, N_("Nebulae"), NULL, NULL, G_CALLBACK(actionLabelNebulae), FALSE }, + { "LabelOpenClusters", NULL, N_("Open Clusters"), NULL, NULL, G_CALLBACK(actionLabelOpenClusters), FALSE }, + { "LabelPlanets", NULL, N_("Planets"), "P", NULL, G_CALLBACK(actionLabelPlanets), FALSE }, + { "LabelSpacecraft", NULL, N_("Spacecraft"), "N", NULL, G_CALLBACK(actionLabelSpacecraft), FALSE }, + { "LabelStars", NULL, N_("Stars"), "B", NULL, G_CALLBACK(actionLabelStars), FALSE }, /* Does not appear to do anything yet: - { "LabelsLatin", NULL, "Labels in Latin", NULL, NULL, NULL, FALSE }, + { "LabelsLatin", NULL, N_("Labels in Latin"), NULL, NULL, NULL, FALSE }, */ };