diff --git a/Makefile b/Makefile index 826fba9c..a713ac3c 100644 --- a/Makefile +++ b/Makefile @@ -23,4 +23,5 @@ all clean clobber install: @$(MAKE) -C src $@ @$(MAKE) -C samples $@ @$(MAKE) -C doc $@ + @$(MAKE) -C po $@ diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 00000000..488e424d --- /dev/null +++ b/po/Makefile @@ -0,0 +1,77 @@ +# +# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix +# and Linux systems. +# +# Copyright (C) 2008-2012 NVIDIA Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + + +############################################################################## +# include common variables and functions +############################################################################## + +UTILS_MK_DIR ?= .. + +include $(UTILS_MK_DIR)/utils.mk + +############################################################################## +# Localization GUI nvidia-settings +# +# To add a new translation, run the command: +# msginit --input=nvidia-settings.pot \ +# --locale=LANG \ +# --output=msg/LANG.po +############################################################################## + +############################################################################## +# assign variables +############################################################################## + +SRC_DIR_LIST = ../src/gtk+-2.x/ +SRC_FILES = POTFILES.in +MSG_DIR = msg/ +PACKAGE = nvidia-settings +LANGS_LIST = $(basename $(notdir $(wildcard $(MSG_DIR)*.po))) +MO_FILES = $(foreach lang, $(LANGS_LIST), $(MSG_DIR)$(lang).mo) +MO_FILES_install = $(foreach lang, $(LANGS_LIST), $(LCDIR)/$(lang)/LC_MESSAGES/$(PACKAGE).mo) + +############################################################################## +# build rules +############################################################################## + +.PNONY: all install clean + +all: $(MO_FILES) + +install: $(MO_FILES_install) + +clean: + @rm -rf $(MO_FILES) $(SRC_FILES) $(PACKAGE).pot + +$(LCDIR)/%/LC_MESSAGES/$(PACKAGE).mo: $(MSG_DIR)%.mo + $(MKDIR) $(dir $@) + $(INSTALL) $(INSTALL_PO_ARGS) $< $@ + +$(MSG_DIR)%.mo: $(MSG_DIR)%.po + $(MSGFMT) -c -o $@ $< + +$(MSG_DIR)%.po: $(PACKAGE).pot + $(MSGMERGE) --update $@ $< + +$(PACKAGE).pot: $(SRC_FILES) + $(XGETTEXT) --keyword=N_ --keyword=_ --language=C --from-code=utf-8 -c -o $@ -f $(SRC_FILES) + +$(SRC_FILES): + $(FIND) $(SRC_DIR_LIST) -name *.[ch] | sort > $(SRC_FILES) diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 00000000..0de6b70b --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,101 @@ +../src/gtk+-2.x/ctk3dvisionpro.c +../src/gtk+-2.x/ctk3dvisionpro.h +../src/gtk+-2.x/ctkapcprofilemodel.c +../src/gtk+-2.x/ctkapcprofilemodel.h +../src/gtk+-2.x/ctkapcrulemodel.c +../src/gtk+-2.x/ctkapcrulemodel.h +../src/gtk+-2.x/ctkappprofile.c +../src/gtk+-2.x/ctkappprofile.h +../src/gtk+-2.x/ctkbanner.c +../src/gtk+-2.x/ctkbanner.h +../src/gtk+-2.x/ctkcolorcontrols.c +../src/gtk+-2.x/ctkcolorcontrols.h +../src/gtk+-2.x/ctkcolorcorrection.c +../src/gtk+-2.x/ctkcolorcorrection.h +../src/gtk+-2.x/ctkcolorcorrectionpage.c +../src/gtk+-2.x/ctkcolorcorrectionpage.h +../src/gtk+-2.x/ctkconfig.c +../src/gtk+-2.x/ctkconfig.h +../src/gtk+-2.x/ctkconstants.h +../src/gtk+-2.x/ctkcurve.c +../src/gtk+-2.x/ctkcurve.h +../src/gtk+-2.x/ctkdisplayconfig.c +../src/gtk+-2.x/ctkdisplayconfig.h +../src/gtk+-2.x/ctkdisplayconfig-utils.c +../src/gtk+-2.x/ctkdisplayconfig-utils.h +../src/gtk+-2.x/ctkdisplaydevice.c +../src/gtk+-2.x/ctkdisplaydevice.h +../src/gtk+-2.x/ctkdisplaylayout.c +../src/gtk+-2.x/ctkdisplaylayout.h +../src/gtk+-2.x/ctkditheringcontrols.c +../src/gtk+-2.x/ctkditheringcontrols.h +../src/gtk+-2.x/ctkdropdownmenu.c +../src/gtk+-2.x/ctkdropdownmenu.h +../src/gtk+-2.x/ctkecc.c +../src/gtk+-2.x/ctkecc.h +../src/gtk+-2.x/ctkedid.c +../src/gtk+-2.x/ctkedid.h +../src/gtk+-2.x/ctkevent.c +../src/gtk+-2.x/ctkevent.h +../src/gtk+-2.x/ctkframelock.c +../src/gtk+-2.x/ctkframelock.h +../src/gtk+-2.x/ctkgauge.c +../src/gtk+-2.x/ctkgauge.h +../src/gtk+-2.x/ctkglstereo.c +../src/gtk+-2.x/ctkglstereo.h +../src/gtk+-2.x/ctkglwidget.c +../src/gtk+-2.x/ctkglwidget.h +../src/gtk+-2.x/ctkglx.c +../src/gtk+-2.x/ctkglx.h +../src/gtk+-2.x/ctkgpu.c +../src/gtk+-2.x/ctkgpu.h +../src/gtk+-2.x/ctkgridlicense.c +../src/gtk+-2.x/ctkgridlicense.h +../src/gtk+-2.x/ctkgvi.c +../src/gtk+-2.x/ctkgvi.h +../src/gtk+-2.x/ctkgvo-banner.c +../src/gtk+-2.x/ctkgvo-banner.h +../src/gtk+-2.x/ctkgvo.c +../src/gtk+-2.x/ctkgvo-csc.c +../src/gtk+-2.x/ctkgvo-csc.h +../src/gtk+-2.x/ctkgvo.h +../src/gtk+-2.x/ctkgvo-sync.c +../src/gtk+-2.x/ctkgvo-sync.h +../src/gtk+-2.x/ctkhelp.c +../src/gtk+-2.x/ctkhelp.h +../src/gtk+-2.x/ctkimagesliders.c +../src/gtk+-2.x/ctkimagesliders.h +../src/gtk+-2.x/ctkmultisample.c +../src/gtk+-2.x/ctkmultisample.h +../src/gtk+-2.x/ctkopengl.c +../src/gtk+-2.x/ctkopengl.h +../src/gtk+-2.x/ctkpowermizer.c +../src/gtk+-2.x/ctkpowermizer.h +../src/gtk+-2.x/ctkscale.c +../src/gtk+-2.x/ctkscale.h +../src/gtk+-2.x/ctkscreen.c +../src/gtk+-2.x/ctkscreen.h +../src/gtk+-2.x/ctkserver.c +../src/gtk+-2.x/ctkserver.h +../src/gtk+-2.x/ctkslimm.c +../src/gtk+-2.x/ctkslimm.h +../src/gtk+-2.x/ctkthermal.c +../src/gtk+-2.x/ctkthermal.h +../src/gtk+-2.x/ctkui.c +../src/gtk+-2.x/ctkui.h +../src/gtk+-2.x/ctkutils.c +../src/gtk+-2.x/ctkutils.h +../src/gtk+-2.x/ctkvcs.c +../src/gtk+-2.x/ctkvcs.h +../src/gtk+-2.x/ctkvdpau.c +../src/gtk+-2.x/ctkvdpau.h +../src/gtk+-2.x/ctkwindow.c +../src/gtk+-2.x/ctkwindow.h +../src/gtk+-2.x/ctkxvideo.c +../src/gtk+-2.x/ctkxvideo.h +../src/gtk+-2.x/matrix_utils.c +../src/gtk+-2.x/matrix_utils.h +../src/gtk+-2.x/opengl_loading.c +../src/gtk+-2.x/opengl_loading.h +../src/gtk+-2.x/opengl_wrappers.c +../src/gtk+-2.x/opengl_wrappers.h diff --git a/po/src.mk b/po/src.mk new file mode 100644 index 00000000..3f38c0e5 --- /dev/null +++ b/po/src.mk @@ -0,0 +1,10 @@ +# +# files in the po directory of nvidia-settings +# + +PO_SRC += + +PO_EXTRA_DIST += POTFILES.in +PO_EXTRA_DIST += src.mk + +PO_DIST_FILES := $(PO_SRC) $(PO_EXTRA_DIST) \ No newline at end of file diff --git a/po/version.mk b/po/version.mk new file mode 100644 index 00000000..e6b5e0f2 --- /dev/null +++ b/po/version.mk @@ -0,0 +1 @@ +NVIDIA_VERSION = 396.51 diff --git a/src/Makefile b/src/Makefile index 5f42aff5..19886e1e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -235,6 +235,7 @@ CFLAGS += -I $(OUTPUTDIR) CFLAGS += $(VDPAU_CFLAGS) CFLAGS += $(DBUS_CFLAGS) CFLAGS += -DPROGRAM_NAME=\"nvidia-settings\" +CFLAGS += -DLOCALEDIR=\"$(LCDIR)\" $(call BUILD_OBJECT_LIST,$(XCP_SRC)): CFLAGS += -fPIC diff --git a/src/gtk+-2.x/ctk3dvisionpro.c b/src/gtk+-2.x/ctk3dvisionpro.c index 2be13c42..5a7d0078 100644 --- a/src/gtk+-2.x/ctk3dvisionpro.c +++ b/src/gtk+-2.x/ctk3dvisionpro.c @@ -33,6 +33,7 @@ #include #include #include +#include /* * Icons. @@ -52,6 +53,9 @@ //----------------------------------------------------------------------------- +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + #define HTU(idx) (ctk_3d_vision_pro->htu_info[(idx)]) #define MAX_ATTRIB_LENGTH 128 @@ -108,24 +112,24 @@ static void channel_range_changed(GtkWidget *widget, gpointer user_data); static guint __signals[LAST_SIGNAL] = { 0 }; -const char *__mnu_glasses_name_tooltip = "Select glasses name"; -const char *__goggle_info_tooltip = "Displays the list of glasses synced " - "to the hub and their battery levels"; -const char *__channel_range_tooltip = "Change the 3D Vision Pro Hub range. " - "Click the arrow and then select the hub range that you want."; -const char *__add_glasses_tooltip = "Add more glasses to sync to the hub. " +const char *__mnu_glasses_name_tooltip = N_("Select glasses name"); +const char *__goggle_info_tooltip = N_("Displays the list of glasses synced " + "to the hub and their battery levels"); +const char *__channel_range_tooltip = N_("Change the 3D Vision Pro Hub range. " + "Click the arrow and then select the hub range that you want."); +const char *__add_glasses_tooltip = N_("Add more glasses to sync to the hub. " "Click this button to open the Add glasses dialog that lets you synchronize " - "another pair of stereo glasses with the hub."; -const char *__refresh_tooltip = "Updates the list of glasses that are " - "synchronized with the hub."; -const char *__identify_tooltip = "Identify a pair of glasses. " - "Causes the LED on the selected pair of glasses to blink."; -const char *__rename_tooltip = "Rename a pair of glasses. " + "another pair of stereo glasses with the hub."); +const char *__refresh_tooltip = N_("Updates the list of glasses that are " + "synchronized with the hub."); +const char *__identify_tooltip = N_("Identify a pair of glasses. " + "Causes the LED on the selected pair of glasses to blink."); +const char *__rename_tooltip = N_("Rename a pair of glasses. " "Opens the Rename glasses dialog that lets you assign a different name to " - "the selected pair of glasses."; -const char *__remove_glasses_tooltip = "Remove a pair of glasses currently " + "the selected pair of glasses."); +const char *__remove_glasses_tooltip = N_("Remove a pair of glasses currently " "synced to the hub. This removes the selected pair of glasses from the " - "glasses information table and disconnects the glasses from the hub."; + "glasses information table and disconnects the glasses from the hub."); /****************************************************************************** * @@ -289,7 +293,7 @@ static GtkWidget *create_glasses_list_menu(Ctk3DVisionPro *ctk_3d_vision_pro, ctk_config_set_tooltip(ctk_3d_vision_pro->ctk_config, GTK_WIDGET(mnu_glasses_name), - __mnu_glasses_name_tooltip); + _(__mnu_glasses_name_tooltip)); g_signal_handlers_block_by_func(G_OBJECT(mnu_glasses_name), G_CALLBACK(glasses_name_changed), @@ -425,12 +429,12 @@ static void create_glasses_info_table(GlassesInfoTable *table, GlassesInfo** gla GtkRequisition req; GtkWidget *event; /* For setting the background color to white */ gchar *goggle_info_titles[NUM_GLASSES_INFO_ATTRIBS] = - {"Glasses Name", "Battery Level (%)"}; + {_("Glasses Name"), _("Battery Level (%)")}; int i; /* Create clist in a scroll box */ hbox1 = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Glasses Information"); + label = gtk_label_new(_("Glasses Information")); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox1), hseparator, TRUE, TRUE, 5); @@ -458,7 +462,7 @@ static void create_glasses_info_table(GlassesInfoTable *table, GlassesInfo** gla header_table = gtk_table_new(1, NUM_GLASSES_INFO_ATTRIBS, FALSE); for ( i = 0; i < NUM_GLASSES_INFO_ATTRIBS; i++ ) { GtkWidget * btn = gtk_button_new_with_label(goggle_info_titles[i]); - ctk_config_set_tooltip(ctk_config, btn, __goggle_info_tooltip); + ctk_config_set_tooltip(ctk_config, btn, _(__goggle_info_tooltip)); gtk_table_attach(GTK_TABLE(header_table), btn, i, i+1, 0, 1, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); @@ -609,7 +613,7 @@ static void callback_glasses_paired(GObject *object, update_glasses_info_data_table(&(ctk_3d_vision_pro->table), HTU(0)->glasses_info); gtk_widget_show_all(GTK_WIDGET(ctk_3d_vision_pro->table.data_table)); - snprintf(temp, sizeof(temp), "Glasses Connected: %d", HTU(0)->num_glasses); + snprintf(temp, sizeof(temp), _("Glasses Connected: %d"), HTU(0)->num_glasses); gtk_label_set_text(ctk_3d_vision_pro->glasses_num_label, temp); gtk_widget_show_all(GTK_WIDGET(ctk_3d_vision_pro->glasses_num_label)); @@ -661,7 +665,7 @@ static void callback_glasses_unpaired(GObject *object, update_glasses_info_data_table(&(ctk_3d_vision_pro->table), HTU(0)->glasses_info); gtk_widget_show_all(GTK_WIDGET(ctk_3d_vision_pro->table.data_table)); - snprintf(temp, sizeof(temp), "Glasses Connected: %d", HTU(0)->num_glasses); + snprintf(temp, sizeof(temp), _("Glasses Connected: %d"), HTU(0)->num_glasses); gtk_label_set_text(ctk_3d_vision_pro->glasses_num_label, temp); gtk_widget_show_all(GTK_WIDGET(ctk_3d_vision_pro->glasses_num_label)); @@ -873,7 +877,7 @@ static AddGlassesDlg *create_add_glasses_dlg(Ctk3DVisionPro *ctk_3d_vision_pro) /* Create the dialog */ dlg->dlg_add_glasses = gtk_dialog_new_with_buttons - ("Add glasses", + (_("Add glasses"), ctk_3d_vision_pro->parent_wnd, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_SAVE, @@ -885,8 +889,8 @@ static AddGlassesDlg *create_add_glasses_dlg(Ctk3DVisionPro *ctk_3d_vision_pro) gtk_dialog_set_default_response(GTK_DIALOG(dlg->dlg_add_glasses), GTK_RESPONSE_REJECT); - label = gtk_label_new("1. Press button on the glasses\n" - " to initiate the connection."); + label = gtk_label_new(_("1. Press button on the glasses\n" + " to initiate the connection.")); hbox = gtk_hbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); @@ -904,7 +908,7 @@ static AddGlassesDlg *create_add_glasses_dlg(Ctk3DVisionPro *ctk_3d_vision_pro) gtk_box_pack_start(GTK_BOX(ctk_dialog_get_content_area(GTK_DIALOG(dlg->dlg_add_glasses))), image, FALSE, FALSE, 0); - label = gtk_label_new("2. List of glasses connected:"); + label = gtk_label_new(_("2. List of glasses connected:")); hbox = gtk_hbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); gtk_box_pack_start @@ -952,7 +956,7 @@ static void add_glasses_button_clicked(GtkButton *button, gpointer user_data) gtk_widget_set_sensitive(dlg->table.hscrollbar, FALSE); } - s = g_strdup_printf("NVIDIA 3D VisionPro Pairing"); + s = g_strdup_printf(_("NVIDIA 3D VisionPro Pairing")); ctk_config_add_timer(ctk_3d_vision_pro->ctk_config, POLL_PAIRING_TIMEOUT, s, @@ -1016,7 +1020,7 @@ static RemoveGlassesDlg *create_remove_glasses_dlg(Ctk3DVisionPro *ctk_3d_vision /* Create the dialog */ dlg->dlg_remove_glasses = gtk_dialog_new_with_buttons - ("Remove glasses", + (_("Remove glasses"), ctk_3d_vision_pro->parent_wnd, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, @@ -1028,7 +1032,7 @@ static RemoveGlassesDlg *create_remove_glasses_dlg(Ctk3DVisionPro *ctk_3d_vision gtk_dialog_set_default_response(GTK_DIALOG(dlg->dlg_remove_glasses), GTK_RESPONSE_REJECT); - label = gtk_label_new("Remove glasses synced to this hub:"); + label = gtk_label_new(_("Remove glasses synced to this hub:")); hbox = gtk_hbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 20); @@ -1115,7 +1119,7 @@ static IdentifyGlassesDlg *create_identify_glasses_dlg(Ctk3DVisionPro *ctk_3d_vi /* Create the dialog */ dlg->dlg_identify_glasses = gtk_dialog_new_with_buttons - ("Identify glasses", + (_("Identify glasses"), ctk_3d_vision_pro->parent_wnd, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, @@ -1127,7 +1131,7 @@ static IdentifyGlassesDlg *create_identify_glasses_dlg(Ctk3DVisionPro *ctk_3d_vi gtk_dialog_set_default_response(GTK_DIALOG(dlg->dlg_identify_glasses), GTK_RESPONSE_REJECT); - label = gtk_label_new("Identify selected glasses:"); + label = gtk_label_new(_("Identify selected glasses:")); hbox = gtk_hbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 20); @@ -1204,7 +1208,7 @@ static RenameGlassesDlg *create_rename_glasses_dlg(Ctk3DVisionPro *ctk_3d_vision GtkWidget *label; GtkWidget *hbox; GtkWidget *new_glasses_name; - const char *__new_glasses_name_tooltip = "Add new glasses name"; + const char *__new_glasses_name_tooltip = _("Add new glasses name"); GtkWidget *parent = GTK_WIDGET(ctk_3d_vision_pro); dlg = (RenameGlassesDlg *)malloc(sizeof(RenameGlassesDlg)); @@ -1216,7 +1220,7 @@ static RenameGlassesDlg *create_rename_glasses_dlg(Ctk3DVisionPro *ctk_3d_vision /* Create the dialog */ dlg->dlg_rename_glasses = gtk_dialog_new_with_buttons - ("Rename glasses", + (_("Rename glasses"), ctk_3d_vision_pro->parent_wnd, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_SAVE, @@ -1229,7 +1233,7 @@ static RenameGlassesDlg *create_rename_glasses_dlg(Ctk3DVisionPro *ctk_3d_vision GTK_RESPONSE_REJECT); - label = gtk_label_new("Name:"); + label = gtk_label_new(_("Name:")); hbox = gtk_hbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 20); @@ -1357,7 +1361,7 @@ static ChannelRangeDlg *create_channel_range_change_dlg(Ctk3DVisionPro *ctk_3d_v /* Create the dialog */ dlg->dlg_channel_range = gtk_dialog_new_with_buttons - ("Modify Hub Range", + (_("Modify Hub Range"), ctk_3d_vision_pro->parent_wnd, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_YES, @@ -1371,18 +1375,18 @@ static ChannelRangeDlg *create_channel_range_change_dlg(Ctk3DVisionPro *ctk_3d_v switch (range) { case SVP_SHORT_RANGE: - label = gtk_label_new("You have changed transceiver range to short range (less than 5m.).\n" + label = gtk_label_new(_("You have changed transceiver range to short range (less than 5m.).\n" "Only glasses in this range will be available.\n\n" - "Do you want to apply changes?"); + "Do you want to apply changes?")); break; case SVP_MEDIUM_RANGE: - label = gtk_label_new("You have changed transceiver range to medium range (less than 15m.).\n" + label = gtk_label_new(_("You have changed transceiver range to medium range (less than 15m.).\n" "Only glasses in this range will be available.\n\n" - "Do you want to apply changes?"); + "Do you want to apply changes?")); break; case SVP_LONG_RANGE: - label = gtk_label_new("You have changed transceiver range to long range.\n\n" - "Do you want to apply changes?"); + label = gtk_label_new(_("You have changed transceiver range to long range.\n\n" + "Do you want to apply changes?")); break; } @@ -1595,7 +1599,7 @@ GtkWidget* ctk_3d_vision_pro_new(CtrlTarget *ctrl_target, leftvbox = gtk_vbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(mainhbox), leftvbox, FALSE, FALSE, 0); - frame = gtk_frame_new("Glasses"); + frame = gtk_frame_new(_("Glasses")); gtk_box_pack_start(GTK_BOX(leftvbox), frame, FALSE, FALSE, 0); @@ -1605,7 +1609,7 @@ GtkWidget* ctk_3d_vision_pro_new(CtrlTarget *ctrl_target, alignment = gtk_alignment_new(0, 1, 0, 0); gtk_box_pack_start(GTK_BOX(frame_vbox), alignment, TRUE, TRUE, 0); - snprintf(temp, sizeof(temp), "Glasses Connected: %d", HTU(0)->num_glasses); + snprintf(temp, sizeof(temp), _("Glasses Connected: %d"), HTU(0)->num_glasses); label = gtk_label_new(temp); gtk_container_add(GTK_CONTAINER(alignment), label); ctk_3d_vision_pro->glasses_num_label = GTK_LABEL(label); @@ -1617,20 +1621,20 @@ GtkWidget* ctk_3d_vision_pro_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(frame_vbox), alignment, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(alignment), hbox); - add_button("Add Glasses", add_glasses_button_clicked, ctk_3d_vision_pro, - hbox, __add_glasses_tooltip); + add_button(_("Add Glasses"), add_glasses_button_clicked, ctk_3d_vision_pro, + hbox, _(__add_glasses_tooltip)); ctk_3d_vision_pro->refresh_button = - add_button("Refresh", refresh_button_clicked, ctk_3d_vision_pro, - hbox, __refresh_tooltip); + add_button(_("Refresh"), refresh_button_clicked, ctk_3d_vision_pro, + hbox, _(__refresh_tooltip)); ctk_3d_vision_pro->identify_button = - add_button("Identify", identify_button_clicked, ctk_3d_vision_pro, - hbox, __identify_tooltip); + add_button(_("Identify"), identify_button_clicked, ctk_3d_vision_pro, + hbox, _(__identify_tooltip)); ctk_3d_vision_pro->rename_button = - add_button("Rename", rename_button_clicked, ctk_3d_vision_pro, - hbox, __rename_tooltip); + add_button(_("Rename"), rename_button_clicked, ctk_3d_vision_pro, + hbox, _(__rename_tooltip)); ctk_3d_vision_pro->remove_button = - add_button("Remove", remove_button_clicked, ctk_3d_vision_pro, - hbox, __remove_glasses_tooltip); + add_button(_("Remove"), remove_button_clicked, ctk_3d_vision_pro, + hbox, _(__remove_glasses_tooltip)); ctk_3d_vision_pro->table.rows = HTU(0)->num_glasses; ctk_3d_vision_pro->table.columns = NUM_GLASSES_INFO_ATTRIBS; @@ -1643,7 +1647,7 @@ GtkWidget* ctk_3d_vision_pro_new(CtrlTarget *ctrl_target, rightvbox = gtk_vbox_new(FALSE, 10); gtk_box_pack_start(GTK_BOX(mainhbox), rightvbox, FALSE, FALSE, 0); - frame = gtk_frame_new("RF Hub"); + frame = gtk_frame_new(_("RF Hub")); gtk_box_pack_start(GTK_BOX(rightvbox), frame, FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 5); @@ -1658,11 +1662,11 @@ GtkWidget* ctk_3d_vision_pro_new(CtrlTarget *ctrl_target, vbox2 = gtk_vbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0); - snprintf(temp, sizeof(temp), "RF Hubs Connected:"); + snprintf(temp, sizeof(temp), _("RF Hubs Connected:")); label = add_label(temp, vbox1); hbox1 = gtk_hbox_new(FALSE, 5); - snprintf(temp, sizeof(temp), "Signal Strength:"); + snprintf(temp, sizeof(temp), _("Signal Strength:")); label = add_label(temp, hbox1); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0); @@ -1681,7 +1685,7 @@ GtkWidget* ctk_3d_vision_pro_new(CtrlTarget *ctrl_target, ctk_3d_vision_pro->signal_strength_image = image; gtk_box_pack_start(GTK_BOX(vbox2), hbox1, FALSE, FALSE, 0); - snprintf(temp, sizeof(temp), "Current Channel ID:"); + snprintf(temp, sizeof(temp), _("Current Channel ID:")); label = add_label(temp, vbox1); snprintf(temp, sizeof(temp), "%d", HTU(0)->channel_num); @@ -1692,15 +1696,15 @@ GtkWidget* ctk_3d_vision_pro_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(vbox), hseparator, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 5); - label = add_label("Hub Range:", hbox); + label = add_label(_("Hub Range:"), hbox); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 5); menu = (CtkDropDownMenu *) ctk_drop_down_menu_new(CTK_DROP_DOWN_MENU_FLAG_READONLY); - ctk_drop_down_menu_append_item(menu, "Short Range (up to 5 meters)", 0); - ctk_drop_down_menu_append_item(menu, "Medium Range (up to 15 meters)", 1); - ctk_drop_down_menu_append_item(menu, "Long Range", 2); + ctk_drop_down_menu_append_item(menu, _("Short Range (up to 5 meters)"), 0); + ctk_drop_down_menu_append_item(menu, _("Medium Range (up to 15 meters)"), 1); + ctk_drop_down_menu_append_item(menu, _("Long Range"), 2); ctk_3d_vision_pro->menu = GTK_WIDGET(menu); @@ -1721,7 +1725,7 @@ GtkWidget* ctk_3d_vision_pro_new(CtrlTarget *ctrl_target, enable_widgets(ctk_3d_vision_pro, (HTU(0)->channel_range == SVP_LONG_RANGE ? FALSE : TRUE)); ctk_config_set_tooltip(ctk_config, ctk_3d_vision_pro->menu, - __channel_range_tooltip); + _(__channel_range_tooltip)); ctk_3d_vision_pro->parent_wnd = GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(ctk_3d_vision_pro))); @@ -1771,90 +1775,90 @@ GtkTextBuffer *ctk_3d_vision_pro_create_help(GtkTextTagTable *table) b = gtk_text_buffer_new(table); gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "NVIDIA® 3D VisionPro™ help"); - ctk_help_para(b, &i, "Use this page to configure the NVIDIA® 3D VisionPro™ hub " + ctk_help_title(b, &i, _("NVIDIA® 3D VisionPro™ help")); + ctk_help_para(b, &i, _("Use this page to configure the NVIDIA® 3D VisionPro™ hub " "and glasses. You can set up new glasses, change the " "hub's range, view which glasses are synchronized with " "the hub, and select a different channel to improve the " - "hub-to-glasses signal strength."); + "hub-to-glasses signal strength.")); - ctk_help_para(b, &i, "NVIDIA® 3D Vision™ Pro is the professional version " + ctk_help_para(b, &i, _("NVIDIA® 3D Vision™ Pro is the professional version " "of the 3D Vision™ stereo glasses and emitter. While " "the 3D Vision kit uses infrared (IR) communication " "from the emitter to the stereo glasses, the 3D Vision " "Pro kit uses radio frequency (RF) bi-directional " "communication between the emitter and the stereo " "glasses. This allows multiple 3D Vision Pro hubs to " - "be used in the same area without conflicts."); + "be used in the same area without conflicts.")); - ctk_help_para(b, &i, "3D Vision Pro does not require line of sight between " + ctk_help_para(b, &i, _("3D Vision Pro does not require line of sight between " "the hub and the 3D Vision Pro glasses. This provides " "more flexibility in the location, distance, and " - "position of the glasses with respect to the emitter."); + "position of the glasses with respect to the emitter.")); - ctk_help_heading(b, &i, "Glasses Section"); - ctk_help_para(b, &i, "This section contains various actions/configurations " + ctk_help_heading(b, &i, _("Glasses Section")); + ctk_help_para(b, &i, _("This section contains various actions/configurations " "that can be performed with the NVIDIA 3D VisionPro RF " "glasses. This section also displays a list of glasses " - "synced to the hub and their battery levels."); + "synced to the hub and their battery levels.")); - ctk_help_heading(b, &i, "Glasses Connected"); - ctk_help_para(b, &i, "Shows how many glasses are connected and synchronized " - "with the hub."); + ctk_help_heading(b, &i, _("Glasses Connected")); + ctk_help_para(b, &i, _("Shows how many glasses are connected and synchronized " + "with the hub.")); - ctk_help_heading(b, &i, "Add glasses"); - ctk_help_para(b, &i, "%s", __add_glasses_tooltip); - ctk_help_para(b, &i, "This action is used to set up new 3D Vision Pro Glasses. " + ctk_help_heading(b, &i, _("Add glasses")); + ctk_help_para(b, &i, "%s", _(__add_glasses_tooltip)); + ctk_help_para(b, &i, _("This action is used to set up new 3D Vision Pro Glasses. " "On clicking this button the hub enters into pairing mode. " "Follow the instructions on Add Glasses dialog box. " "On pairing the new glasses, they appear in the glasses " "information table. Choose 'Save' to save the newly paired " - " glasses or 'Cancel' if do not wish to store them."); + " glasses or 'Cancel' if do not wish to store them.")); - ctk_help_heading(b, &i, "Refresh Glasses' Information"); - ctk_help_para(b, &i, "%s", __refresh_tooltip); - ctk_help_para(b, &i, "Refresh glasses information is typically required when- \n" + ctk_help_heading(b, &i, _("Refresh Glasses' Information")); + ctk_help_para(b, &i, "%s", _(__refresh_tooltip)); + ctk_help_para(b, &i, _("Refresh glasses information is typically required when- \n" "o Glasses move in and out of the range.\n" - "o Get the updated battery level of all the glasses."); + "o Get the updated battery level of all the glasses.")); - ctk_help_heading(b, &i, "Identify glasses"); - ctk_help_para(b, &i, "Select the glasses from the list of paired glasses that " + ctk_help_heading(b, &i, _("Identify glasses")); + ctk_help_para(b, &i, _("Select the glasses from the list of paired glasses that " "you want to identify. Hub will communicate with the " "selected glasses and make LED on the glasses blink " - "for a few seconds."); + "for a few seconds.")); - ctk_help_heading(b, &i, "Rename glasses"); - ctk_help_para(b, &i, "%s", __rename_tooltip); - ctk_help_para(b, &i, "Select the glasses from the list of paired glasses " - "that you want to rename and provide an unique new name."); + ctk_help_heading(b, &i, _("Rename glasses")); + ctk_help_para(b, &i, "%s", _(__rename_tooltip)); + ctk_help_para(b, &i, _("Select the glasses from the list of paired glasses " + "that you want to rename and provide an unique new name.")); - ctk_help_heading(b, &i, "Remove glasses"); - ctk_help_para(b, &i, "%s", __remove_glasses_tooltip); - ctk_help_para(b, &i, "Select the glasses from the list of paired glasses " + ctk_help_heading(b, &i, _("Remove glasses")); + ctk_help_para(b, &i, "%s", _(__remove_glasses_tooltip)); + ctk_help_para(b, &i, _("Select the glasses from the list of paired glasses " "that you want to remove. On removal glasses get " - "unpaired and will not sync to the hub."); + "unpaired and will not sync to the hub.")); - ctk_help_heading(b, &i, "Glasses Information"); - ctk_help_para(b, &i, "%s", __goggle_info_tooltip); + ctk_help_heading(b, &i, _("Glasses Information")); + ctk_help_para(b, &i, "%s", _(__goggle_info_tooltip)); - ctk_help_heading(b, &i, "Glasses Name"); - ctk_help_para(b, &i, "Each pair of glasses has an unique name and the name should " + ctk_help_heading(b, &i, _("Glasses Name")); + ctk_help_para(b, &i, _("Each pair of glasses has an unique name and the name should " "start and end with an alpha-numeric character. " - "Glasses can be renamed using Rename button."); + "Glasses can be renamed using Rename button.")); - ctk_help_heading(b, &i, "Battery Level"); - ctk_help_para(b, &i, "Displays battery level icon along with the value in " - "percentage."); + ctk_help_heading(b, &i, _("Battery Level")); + ctk_help_para(b, &i, _("Displays battery level icon along with the value in " + "percentage.")); - ctk_help_heading(b, &i, "RF Hub section"); - ctk_help_para(b, &i, "This section contains various actions that can be " + ctk_help_heading(b, &i, _("RF Hub section")); + ctk_help_para(b, &i, _("This section contains various actions that can be " "performed on the NVIDIA® 3D VisionPro™ hub. This " "section also displays signal strength of the channel " - "currently used and current channel ID."); + "currently used and current channel ID.")); - ctk_help_heading(b, &i, "Signal strength"); - ctk_help_para(b, &i, "Shows the signal strength of the current hub channel as an icon " + ctk_help_heading(b, &i, _("Signal strength")); + ctk_help_para(b, &i, _("Shows the signal strength of the current hub channel as an icon " "and also value in percentage. \n" "Signal strength is from one of the six ranges below-\n" "\tExcellent\t\t [100%%]\n" @@ -1862,32 +1866,32 @@ GtkTextBuffer *ctk_3d_vision_pro_create_help(GtkTextTagTable *table) "\tGood \t\t [>50%% - <75%%]\n" "\tLow \t\t [>25%% - <50%%]\n" "\tVery Low \t\t [>0%% - <25%%]\n" - "\tNo Signal\t\t [0%%]"); + "\tNo Signal\t\t [0%%]")); - ctk_help_heading(b, &i, "Hub Range"); - ctk_help_para(b, &i, "%s", __channel_range_tooltip); - ctk_help_para(b, &i, "The hub range is the farthest distance that the " + ctk_help_heading(b, &i, _("Hub Range")); + ctk_help_para(b, &i, "%s", _(__channel_range_tooltip)); + ctk_help_para(b, &i, _("The hub range is the farthest distance that the " "glasses can synchronize with the 3D Vision Pro Hub. " "You can reduce the hub range to limit the experience " "to a small group, or increase the range to include " "everyone in a large room.\n" "Possible values for transceiver range are 'Short " - "Range' 'Medium Range' and 'Long Range'."); - ctk_help_para(b, &i, "Short Range: \n" + "Range' 'Medium Range' and 'Long Range'.")); + ctk_help_para(b, &i, _("Short Range: \n" "Allows glasses within a 5-meter (16.5-foot) range to " "be synced with the hub. This range is typically used " "for sharing 3D simulations and training information " - "on a local workstation."); - ctk_help_para(b, &i, "Medium Range: \n" + "on a local workstation.")); + ctk_help_para(b, &i, _("Medium Range: \n" "Allows glasses within a 15-meter (49-foot) range to " "be synced with the hub. This range is typically used " "for sharing a presentation with a limited audience or " "interacting with 3D CAD models during a collaborative " - "design session."); - ctk_help_para(b, &i, "Long Range: \n" + "design session.")); + ctk_help_para(b, &i, _("Long Range: \n" "All glasses detected within the range and frequency of " "the hub will be synced. This range is typically used " - "in a theater or visualization center."); + "in a theater or visualization center.")); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkappprofile.c b/src/gtk+-2.x/ctkappprofile.c index 53d51838..d49cf6ad 100644 --- a/src/gtk+-2.x/ctkappprofile.c +++ b/src/gtk+-2.x/ctkappprofile.c @@ -23,6 +23,8 @@ #include #include #include +#include + #include #include #include @@ -37,10 +39,13 @@ #include #endif -#define UPDATE_RULE_LABEL "Update Rule" -#define UPDATE_PROFILE_LABEL "Update Profile" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + +#define UPDATE_RULE_LABEL N_("Update Rule") +#define UPDATE_PROFILE_LABEL N_("Update Profile") -#define STATUSBAR_UPDATE_WARNING "This will take effect after changes are saved." +#define STATUSBAR_UPDATE_WARNING N_("This will take effect after changes are saved.") enum { RULE_FEATURE_PROCNAME, @@ -50,9 +55,9 @@ enum { }; static const char *rule_feature_label_strings[] = { - "Process Name (procname)", // RULE_FEATURE_PROCNAME - "Shared Object Name (dso)", // RULE_FEATURE_DSO - "Always Applies (true)" // RULE_FEATURE_TRUE + N_("Process Name (procname)"), // RULE_FEATURE_PROCNAME + N_("Shared Object Name (dso)"), // RULE_FEATURE_DSO + N_("Always Applies (true)") // RULE_FEATURE_TRUE }; static const char *rule_feature_identifiers[] = { @@ -61,17 +66,16 @@ static const char *rule_feature_identifiers[] = { "true" // RULE_FEATURE_TRUE }; -#define MATCHES_INPUT_DESCRIPTION "\"Matches this string...\" text entry box" static const char *rule_feature_help_text[] = { - "Patterns using this feature compare the string provided by the " MATCHES_INPUT_DESCRIPTION " " + N_("Patterns using this feature compare the string provided by the \"Matches this string...\" text entry box " "against the pathname of the current process with the leading directory components removed, " - "and match if they are equal.", // RULE_FEATURE_PROCNAME - "Patterns using this feature compare the string provided by the " MATCHES_INPUT_DESCRIPTION " " + "and match if they are equal."), // RULE_FEATURE_PROCNAME + N_("Patterns using this feature compare the string provided by the \"Matches this string...\" text entry box " "against the list of currently loaded libraries in the current process, and match if " - "the string matches one of the entries in the list (with leading directory components removed).", // RULE_FEATURE_DSO - "Patterns using this feature will always match the process, regardless of the " - "contents of the string specified in the " MATCHES_INPUT_DESCRIPTION ".", // RULE_FEATURE_TRUE + "the string matches one of the entries in the list (with leading directory components removed)."), // RULE_FEATURE_DSO + N_("Patterns using this feature will always match the process, regardless of the " + "contents of the string specified in the \"Matches this string...\" text entry box."), // RULE_FEATURE_TRUE }; enum { @@ -934,8 +938,8 @@ static void increase_rule_priority_callback(GtkWidget *widget, gpointer user_dat -1); ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Priority of rule increased. %s", - STATUSBAR_UPDATE_WARNING); + _("Priority of rule increased. %s"), + _(STATUSBAR_UPDATE_WARNING)); gtk_tree_path_free(path); g_value_unset(&id); @@ -969,8 +973,8 @@ static void decrease_rule_priority_callback(GtkWidget *widget, gpointer user_dat 1); ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Priority of rule decreased. %s", - STATUSBAR_UPDATE_WARNING); + _("Priority of rule decreased. %s"), + _(STATUSBAR_UPDATE_WARNING)); gtk_tree_path_free(path); g_value_unset(&id); @@ -1116,11 +1120,11 @@ static void edit_rule_dialog_load_values(EditRuleDialog *dialog) // window title gtk_window_set_title(GTK_WINDOW(dialog->top_window), - dialog->new_rule ? "Add new rule" : "Edit existing rule"); + dialog->new_rule ? _("Add new rule") : _("Edit existing rule")); // add/edit button tool_button_set_label_and_stock_icon( - GTK_TOOL_BUTTON(dialog->add_edit_rule_button), "Update Rule", + GTK_TOOL_BUTTON(dialog->add_edit_rule_button), _("Update Rule"), dialog->new_rule ? GTK_STOCK_ADD : GTK_STOCK_PREFERENCES); // source file @@ -1314,8 +1318,8 @@ static void delete_rule_callback_common(CtkAppProfile *ctk_app_profile) path, NULL, FALSE); ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Rule deleted. %s", - STATUSBAR_UPDATE_WARNING); + _("Rule deleted. %s"), + _(STATUSBAR_UPDATE_WARNING)); gtk_tree_path_free(path); } @@ -1350,7 +1354,7 @@ static gboolean rule_browse_button_clicked(GtkWidget *widget, gpointer user_data EditRuleDialog *dialog = (EditRuleDialog *)user_data; const gchar *filename = dialog->source_file->str; gchar *selected_filename = - ctk_get_filename_from_dialog("Please select a source file for the rule", + ctk_get_filename_from_dialog(_("Please select a source file for the rule"), GTK_WINDOW(dialog->top_window), filename); @@ -1368,7 +1372,7 @@ static gboolean profile_browse_button_clicked(GtkWidget *widget, gpointer user_d EditProfileDialog *dialog = (EditProfileDialog *)user_data; const gchar *filename = dialog->source_file->str; gchar *selected_filename = - ctk_get_filename_from_dialog("Please select a source file for the profile", + ctk_get_filename_from_dialog(_("Please select a source file for the profile"), GTK_WINDOW(dialog->top_window), filename); if (selected_filename) { @@ -1381,28 +1385,28 @@ static gboolean profile_browse_button_clicked(GtkWidget *widget, gpointer user_d } static const char __rule_pattern_help[] = - "In this section, you write the pattern that will be used to determine whether " - "the settings in this rule will apply to a given application."; + N_("In this section, you write the pattern that will be used to determine whether " + "the settings in this rule will apply to a given application."); static const char __rule_pattern_extended_help[] = - "A pattern is comprised of two parts: a feature of the " + N_("A pattern is comprised of two parts: a feature of the " "process which will be retrieved by the driver at runtime, and a string against " "which the driver will compare the feature and determine if there is a match. " "If the pattern matches, then the settings determined by the rule's associated " "profile will be applied to the process, assuming they don't conflict with " "settings determined by other matching rules with higher priority.\n\n" - "See the \"Supported Features\" help section for a list of supported features."; + "See the \"Supported Features\" help section for a list of supported features."); static const char __rule_profile_help[] = - "In this section, you choose the profile that will be applied if the rule's pattern " - "matches a given process."; + N_("In this section, you choose the profile that will be applied if the rule's pattern " + "matches a given process."); static const char __rule_profile_extended_help[] = - "This section contains a drop-down box for choosing a profile name, and convenience " + N_("This section contains a drop-down box for choosing a profile name, and convenience " "buttons for modifying an existing profile or creating a new profile to be used by " "the rule. This section also has a table which lets you preview the settings that " "will be applied by the given profile. The table is read-only: to modify individual " - "settings, click the \"Edit Profile\" button."; + "settings, click the \"Edit Profile\" button."); static void config_create_source_file_entry(CtkConfig *ctk_config, GtkWidget **pcontainer, @@ -1424,14 +1428,14 @@ static void config_create_source_file_entry(CtkConfig *ctk_config, hbox = gtk_hbox_new(FALSE, 0); gtk_box_set_spacing(GTK_BOX(hbox), 4); - label = gtk_label_new("Source File"); + label = gtk_label_new(_("Source File")); - g_string_printf(help_string, "You can specify the source file where the %s is defined in this drop-down box.", name); + g_string_printf(help_string, _("You can specify the source file where the %s is defined in this drop-down box."), _(name)); ctk_config_set_tooltip_and_add_help_data(ctk_config, label, help_data_list, - "Source File", + _("Source File"), help_string->str, NULL); @@ -1439,15 +1443,15 @@ static void config_create_source_file_entry(CtkConfig *ctk_config, browse_button = gtk_button_new(); button_set_label_and_stock_icon(GTK_BUTTON(browse_button), - "Browse...", GTK_STOCK_OPEN); + _("Browse..."), GTK_STOCK_OPEN); - g_string_printf(help_string, "Clicking this button opens a file selection dialog box which allows you to choose an " - "appropriate configuration file for the %s.", name); + g_string_printf(help_string, _("Clicking this button opens a file selection dialog box which allows you to choose an " + "appropriate configuration file for the %s."), _(name)); ctk_config_set_tooltip_and_add_help_data(ctk_config, browse_button, help_data_list, - "Browse...", + _("Browse..."), help_string->str, NULL); @@ -1481,7 +1485,7 @@ static GtkWidget *create_feature_menu(EditRuleDialog *dialog) for (i = 0; i < NUM_RULE_FEATURES; i++) { ctk_drop_down_menu_append_item(CTK_DROP_DOWN_MENU(dialog->feature_menu), - rule_feature_label_strings[i], i); + _(rule_feature_label_strings[i]), i); } dialog->feature_changed_signal = @@ -1591,7 +1595,7 @@ static GtkWidget *create_rule_profile_name_entry(EditRuleDialog *dialog) hbox = gtk_hbox_new(FALSE, 8); - label = gtk_label_new("Profile Name"); + label = gtk_label_new(_("Profile Name")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -1604,13 +1608,13 @@ static GtkWidget *create_rule_profile_name_entry(EditRuleDialog *dialog) G_CALLBACK(rule_profile_name_changed), (gpointer)dialog); - button = gtk_button_new_with_label("Edit Profile"); + button = gtk_button_new_with_label(_("Edit Profile")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(rule_profile_entry_edit_profile_button_clicked), (gpointer)dialog); - button = gtk_button_new_with_label("New Profile"); + button = gtk_button_new_with_label(_("New Profile")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(rule_profile_entry_new_profile_button_clicked), @@ -1785,24 +1789,24 @@ static gboolean run_error_dialog(GtkWindow *window, error_string = g_string_new(""); if (fatal_errors->len) { g_string_append_printf(error_string, - "nvidia-settings encountered the following configuration errors:\n\n" - "%s\n", + _("nvidia-settings encountered the following configuration errors:\n\n" + "%s\n"), fatal_errors->str); } if (nonfatal_errors->len) { g_string_append_printf(error_string, - "%snvidia-settings encountered the following configuration issues:\n\n" - "%s\n", - fatal_errors->len ? "Also, " : "", nonfatal_errors->str); + _("%snvidia-settings encountered the following configuration issues:\n\n" + "%s\n"), + fatal_errors->len ? _("Also, ") : "", nonfatal_errors->str); } if (fatal_errors->len) { g_string_append_printf(error_string, - "Please fix the configuration errors before attempting to %s.\n", + _("Please fix the configuration errors before attempting to %s.\n"), op_string); } else { g_string_append_printf(error_string, - "Continue to %s anyway?\n", op_string); + _("Continue to %s anyway?\n"), op_string); } error_dialog = gtk_message_dialog_new(window, @@ -1847,20 +1851,20 @@ static gboolean edit_rule_dialog_validate(EditRuleDialog *dialog) nonfatal_errors = g_string_new(""); if (!check_valid_source_file(ctk_app_profile, dialog->source_file->str, &reason)) { - g_string_append_printf(fatal_errors, "%s\tThe source filename \"%s\" is not valid in this configuration " - "because %s\n", get_bullet(), dialog->source_file->str, reason); + g_string_append_printf(fatal_errors, _("%s\tThe source filename \"%s\" is not valid in this configuration " + "because %s\n"), get_bullet(), dialog->source_file->str, reason); free(reason); } if (!ctk_apc_profile_model_get_profile(ctk_app_profile->apc_profile_model, dialog->profile_name->str)) { - g_string_append_printf(nonfatal_errors, "%s\tThe profile \"%s\" referenced by this rule does not exist.\n", + g_string_append_printf(nonfatal_errors, _("%s\tThe profile \"%s\" referenced by this rule does not exist.\n"), get_bullet(), dialog->profile_name->str); } success = run_error_dialog(GTK_WINDOW(dialog->top_window), fatal_errors, nonfatal_errors, - "save this rule"); + _("save this rule")); g_string_free(fatal_errors, TRUE); g_string_free(nonfatal_errors, TRUE); @@ -1910,8 +1914,8 @@ static void edit_rule_dialog_save_changes(GtkWidget *widget, gpointer user_data) gtk_widget_hide(dialog->top_window); ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Rule updated. %s", - STATUSBAR_UPDATE_WARNING); + _("Rule updated. %s"), + _(STATUSBAR_UPDATE_WARNING)); } static void edit_rule_dialog_cancel(GtkWidget *widget, gpointer user_data) @@ -1932,16 +1936,16 @@ static ToolbarItemTemplate *get_edit_rule_dialog_toolbar_items(EditRuleDialog *d .flags = TOOLBAR_ITEM_USE_SEPARATOR, }, { - .text = UPDATE_RULE_LABEL, - .help_text = "The Update Rule button allows you to save changes made to the rule definition.", + .text = _(UPDATE_RULE_LABEL), + .help_text = _("The Update Rule button allows you to save changes made to the rule definition."), .icon_id = GTK_STOCK_SAVE, .callback = G_CALLBACK(edit_rule_dialog_save_changes), .user_data = dialog, .flags = 0, }, { - .text = "Cancel", - .help_text = "The Cancel button allows you to discard any changes made to the rule definition.", + .text = _("Cancel"), + .help_text = _("The Cancel button allows you to discard any changes made to the rule definition."), .icon_id = GTK_STOCK_CANCEL, .callback = G_CALLBACK(edit_rule_dialog_cancel), .user_data = dialog, @@ -1987,34 +1991,34 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile) const TreeViewColumnTemplate settings_tree_view_columns[] = { { - .title = "Key", + .title = _("Key"), .renderer_func = setting_key_renderer_func, .func_data = NULL, .min_width = 200, - .help_text = "Each entry in the \"Key\" column describes a key for a setting." + .help_text = _("Each entry in the \"Key\" column describes a key for a setting.") }, { - .title = "Expected Type", + .title = _("Expected Type"), .renderer_func = setting_expected_type_renderer_func, .min_width = 80, .func_data = ctk_app_profile->key_docs, - .help_text = "Each entry in the \"Expected Type\" column describes the type " + .help_text = _("Each entry in the \"Expected Type\" column describes the type " "expected for a known setting key. Unrecognized keys may have an " - "unspecified type." + "unspecified type.") }, { - .title = "Current Type", + .title = _("Current Type"), .renderer_func = setting_type_renderer_func, .min_width = 80, .func_data = NULL, - .help_text = "Each entry in the \"Current Type\" column describes the current type for " - "a setting value." + .help_text = _("Each entry in the \"Current Type\" column describes the current type for " + "a setting value.") }, { - .title = "Value", + .title = _("Value"), .renderer_func = setting_value_renderer_func, .func_data = NULL, - .help_text = "Each entry in the \"Value\" column describes the value of a setting." + .help_text = _("Each entry in the \"Value\" column describes the value of a setting.") } }; @@ -2052,13 +2056,13 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile) &container, &dialog->source_file_combo, &dialog->help_data, - "rule", + N_("rule"), G_CALLBACK(rule_browse_button_clicked), (gpointer)dialog); gtk_box_pack_start(GTK_BOX(main_vbox), container, FALSE, FALSE, 0); - frame = gtk_frame_new("Rule Pattern"); + frame = gtk_frame_new(_("Rule Pattern")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); label = gtk_frame_get_label_widget(GTK_FRAME(frame)); @@ -2066,28 +2070,28 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile) ctk_config_set_tooltip_and_add_help_data(ctk_app_profile->ctk_config, label, &dialog->help_data, - "Rule Pattern", - __rule_pattern_help, - __rule_pattern_extended_help); + _("Rule Pattern"), + _(__rule_pattern_help), + _(__rule_pattern_extended_help)); // Add widgets to the "Rule Pattern" section vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 4); - label = gtk_label_new("The following profile will be used if..."); + label = gtk_label_new(_("The following profile will be used if...")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); table = gtk_table_new(2, 2, FALSE); - label = gtk_label_new("This feature:"); + label = gtk_label_new(_("This feature:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); feature_menu = create_feature_menu(dialog); gtk_table_attach_defaults(GTK_TABLE(table), feature_menu, 1, 2, 0, 1); - label = gtk_label_new("Matches this string:"); + label = gtk_label_new(_("Matches this string:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); @@ -2101,7 +2105,7 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile) gtk_box_pack_start(GTK_BOX(main_vbox), frame, FALSE, FALSE, 0); - frame = gtk_frame_new("Rule Profile"); + frame = gtk_frame_new(_("Rule Profile")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); label = gtk_frame_get_label_widget(GTK_FRAME(frame)); @@ -2109,9 +2113,9 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile) ctk_config_set_tooltip_and_add_help_data(ctk_app_profile->ctk_config, label, &dialog->help_data, - "Rule Profile", - __rule_profile_help, - __rule_profile_extended_help); + _("Rule Profile"), + _(__rule_profile_help), + _(__rule_profile_extended_help)); vbox = gtk_vbox_new(FALSE, 8); gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); @@ -2119,7 +2123,7 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile) profile_name_entry = create_rule_profile_name_entry(dialog); gtk_box_pack_start(GTK_BOX(vbox), profile_name_entry, FALSE, FALSE, 0); - label = gtk_label_new("This profile will apply the following settings..."); + label = gtk_label_new(_("This profile will apply the following settings...")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); @@ -2155,7 +2159,7 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile) dialog->help_data = g_list_concat(dialog->help_data, toolbar_help_items); // Save off the "Update Rule" button for later use - dialog->add_edit_rule_button = find_widget_in_widget_data_list(toolbar_widget_items, UPDATE_RULE_LABEL); + dialog->add_edit_rule_button = find_widget_in_widget_data_list(toolbar_widget_items, _(UPDATE_RULE_LABEL)); widget_data_list_free_full(toolbar_widget_items); @@ -2215,11 +2219,11 @@ static void edit_profile_dialog_settings_new_row(GtkTreeView *tree_view, s = json_string_value(json_object_get(key_obj, "key")); expected_type = get_type_from_string(get_expected_type_string_from_key(key_docs, s)); - column_to_edit = lookup_column_number_by_name(tree_view, "Value"); + column_to_edit = lookup_column_number_by_name(tree_view, _("Value")); } else { s = ""; expected_type = -1; - column_to_edit = lookup_column_number_by_name(tree_view, "Key"); + column_to_edit = lookup_column_number_by_name(tree_view, _("Key")); } json_object_set_new(setting, "key", json_string(s)); @@ -2407,7 +2411,7 @@ static gboolean edit_profile_dialog_validate(EditProfileDialog *dialog) nonfatal_errors = g_string_new(""); if (!strcmp(dialog->name->str, "")) { - g_string_append_printf(nonfatal_errors, "%s\tThe profile name is empty.\n", get_bullet()); + g_string_append_printf(nonfatal_errors, _("%s\tThe profile name is empty.\n"), get_bullet()); } if ((dialog->new_profile || strcmp(dialog->name->str, dialog->orig_name->str)) && @@ -2415,34 +2419,34 @@ static gboolean edit_profile_dialog_validate(EditProfileDialog *dialog) dialog->name->str)) { if (dialog->new_profile) { g_string_append_printf(nonfatal_errors, - "%s\tA profile with the name \"%s\" already exists and will be " - "overwritten.\n", + _("%s\tA profile with the name \"%s\" already exists and will be " + "overwritten.\n"), get_bullet(), dialog->name->str); } else { g_string_append_printf(nonfatal_errors, - "%s\tRenaming this profile from \"%s\" to \"%s\" will " - "overwrite an existing profile.\n", get_bullet(), + _("%s\tRenaming this profile from \"%s\" to \"%s\" will " + "overwrite an existing profile.\n"), get_bullet(), dialog->orig_name->str, dialog->name->str); } } if (!check_valid_source_file(ctk_app_profile, dialog->source_file->str, &reason)) { - g_string_append_printf(fatal_errors, "%s\tThe source filename \"%s\" is not valid in this configuration " - "because %s\n", get_bullet(), dialog->source_file->str, reason); + g_string_append_printf(fatal_errors, _("%s\tThe source filename \"%s\" is not valid in this configuration " + "because %s\n"), get_bullet(), dialog->source_file->str, reason); free(reason); } if (check_unrecognized_setting_keys(dialog->settings, ctk_app_profile->key_docs)) { - g_string_append_printf(nonfatal_errors, "%s\tThis profile has settings with keys that may not be recognized " + g_string_append_printf(nonfatal_errors, _("%s\tThis profile has settings with keys that may not be recognized " "by the NVIDIA graphics driver. Consult the on-line help for a list " - "of valid keys.\n", get_bullet()); + "of valid keys.\n"), get_bullet()); } success = run_error_dialog(GTK_WINDOW(dialog->top_window), fatal_errors, nonfatal_errors, - "save this profile"); + _("save this profile")); g_string_free(fatal_errors, TRUE); g_string_free(nonfatal_errors, TRUE); @@ -2517,12 +2521,12 @@ static void edit_profile_dialog_save_changes(GtkWidget *widget, gpointer user_da json_decref(profile_json); ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Profile \"%s\" updated. %s%s", + _("Profile \"%s\" updated. %s%s"), profile_dialog->name->str, rules_fixed_up ? - "Some rules have been updated to refer " - "to the new profile name. " : "", - STATUSBAR_UPDATE_WARNING); + _("Some rules have been updated to refer " + "to the new profile name. ") : "", + _(STATUSBAR_UPDATE_WARNING)); // Close the window, and re-sensitize the caller gtk_widget_set_sensitive(profile_dialog->caller, TRUE); @@ -2546,35 +2550,35 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, { const ToolbarItemTemplate settings_items[] = { { - .text = "Choose Key Drop Down", - .help_text = "The Key Drop Down allows you to select the registry setting key to add.", + .text = _("Choose Key Drop Down"), + .help_text = _("The Key Drop Down allows you to select the registry setting key to add."), .init_callback = populate_registry_key_combo_callback, .init_data = dialog, .flags = TOOLBAR_ITEM_USE_WIDGET }, { - .text = "Add Setting", - .help_text = "The Add Setting button allows you to create a new setting in the profile.", + .text = _("Add Setting"), + .help_text = _("The Add Setting button allows you to create a new setting in the profile."), .icon_id = GTK_STOCK_ADD, .callback = G_CALLBACK(edit_profile_dialog_add_setting), .user_data = dialog, .flags = 0, }, { - .text = "Delete Setting", - .help_text = "The Delete Setting button allows you to delete a highlighted setting from the profile.", - .extended_help_text = "A setting can also be deleted from the profile by highlighting it in the list " - "and hitting the Delete key.", + .text = _("Delete Setting"), + .help_text = _("The Delete Setting button allows you to delete a highlighted setting from the profile."), + .extended_help_text = _("A setting can also be deleted from the profile by highlighting it in the list " + "and hitting the Delete key."), .icon_id = GTK_STOCK_REMOVE, .callback = G_CALLBACK(edit_profile_dialog_delete_setting), .user_data = dialog, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { - .text = "Edit Setting", - .help_text = "The Edit Setting button allows you to edit a highlighted setting in the profile.", - .extended_help_text = "This will activate an entry box in the setting's key column. To modify the setting's " - "value, hit the Tab key or Right Arrow key, or double-click on the value.", + .text = _("Edit Setting"), + .help_text = _("The Edit Setting button allows you to edit a highlighted setting in the profile."), + .extended_help_text = _("This will activate an entry box in the setting's key column. To modify the setting's " + "value, hit the Tab key or Right Arrow key, or double-click on the value."), .icon_id = GTK_STOCK_PREFERENCES, .callback = G_CALLBACK(edit_profile_dialog_edit_setting), .user_data = dialog, @@ -2588,16 +2592,16 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, .flags = TOOLBAR_ITEM_USE_SEPARATOR, }, { - .text = UPDATE_PROFILE_LABEL, - .help_text = "The Update Profile button allows you to save changes made to the profile definition.", + .text = _(UPDATE_PROFILE_LABEL), + .help_text = _("The Update Profile button allows you to save changes made to the profile definition."), .icon_id = GTK_STOCK_SAVE, .callback = G_CALLBACK(edit_profile_dialog_save_changes), .user_data = dialog, .flags = 0, }, { - .text = "Cancel", - .help_text = "The Cancel button allows you to discard any changes made to the profile definition.", + .text = _("Cancel"), + .help_text = _("The Cancel button allows you to discard any changes made to the profile definition."), .icon_id = GTK_STOCK_CANCEL, .callback = G_CALLBACK(edit_profile_dialog_cancel), .user_data = dialog, @@ -2671,9 +2675,9 @@ static void setting_key_edited(GtkCellRendererText *renderer, ctk_app_profile->key_docs); if (!canonical_key) { edit_profile_dialog_statusbar_message(dialog, - "The key [%s] is not recognized by nvidia-settings. " + _("The key [%s] is not recognized by nvidia-settings. " "Please check for spelling errors (keys " - "are NOT case sensitive).", new_text); + "are NOT case sensitive)."), new_text); } if (canonical_key) { @@ -2820,18 +2824,18 @@ static void setting_value_edited(GtkCellRendererText *renderer, if (!value) { edit_profile_dialog_statusbar_message(dialog, - "The value [%s] was not understood by the JSON parser.", + _("The value [%s] was not understood by the JSON parser."), new_text); update_value = FALSE; } else if (!is_valid_setting_value(value, &invalid_type_str)) { edit_profile_dialog_statusbar_message(dialog, - "A value of type \"%s\" is not allowed in the configuration.", + _("A value of type \"%s\" is not allowed in the configuration."), invalid_type_str); update_value = FALSE; } else if (!is_expected_setting_value(value, expected_type)) { edit_profile_dialog_statusbar_message(dialog, - "The parsed type of the value entered does not match the type " - "expected."); + _("The parsed type of the value entered does not match the type " + "expected.")); } if (update_value) { @@ -2851,48 +2855,48 @@ static TreeViewColumnTemplate *get_profile_settings_tree_view_columns(EditProfil CtkAppProfile *ctk_app_profile = CTK_APP_PROFILE(dialog->parent); const TreeViewColumnTemplate settings_tree_view_columns[] = { { - .title = "Key", + .title = _("Key"), .renderer_func = setting_key_renderer_func, .func_data = dialog, .min_width = 200, .editable = TRUE, .edit_callback = G_CALLBACK(setting_key_edited), - .help_text = "Each entry in the \"Key\" column describes a key for a setting. " + .help_text = _("Each entry in the \"Key\" column describes a key for a setting. " "Any string is a valid key in the configuration, but only some strings " "will be understood by the driver at runtime. See the \"Supported Setting Keys\" " "section in the Application Profiles help page for a list of valid " "application profile setting keys. To edit a setting key, double-click " - "on the cell containing the key." + "on the cell containing the key.") }, { - .title = "Expected Type", + .title = _("Expected Type"), .renderer_func = setting_expected_type_renderer_func, .min_width = 80, .func_data = ctk_app_profile->key_docs, - .help_text = "Each entry in the \"Expected Type\" column describes the type " + .help_text = _("Each entry in the \"Expected Type\" column describes the type " "expected for a known setting key. Unrecognized keys may have an " - "unspecified type. This column is read-only" + "unspecified type. This column is read-only") }, { - .title = "Current Type", + .title = _("Current Type"), .renderer_func = setting_type_renderer_func, .min_width = 80, .func_data = NULL, - .help_text = "Each entry in the \"Current Type\" column describes the underlying JSON type for " + .help_text = _("Each entry in the \"Current Type\" column describes the underlying JSON type for " "a setting value. Supported JSON types are: string, true, false, and number. " - "This column is read-only." + "This column is read-only.") }, { - .title = "Value", + .title = _("Value"), .renderer_func = setting_value_renderer_func, .func_data = dialog, .editable = TRUE, .edit_callback = G_CALLBACK(setting_value_edited), - .help_text = "Each entry in the \"Value\" column describes the value of a setting. To " + .help_text = _("Each entry in the \"Value\" column describes the value of a setting. To " "edit a setting value, double-click on the cell containing the value. " "Valid input is: an arbitrary string in double-quotes, true, false, or " "an integer or floating-point number. Numbers can optionally be written in " - "hexadecimal or octal." + "hexadecimal or octal.") } }; @@ -2947,12 +2951,12 @@ static gboolean edit_profile_dialog_generate_name_button_clicked(GtkWidget *widg return FALSE; } -static const char __profile_name_help[] = "This entry box contains the current profile name, which is a unique identifier for " +static const char __profile_name_help[] = N_("This entry box contains the current profile name, which is a unique identifier for " "this profile. Renaming the profile to an existing profile will cause the existing " - "profile to be overwritten with this profile's contents."; -static const char __generate_name_button_help[] = "This button generates a unique name that is not currently used " + "profile to be overwritten with this profile's contents."); +static const char __generate_name_button_help[] = N_("This button generates a unique name that is not currently used " "by the configuration. This can be used to quickly add a new profile without " - "needing to worry about collisions with existing profile names."; + "needing to worry about collisions with existing profile names."); static EditProfileDialog *edit_profile_dialog_new(CtkAppProfile *ctk_app_profile) { @@ -3018,23 +3022,23 @@ static EditProfileDialog *edit_profile_dialog_new(CtkAppProfile *ctk_app_profile hbox = gtk_hbox_new(FALSE, 0); gtk_box_set_spacing(GTK_BOX(hbox), 4); - label = gtk_label_new("Profile Name"); + label = gtk_label_new(_("Profile Name")); dialog->name_entry = entry = gtk_entry_new(); ctk_config_set_tooltip_and_add_help_data(ctk_app_profile->ctk_config, label, &dialog->top_help_data, - "Profile Name", - __profile_name_help, + _("Profile Name"), + _(__profile_name_help), NULL); - dialog->generate_name_button = button = gtk_button_new_with_label("Generate Name"); + dialog->generate_name_button = button = gtk_button_new_with_label(_("Generate Name")); ctk_config_set_tooltip_and_add_help_data(ctk_app_profile->ctk_config, button, &dialog->top_help_data, - "Generate Name", - __generate_name_button_help, + _("Generate Name"), + _(__generate_name_button_help), NULL); dialog->top_help_data = g_list_reverse(dialog->top_help_data); @@ -3053,7 +3057,7 @@ static EditProfileDialog *edit_profile_dialog_new(CtkAppProfile *ctk_app_profile &container, &dialog->source_file_combo, &dialog->top_help_data, - "profile", + N_("profile"), G_CALLBACK(profile_browse_button_clicked), (gpointer)dialog); @@ -3108,7 +3112,7 @@ static EditProfileDialog *edit_profile_dialog_new(CtkAppProfile *ctk_app_profile NULL); // Save off the "Update Profile" button for later use - dialog->add_edit_profile_button = find_widget_in_widget_data_list(toolbar_widget_items, UPDATE_PROFILE_LABEL); + dialog->add_edit_profile_button = find_widget_in_widget_data_list(toolbar_widget_items, _(UPDATE_PROFILE_LABEL)); widget_data_list_free_full(toolbar_widget_items); @@ -3154,54 +3158,54 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) const ToolbarItemTemplate rules_toolbar_items[] = { { - .text = "Add Rule", - .help_text = "The Add Rule button allows you to create a new rule for applying custom settings " - "to applications which match a given pattern.", - .extended_help_text = "See the \"Add/Edit Rule Dialog Box\" help section for more " - "information on adding new rules.", + .text = _("Add Rule"), + .help_text = _("The Add Rule button allows you to create a new rule for applying custom settings " + "to applications which match a given pattern."), + .extended_help_text = _("See the \"Add/Edit Rule Dialog Box\" help section for more " + "information on adding new rules."), .icon_id = GTK_STOCK_ADD, .callback = (GCallback)add_rule_callback, .user_data = ctk_app_profile, .flags = 0, }, { - .text = "Delete Rule", - .help_text = "The Delete Rule button allows you to remove a highlighted rule from the list.", + .text = _("Delete Rule"), + .help_text = _("The Delete Rule button allows you to remove a highlighted rule from the list."), .icon_id = GTK_STOCK_REMOVE, .callback = (GCallback)delete_rule_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { - .text = "Increase Rule Priority", - .help_text = "This increases the priority of the highlighted rule in the list. If multiple rules " + .text = _("Increase Rule Priority"), + .help_text = _("This increases the priority of the highlighted rule in the list. If multiple rules " "with a conflicting driver setting match the same application, the application will " - "take on the setting value of the highest-priority rule (lowest number) in the list.", - .extended_help_text = "Note that the priority of a rule is partially determined by the source file " + "take on the setting value of the highest-priority rule (lowest number) in the list."), + .extended_help_text = _("Note that the priority of a rule is partially determined by the source file " "where the rule is defined, since the NVIDIA driver prioritizes rules based " "on their position along the configuration file search path. Hence, nvidia-settings " "may move the rule to a different source file if it is necessary for the rule to achieve " - "a particular priority.", + "a particular priority."), .icon_id = GTK_STOCK_GO_UP, .callback = (GCallback)increase_rule_priority_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { - .text = "Decrease Rule Priority", - .help_text = "This decreases the priority of the highlighted rule in the list. If multiple rules " + .text = _("Decrease Rule Priority"), + .help_text = _("This decreases the priority of the highlighted rule in the list. If multiple rules " "with a conflicting driver setting match the same application, the application will " - "take on the setting value of the highest-priority rule (lowest number) in the list.", + "take on the setting value of the highest-priority rule (lowest number) in the list."), .icon_id = GTK_STOCK_GO_DOWN, .callback = (GCallback)decrease_rule_priority_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { - .text = "Edit Rule", - .help_text = "The Edit Rule button allows you to edit a highlighted rule in the list.", - .extended_help_text = "See the \"Add/Edit Rule Dialog Box\" help section for more " - "information on editing rules.", + .text = _("Edit Rule"), + .help_text = _("The Edit Rule button allows you to edit a highlighted rule in the list."), + .extended_help_text = _("See the \"Add/Edit Rule Dialog Box\" help section for more " + "information on editing rules."), // Would be nice to use GTK_STOCK_EDIT here, but unfortunately only // available from 2.6 onwards... .icon_id = GTK_STOCK_PREFERENCES, @@ -3214,46 +3218,46 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) const TreeViewColumnTemplate rules_tree_view_columns[] = { // TODO asterisk column to denote changes { - .title = "Priority", + .title = _("Priority"), .renderer_func = rule_order_renderer_func, .func_data = NULL, - .help_text = "This column describes the priority of each rule in the configuration. " + .help_text = _("This column describes the priority of each rule in the configuration. " "If two rules match the same process and affect settings which overlap, " "the overlapping settings will be set to the values specified by the rule " - "with the lower number (higher priority) in this column." + "with the lower number (higher priority) in this column.") }, { - .title = "Pattern", + .title = _("Pattern"), .renderer_func = rule_pattern_renderer_func, .func_data = NULL, - .help_text = "This column describes the pattern against which the driver will compare " - "the currently running process to determine if it should apply profile settings. ", - .extended_help_text = "See the \"Supported Features\" help section for more information on " - "supported pattern types." + .help_text = _("This column describes the pattern against which the driver will compare " + "the currently running process to determine if it should apply profile settings. "), + .extended_help_text = _("See the \"Supported Features\" help section for more information on " + "supported pattern types.") }, { - .title = "Profile Settings", + .title = _("Profile Settings"), .renderer_func = rule_profile_settings_renderer_func, .func_data = (gpointer)ctk_app_profile, - .help_text = "This column describes the settings that will be applied to processes " + .help_text = _("This column describes the settings that will be applied to processes " "that match the pattern in each rule. Note that profile settings are properties " - "of the profile itself, and not the associated rule." + "of the profile itself, and not the associated rule.") }, { - .title = "Profile Name", + .title = _("Profile Name"), .attribute = "text", .attr_col = CTK_APC_RULE_MODEL_COL_PROFILE_NAME, - .help_text = "This column describes the name of the profile that will be applied to processes " - "that match the pattern in each rule." + .help_text = _("This column describes the name of the profile that will be applied to processes " + "that match the pattern in each rule.") }, { - .title = "Source File", + .title = _("Source File"), .attribute = "text", .attr_col = CTK_APC_RULE_MODEL_COL_FILENAME, - .help_text = "This column describes the configuration file where the rule is defined. Note that " + .help_text = _("This column describes the configuration file where the rule is defined. Note that " "the NVIDIA® Linux Graphics Driver searches for application profiles along a fixed " "search path, and the location of the configuration file in the search path can " - "affect a rule's priority. See the README for more details." + "affect a rule's priority. See the README for more details.") }, }; @@ -3361,9 +3365,9 @@ static void delete_profile_callback_common(CtkAppProfile *ctk_app_profile) path, NULL, FALSE); ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Profile \"%s\" deleted. %s", + _("Profile \"%s\" deleted. %s"), profile_name, - STATUSBAR_UPDATE_WARNING); + _(STATUSBAR_UPDATE_WARNING)); gtk_tree_path_free(path); free(profile_name); @@ -3398,12 +3402,12 @@ static void edit_profile_dialog_load_values(EditProfileDialog *dialog) { // window title gtk_window_set_title(GTK_WINDOW(dialog->top_window), - dialog->new_profile ? "Add new profile" : "Edit existing profile"); + dialog->new_profile ? _("Add new profile") : _("Edit existing profile")); // add/edit button tool_button_set_label_and_stock_icon( GTK_TOOL_BUTTON(dialog->add_edit_profile_button), - "Update Profile", + _("Update Profile"), dialog->new_profile ? GTK_STOCK_ADD : GTK_STOCK_PREFERENCES); // profile name @@ -3545,29 +3549,29 @@ static GtkWidget* create_profiles_page(CtkAppProfile *ctk_app_profile) const ToolbarItemTemplate profiles_toolbar_items[] = { { - .text = "Add Profile", - .help_text = "The Add Profile button allows you to create a new profile for applying custom settings " - "to applications which match a given pattern.", - .extended_help_text = "See the \"Add/Edit Profile Dialog Box\" help section for more " - "information on adding new profiles.", + .text = _("Add Profile"), + .help_text = _("The Add Profile button allows you to create a new profile for applying custom settings " + "to applications which match a given pattern."), + .extended_help_text = _("See the \"Add/Edit Profile Dialog Box\" help section for more " + "information on adding new profiles."), .icon_id = GTK_STOCK_ADD, .callback = (GCallback)add_profile_callback, .user_data = ctk_app_profile, .flags = 0 }, { - .text = "Delete Profile", - .help_text = "The Delete Profile button allows you to remove a highlighted profile from the list.", + .text = _("Delete Profile"), + .help_text = _("The Delete Profile button allows you to remove a highlighted profile from the list."), .icon_id = GTK_STOCK_REMOVE, .callback = (GCallback)delete_profile_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { - .text = "Edit Profile", - .help_text = "The Edit Profile button allows you to edit a highlighted profile in the list.", - .extended_help_text = "See the \"Add/Edit Profile Dialog Box\" help section for more " - "information on editing profiles.", + .text = _("Edit Profile"), + .help_text = _("The Edit Profile button allows you to edit a highlighted profile in the list."), + .extended_help_text = _("See the \"Add/Edit Profile Dialog Box\" help section for more " + "information on editing profiles."), // Would be nice to use GTK_STOCK_EDIT here, but unfortunately only // available from 2.6 onwards... .icon_id = GTK_STOCK_PREFERENCES, @@ -3580,29 +3584,29 @@ static GtkWidget* create_profiles_page(CtkAppProfile *ctk_app_profile) const TreeViewColumnTemplate profiles_tree_view_columns[] = { // TODO asterisk column to denote changes { - .title = "Profile Name", + .title = _("Profile Name"), .attribute = "text", .attr_col = CTK_APC_PROFILE_MODEL_COL_NAME, .sortable = TRUE, .sort_column_id = CTK_APC_PROFILE_MODEL_COL_NAME, - .help_text = "This column describes the name of the profile." + .help_text = _("This column describes the name of the profile.") }, { - .title = "Profile Settings", + .title = _("Profile Settings"), .renderer_func = profile_settings_renderer_func, .func_data = NULL, .sortable = TRUE, .sort_column_id = CTK_APC_PROFILE_MODEL_COL_SETTINGS, - .help_text = "This column describes the settings that will be applied by rules " - "which use this profile." + .help_text = _("This column describes the settings that will be applied by rules " + "which use this profile.") }, { - .title = "Source File", + .title = _("Source File"), .attribute = "text", .attr_col = CTK_APC_PROFILE_MODEL_COL_FILENAME, .sortable = TRUE, .sort_column_id = CTK_APC_PROFILE_MODEL_COL_FILENAME, - .help_text = "This column describes the configuration file where the profile is defined." + .help_text = _("This column describes the configuration file where the profile is defined.") }, }; @@ -3778,33 +3782,33 @@ static void reload_callback(GtkWidget *widget, gpointer user_data) GString *nonfatal_errors = g_string_new(""); static const char unsaved_changes_error[] = - "There are unsaved changes in the configuration which will be permanently lost if " - "the configuration is reloaded from disk.\n"; + N_("There are unsaved changes in the configuration which will be permanently lost if " + "the configuration is reloaded from disk.\n"); static const char files_altered_error[] = - "Some configuration files may have been modified externally since the configuration " - "was last loaded from disk.\n"; + N_("Some configuration files may have been modified externally since the configuration " + "was last loaded from disk.\n"); updates = nv_app_profile_config_validate(ctk_app_profile->cur_config, ctk_app_profile->gold_config); if (json_array_size(updates) > 0) { - g_string_append_printf(nonfatal_errors, "%s\t%s", get_bullet(), unsaved_changes_error); + g_string_append_printf(nonfatal_errors, "%s\t%s", get_bullet(), _(unsaved_changes_error)); } if (nv_app_profile_config_check_backing_files(ctk_app_profile->cur_config)) { - g_string_append_printf(nonfatal_errors, "%s\t%s", get_bullet(), files_altered_error); + g_string_append_printf(nonfatal_errors, "%s\t%s", get_bullet(), _(files_altered_error)); } do_reload = run_error_dialog(GTK_WINDOW(gtk_widget_get_toplevel( GTK_WIDGET(ctk_app_profile))), fatal_errors, nonfatal_errors, - "reload the configuration from disk"); + _("reload the configuration from disk")); if (do_reload) { app_profile_reload(ctk_app_profile); ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Application profile configuration reloaded from disk."); + _("Application profile configuration reloaded from disk.")); } g_string_free(fatal_errors, TRUE); @@ -3822,23 +3826,23 @@ static ToolbarItemTemplate *get_save_reload_toolbar_items(CtkAppProfile *ctk_app .flags = TOOLBAR_ITEM_USE_SEPARATOR, }, { - .text = "Save Changes", - .help_text = "The Save Changes button allows you to save any changes to application profile " - "configuration files to disk.", - .extended_help_text = "This button displays a dialog box which allows you to preview the changes " + .text = _("Save Changes"), + .help_text = _("The Save Changes button allows you to save any changes to application profile " + "configuration files to disk."), + .extended_help_text = _("This button displays a dialog box which allows you to preview the changes " "that will be made to the JSON configuration files, and toggle whether nvidia-settings " - "should make backup copies of the original files before overwriting existing files.", + "should make backup copies of the original files before overwriting existing files."), .icon_id = GTK_STOCK_SAVE, .callback = (GCallback)save_changes_callback, .user_data = ctk_app_profile, .flags = 0, }, { - .text = "Reload", - .help_text = "The Reload button allows you to reload application profile configuration from " - "disk, reverting any unsaved changes.", - .extended_help_text = "If nvidia-settings detects unsaved changes in the configuration, this button will " - "display a dialog box to warn you before attempting to reload.", + .text = _("Reload"), + .help_text = _("The Reload button allows you to reload application profile configuration from " + "disk, reverting any unsaved changes."), + .extended_help_text = _("If nvidia-settings detects unsaved changes in the configuration, this button will " + "display a dialog box to warn you before attempting to reload."), .icon_id = GTK_STOCK_REFRESH, .callback = (GCallback)reload_callback, .user_data = ctk_app_profile, @@ -3865,13 +3869,13 @@ static void save_app_profile_changes_dialog_save_changes(GtkWidget *widget, gpoi CtkAppProfile *ctk_app_profile = CTK_APP_PROFILE(dialog->parent); char *write_errors = NULL; static const char config_files_changed_string[] = - "nvidia-settings has detected that configuration files have changed " + N_("nvidia-settings has detected that configuration files have changed " "since the configuration was last loaded. Saving the configuration " - "may cause these changes to be permanently lost. Continue anyway?\n"; + "may cause these changes to be permanently lost. Continue anyway?\n"); static const char write_errors_occurred_prefix[] = - "nvidia-settings encountered errors when writing to the configuration:\n"; + N_("nvidia-settings encountered errors when writing to the configuration:\n"); static const char write_errors_occurred_suffix[] = - "\nSome changes may not have been saved. Reload the configuration anyway?\n"; + N_("\nSome changes may not have been saved. Reload the configuration anyway?\n"); // First check for possible conflicts if (nv_app_profile_config_check_backing_files(ctk_app_profile->cur_config)) { @@ -3879,7 +3883,7 @@ static void save_app_profile_changes_dialog_save_changes(GtkWidget *widget, gpoi GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - "%s", config_files_changed_string); + "%s", _(config_files_changed_string)); result = gtk_dialog_run(GTK_DIALOG(error_dialog)); if (result != GTK_RESPONSE_YES) { do_save = FALSE; @@ -3895,7 +3899,7 @@ static void save_app_profile_changes_dialog_save_changes(GtkWidget *widget, gpoi do_backup, &write_errors); if (ret < 0) { if (!write_errors) { - write_errors = strdup("Unknown error."); + write_errors = strdup(_("Unknown error.")); } error_dialog = gtk_message_dialog_new(GTK_WINDOW(dialog->top_window), @@ -3904,9 +3908,9 @@ static void save_app_profile_changes_dialog_save_changes(GtkWidget *widget, gpoi GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s%s%s", - write_errors_occurred_prefix, + _(write_errors_occurred_prefix), write_errors, - write_errors_occurred_suffix); + _(write_errors_occurred_suffix)); result = gtk_dialog_run(GTK_DIALOG(error_dialog)); if (result != GTK_RESPONSE_YES) { do_reload = FALSE; @@ -3921,7 +3925,7 @@ static void save_app_profile_changes_dialog_save_changes(GtkWidget *widget, gpoi } ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Application profile configuration saved to disk."); + _("Application profile configuration saved to disk.")); } json_decref(dialog->updates); @@ -3948,16 +3952,16 @@ static ToolbarItemTemplate *get_save_app_profile_changes_toolbar_items(SaveAppPr ToolbarItemTemplate *items_copy; const ToolbarItemTemplate items[] = { { - .text = "Save Changes", - .help_text = "Save the changes to disk.", + .text = _("Save Changes"), + .help_text = _("Save the changes to disk."), .icon_id = GTK_STOCK_SAVE, .callback = G_CALLBACK(save_app_profile_changes_dialog_save_changes), .user_data = dialog, .flags = 0, }, { - .text = "Cancel", - .help_text = "Cancel the save operation.", + .text = _("Cancel"), + .help_text = _("Cancel the save operation."), .icon_id = GTK_STOCK_CANCEL, .callback = G_CALLBACK(save_app_profile_changes_dialog_cancel), .user_data = dialog, @@ -3980,11 +3984,11 @@ static void save_app_profile_changes_dialog_set_preview_visibility(SaveAppProfil gtk_widget_show(dialog->preview_vbox); gtk_window_set_resizable(GTK_WINDOW(dialog->top_window), TRUE); gtk_widget_set_size_request(dialog->preview_vbox, -1, 400); - gtk_button_set_label(GTK_BUTTON(dialog->preview_button), "Hide Preview"); + gtk_button_set_label(GTK_BUTTON(dialog->preview_button), _("Hide Preview")); } else { gtk_widget_hide(dialog->preview_vbox); gtk_window_set_resizable(GTK_WINDOW(dialog->top_window), FALSE); - gtk_button_set_label(GTK_BUTTON(dialog->preview_button), "Show Preview"); + gtk_button_set_label(GTK_BUTTON(dialog->preview_button), _("Show Preview")); } } @@ -4070,7 +4074,7 @@ static SaveAppProfileChangesDialog *save_app_profile_changes_dialog_new(CtkAppPr dialog->show_preview = FALSE; - gtk_window_set_title(GTK_WINDOW(dialog->top_window), "Save Changes"); + gtk_window_set_title(GTK_WINDOW(dialog->top_window), _("Save Changes")); gtk_window_set_modal(GTK_WINDOW(dialog->top_window), TRUE); gtk_container_set_border_width(GTK_CONTAINER(dialog->top_window), 8); @@ -4086,7 +4090,7 @@ static SaveAppProfileChangesDialog *save_app_profile_changes_dialog_new(CtkAppPr gtk_container_add(GTK_CONTAINER(dialog->top_window), vbox); - label = gtk_label_new("The following files will be modified after the configuration is saved."); + label = gtk_label_new(_("The following files will be modified after the configuration is saved.")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); @@ -4100,15 +4104,15 @@ static SaveAppProfileChangesDialog *save_app_profile_changes_dialog_new(CtkAppPr G_CALLBACK(save_app_profile_changes_dialog_preview_changed), (gpointer)dialog); - dialog->preview_button = gtk_button_new_with_label("Show Preview"); + dialog->preview_button = gtk_button_new_with_label(_("Show Preview")); gtk_box_pack_start(GTK_BOX(hbox), dialog->preview_button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(dialog->preview_button), "clicked", G_CALLBACK(save_app_profile_changes_show_preview_button_clicked), (gpointer)dialog); ctk_config_set_tooltip(ctk_app_profile->ctk_config, dialog->preview_button, - "This button allows you to toggle previewing the new contents of " - "the currently selected configuration file."); + _("This button allows you to toggle previewing the new contents of " + "the currently selected configuration file.")); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); @@ -4116,12 +4120,12 @@ static SaveAppProfileChangesDialog *save_app_profile_changes_dialog_new(CtkAppPr hbox = gtk_hbox_new(FALSE, 8); - label = gtk_label_new("Backup filename"); + label = gtk_label_new(_("Backup filename")); ctk_config_set_tooltip(ctk_app_profile->ctk_config, label, - "This text field contains the filename that nvidia-settings will use " + _("This text field contains the filename that nvidia-settings will use " "to back up the currently selected configuration file when saving the " - "configuration."); + "configuration.")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); dialog->preview_backup_entry = gtk_entry_new(); @@ -4142,14 +4146,14 @@ static SaveAppProfileChangesDialog *save_app_profile_changes_dialog_new(CtkAppPr gtk_box_pack_start(GTK_BOX(vbox), preview_vbox, TRUE, TRUE, 0); dialog->backup_check_button = check_button = - gtk_check_button_new_with_label("Back up original files"); + gtk_check_button_new_with_label(_("Back up original files")); // Enable backups by default gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), TRUE); ctk_config_set_tooltip(ctk_app_profile->ctk_config, check_button, - "This checkbox determines whether nvidia-settings will attempt to back up " - "the original configuration files before saving the new configuration."); + _("This checkbox determines whether nvidia-settings will attempt to back up " + "the original configuration files before saving the new configuration.")); gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0); @@ -4250,29 +4254,29 @@ static void save_changes_callback(GtkWidget *widget, gpointer user_data) } static const char __enabling_application_profiles_help[] = - "Application profile support can be toggled by clicking on the \"Enable application profiles\" " + N_("Application profile support can be toggled by clicking on the \"Enable application profiles\" " "checkbox. Note that changes to this setting will not be saved to disk until the \"Save Changes\" " - "button is clicked."; + "button is clicked."); static const char __rules_page_help[] = - "The Rules page allows you to specify rules for assigning profiles to applications."; + N_("The Rules page allows you to specify rules for assigning profiles to applications."); static const char __rules_page_extended_help[] = - "Rules are presented in a list sorted by priority; higher-priority items appear farther " + N_("Rules are presented in a list sorted by priority; higher-priority items appear farther " "up in the list and have a smaller priority number. Dragging and dropping a rule in this list " "reorders it (potentially modifying its source file; see below), and double-clicking on a " "given rule will open a dialog box which lets the user edit the rule (see the \"Add/Edit Rule " "Dialog Box\" help section for more information). A rule can be deleted by highlighting it in " "the view and hitting the Delete key.\n\n" "Note that changes made to rules in this page are not saved to disk until the \"Save Changes\" " - "button is clicked."; + "button is clicked."); static const char __profiles_page_help[] = - "The Profiles page allows you to create and modify profiles in the configuration."; + N_("The Profiles page allows you to create and modify profiles in the configuration."); static const char __profiles_page_extended_help[] = - "Profiles are presented in a list which can be sorted by profile name, profile settings, and " + N_("Profiles are presented in a list which can be sorted by profile name, profile settings, and " "originating source file. Double-clicking on a profile will open a dialog box which lets the user " "edit the rule (see the \"Add/Edit Profile Dialog Box\" help section for more information). A " "profile can be deleted by highlighting it in the view and hitting the Delete key.\n\n" "Note that changes made to profiles in this page are not saved to disk until the \"Save Changes\" " - "button is clicked."; + "button is clicked."); GtkTextBuffer *ctk_app_profile_create_help(CtkAppProfile *ctk_app_profile, GtkTextTagTable *table) @@ -4284,97 +4288,97 @@ GtkTextBuffer *ctk_app_profile_create_help(CtkAppProfile *ctk_app_profile, GtkTe b = gtk_text_buffer_new(table); gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "Application Profiles Help"); + ctk_help_title(b, &i, _("Application Profiles Help")); - ctk_help_para(b, &i, "Use this page to configure application profiles for " + ctk_help_para(b, &i, _("Use this page to configure application profiles for " "use with the NVIDIA® Linux Graphics Driver. Application profiles " "are collections of settings that are applied on a per-process basis. " "When the driver is loaded into the process, it detects various attributes " "of the running process and determines whether settings should be applied " "based on these attributes. This mechanism allows users to selectively override " "driver settings for a particular application without the need to set environment " - "variables on the command line prior to running the application."); - ctk_help_para(b, &i, "Application profile configuration consists of \"rules\" and \"profiles\". A \"profile\" defines " + "variables on the command line prior to running the application.")); + ctk_help_para(b, &i, _("Application profile configuration consists of \"rules\" and \"profiles\". A \"profile\" defines " "what settings to use, and a \"rule\" identifies an application and defines what profile " - "should be used with that application."); + "should be used with that application.")); - ctk_help_para(b, &i, "A rule identifies an application by describing various features of the application; for example, " + ctk_help_para(b, &i, _("A rule identifies an application by describing various features of the application; for example, " "the name of the application binary (e.g. \"glxgears\") or a shared library loaded into the application " "(e.g. \"libpthread.so.0\"). The particular features supported by this NVIDIA® Linux implementation " - "are listed below in the \"Supported Features\" section."); + "are listed below in the \"Supported Features\" section.")); - ctk_help_para(b, &i, "For more information on application profiles, please consult the README."); + ctk_help_para(b, &i, _("For more information on application profiles, please consult the README.")); - ctk_help_heading(b, &i, "Global Settings"); - ctk_help_para(b, &i, "These settings apply to all profiles and rules within the configuration. "); + ctk_help_heading(b, &i, _("Global Settings")); + ctk_help_para(b, &i, _("These settings apply to all profiles and rules within the configuration. ")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->global_settings_help_data); - ctk_help_heading(b, &i, "Rules Page"); - ctk_help_para(b, &i, __rules_page_help); - ctk_help_para(b, &i, __rules_page_extended_help); + ctk_help_heading(b, &i, _("Rules Page")); + ctk_help_para(b, &i, _(__rules_page_help)); + ctk_help_para(b, &i, _(__rules_page_extended_help)); - ctk_help_para(b, &i, "There are several buttons above the list of rules " - "which can be used to modify the configuration:"); + ctk_help_para(b, &i, _("There are several buttons above the list of rules " + "which can be used to modify the configuration:")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->rules_help_data); - ctk_help_heading(b, &i, "Rule Properties"); - ctk_help_para(b, &i, "Each row in the list of rules is divided into several " - "columns which describe different properties of a rule: "); + ctk_help_heading(b, &i, _("Rule Properties")); + ctk_help_para(b, &i, _("Each row in the list of rules is divided into several " + "columns which describe different properties of a rule: ")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->rules_columns_help_data); - ctk_help_heading(b, &i, "Add/Edit Rule Dialog Box"); - ctk_help_para(b, &i, "When adding a new rule or editing an existing rule, nvidia-settings " - "opens a dialog box for you to modify the rule's attributes. "); + ctk_help_heading(b, &i, _("Add/Edit Rule Dialog Box")); + ctk_help_para(b, &i, _("When adding a new rule or editing an existing rule, nvidia-settings " + "opens a dialog box for you to modify the rule's attributes. ")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->edit_rule_dialog->help_data); - ctk_help_heading(b, &i, "Profiles Page"); - ctk_help_para(b, &i, __profiles_page_help); - ctk_help_para(b, &i, __profiles_page_extended_help); - ctk_help_para(b, &i, "There are several buttons above the list of profiles " - "which can be used to modify the configuration:"); + ctk_help_heading(b, &i, _("Profiles Page")); + ctk_help_para(b, &i, _(__profiles_page_help)); + ctk_help_para(b, &i, _(__profiles_page_extended_help)); + ctk_help_para(b, &i, _("There are several buttons above the list of profiles " + "which can be used to modify the configuration:")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->profiles_help_data); - ctk_help_heading(b, &i, "Profile Properties"); - ctk_help_para(b, &i, "Each row in the list of profiles is divided into several " - "columns which describe different properties of a profile:"); + ctk_help_heading(b, &i, _("Profile Properties")); + ctk_help_para(b, &i, _("Each row in the list of profiles is divided into several " + "columns which describe different properties of a profile:")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->profiles_columns_help_data); - ctk_help_heading(b, &i, "Add/Edit Profile Dialog Box"); - ctk_help_para(b, &i, "When adding a new profile or editing an existing profile, nvidia-settings " + ctk_help_heading(b, &i, _("Add/Edit Profile Dialog Box")); + ctk_help_para(b, &i, _("When adding a new profile or editing an existing profile, nvidia-settings " "opens a dialog box for you to modify the profile's attributes. " - "See \"Editing Settings in a Profile\" for information on editing settings."); + "See \"Editing Settings in a Profile\" for information on editing settings.")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->edit_profile_dialog->top_help_data); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->edit_profile_dialog->bottom_help_data); - ctk_help_heading(b, &i, "Editing Settings in a Profile"); - ctk_help_para(b, &i, "Settings in a profile are presented in a list view with the following columns: "); + ctk_help_heading(b, &i, _("Editing Settings in a Profile")); + ctk_help_para(b, &i, _("Settings in a profile are presented in a list view with the following columns: ")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->edit_profile_dialog->setting_column_help_data); - ctk_help_para(b, &i, "Settings can be modified using the following toolbar buttons: "); + ctk_help_para(b, &i, _("Settings can be modified using the following toolbar buttons: ")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->edit_profile_dialog->setting_toolbar_help_data); - ctk_help_heading(b, &i, "Saving and Reverting Changes"); + ctk_help_heading(b, &i, _("Saving and Reverting Changes")); - ctk_help_para(b, &i, "Changes made to the application profile configuration will not take effect until " + ctk_help_para(b, &i, _("Changes made to the application profile configuration will not take effect until " "they are saved to disk. Buttons to save and restore the configuration " - "are located on the bottom of the Application Profiles page."); + "are located on the bottom of the Application Profiles page.")); ctk_help_data_list_print_terms(b, &i, ctk_app_profile->save_reload_help_data); - ctk_help_heading(b, &i, "Supported Features"); + ctk_help_heading(b, &i, _("Supported Features")); - ctk_help_para(b, &i, "This NVIDIA® Linux Graphics Driver supports detection of the following features:"); + ctk_help_para(b, &i, _("This NVIDIA® Linux Graphics Driver supports detection of the following features:")); for (j = 0; j < NUM_RULE_FEATURES; j++) { - ctk_help_term(b, &i, "%s", rule_feature_label_strings[j]); - ctk_help_para(b, &i, "%s", rule_feature_help_text[j]); + ctk_help_term(b, &i, "%s", _(rule_feature_label_strings[j])); + ctk_help_para(b, &i, "%s", _(rule_feature_help_text[j])); } - ctk_help_heading(b, &i, "Supported Setting Keys"); + ctk_help_heading(b, &i, _("Supported Setting Keys")); if (json_array_size(key_docs) > 0) { - ctk_help_para(b, &i, "This NVIDIA® Linux Graphics Driver supports the following application profile setting " - "keys. For more information on a given key, please consult the README."); + ctk_help_para(b, &i, _("This NVIDIA® Linux Graphics Driver supports the following application profile setting " + "keys. For more information on a given key, please consult the README.")); for (j = 0; j < json_array_size(key_docs); j++) { json_t *key_obj = json_array_get(key_docs, j); @@ -4384,9 +4388,9 @@ GtkTextBuffer *ctk_app_profile_create_help(CtkAppProfile *ctk_app_profile, GtkTe ctk_help_para(b, &i, "%s", json_string_value(key_desc)); } } else { - ctk_help_para(b, &i, "There was an error reading the application profile setting " + ctk_help_para(b, &i, _("There was an error reading the application profile setting " "keys resource file. For information on available keys, please " - "consult the README."); + "consult the README.")); } ctk_help_finish(b); @@ -4403,10 +4407,9 @@ static void enabled_check_button_toggled(GtkToggleButton *toggle_button, gtk_toggle_button_get_active(toggle_button)); ctk_config_statusbar_message(ctk_app_profile->ctk_config, - "Application profiles are %s. %s", gtk_toggle_button_get_active(toggle_button) ? - "enabled" : "disabled", - STATUSBAR_UPDATE_WARNING); + _("Application profiles are enabled. %s") : _("Application profiles are disabled. %s"), + _(STATUSBAR_UPDATE_WARNING)); } GtkWidget* ctk_app_profile_new(CtrlTarget *ctrl_target, @@ -4467,14 +4470,14 @@ GtkWidget* ctk_app_profile_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(ctk_app_profile), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Application Profiles"); + label = gtk_label_new(_("Application Profiles")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5); ctk_app_profile->enable_check_button = - gtk_check_button_new_with_label("Enable application profiles"); + gtk_check_button_new_with_label(_("Enable application profiles")); gtk_box_pack_start(GTK_BOX(ctk_app_profile), ctk_app_profile->enable_check_button, FALSE, FALSE, 0); @@ -4487,8 +4490,8 @@ GtkWidget* ctk_app_profile_new(CtrlTarget *ctrl_target, ctk_config_set_tooltip_and_add_help_data(ctk_app_profile->ctk_config, ctk_app_profile->enable_check_button, &ctk_app_profile->global_settings_help_data, - "Enabling Application Profiles", - __enabling_application_profiles_help, + _("Enabling Application Profiles"), + _(__enabling_application_profiles_help), NULL); app_profile_load_global_settings(ctk_app_profile, @@ -4501,16 +4504,16 @@ GtkWidget* ctk_app_profile_new(CtrlTarget *ctrl_target, /* Build the rules page */ rules_page = create_rules_page(ctk_app_profile); - label = gtk_label_new("Rules"); + label = gtk_label_new(_("Rules")); - ctk_config_set_tooltip(ctk_app_profile->ctk_config, label, __rules_page_help); + ctk_config_set_tooltip(ctk_app_profile->ctk_config, label, _(__rules_page_help)); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), rules_page, label); /* Build the profiles page */ profiles_page = create_profiles_page(ctk_app_profile); - label = gtk_label_new("Profiles"); + label = gtk_label_new(_("Profiles")); - ctk_config_set_tooltip(ctk_app_profile->ctk_config, label, __profiles_page_help); + ctk_config_set_tooltip(ctk_app_profile->ctk_config, label, _(__profiles_page_help)); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), profiles_page, label); /* Add the notebook to the main container */ diff --git a/src/gtk+-2.x/ctkcolorcontrols.c b/src/gtk+-2.x/ctkcolorcontrols.c index db2d9e7e..5c245ae3 100644 --- a/src/gtk+-2.x/ctkcolorcontrols.c +++ b/src/gtk+-2.x/ctkcolorcontrols.c @@ -28,6 +28,8 @@ #include #include #include +#include + #include "ctkconfig.h" #include "ctkhelp.h" @@ -35,6 +37,9 @@ #include "ctkdropdownmenu.h" #include "ctkutils.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + /* function prototypes */ static void ctk_color_controls_class_init(CtkColorControlsClass *ctk_object_class); @@ -75,22 +80,22 @@ static void post_color_space_update(CtkColorControls *ctk_color_controls, /* help text */ static const char * __color_controls_help = -"The Color Controls allow changing the preferred color space and color range " +N_("The Color Controls allow changing the preferred color space and color range " "of the display device. These settings may be overridden depending on the " -"current mode and color space on the display device."; +"current mode and color space on the display device."); static const char * __color_space_help = -"The possible values for Color Space vary depending on the capabilities of " +N_("The possible values for Color Space vary depending on the capabilities of " "the display device and the GPU, but may contain \"RGB\", \"YCbCr422\", " "and \"YCbCr444\". If an HDMI 2.0 4K@60Hz mode is in use and the display " "device or GPU is incapable of driving the mode in RGB, the preferred color " -"space is preserved, but the current color space is overridden to YCbCr420."; +"space is preserved, but the current color space is overridden to YCbCr420."); static const char * __color_range_help = -"The possible values for Color Range are \"Limited\" and \"Full\". " +N_("The possible values for Color Range are \"Limited\" and \"Full\". " "If the current color space only allows a limited color range, the " "preferred color range is preserved, but the current color range " -"is overridden to limited range."; +"is overridden to limited range."); GType ctk_color_controls_get_type(void) { @@ -215,7 +220,7 @@ GtkWidget* ctk_color_controls_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, FRAME_PADDING); ctk_color_controls->color_controls_box = hbox; - frame = gtk_frame_new("Color Controls"); + frame = gtk_frame_new(_("Color Controls")); gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); table = gtk_table_new(3, 4, FALSE); @@ -245,7 +250,7 @@ GtkWidget* ctk_color_controls_new(CtrlTarget *ctrl_target, ctk_color_controls->color_space_menu = GTK_WIDGET(menu); ctk_config_set_tooltip(ctk_config, ctk_color_controls->color_space_menu, - __color_space_help); + _(__color_space_help)); /* If dropdown only has one item, disable it */ if (ctk_color_controls->color_space_table_size > 1) { @@ -263,7 +268,7 @@ GtkWidget* ctk_color_controls_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Color Space: "); + label = gtk_label_new(_("Color Space: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -278,7 +283,7 @@ GtkWidget* ctk_color_controls_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Current Color Space: "); + label = gtk_label_new(_("Current Color Space: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -302,13 +307,13 @@ GtkWidget* ctk_color_controls_new(CtrlTarget *ctrl_target, menu = (CtkDropDownMenu *) ctk_drop_down_menu_new(CTK_DROP_DOWN_MENU_FLAG_READONLY); - ctk_drop_down_menu_append_item(menu, "Full", 0); - ctk_drop_down_menu_append_item(menu, "Limited", 1); + ctk_drop_down_menu_append_item(menu, _("Full"), 0); + ctk_drop_down_menu_append_item(menu, _("Limited"), 1); ctk_color_controls->color_range_menu = GTK_WIDGET(menu); ctk_config_set_tooltip(ctk_config, ctk_color_controls->color_range_menu, - __color_range_help); + _(__color_range_help)); g_signal_connect(G_OBJECT(ctk_color_controls->color_range_menu), "changed", G_CALLBACK(color_range_menu_changed), @@ -319,7 +324,7 @@ GtkWidget* ctk_color_controls_new(CtrlTarget *ctrl_target, gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Color Range: "); + label = gtk_label_new(_("Color Range: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -334,7 +339,7 @@ GtkWidget* ctk_color_controls_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 2, 3, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Current Color Range: "); + label = gtk_label_new(_("Current Color Range: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -460,15 +465,15 @@ static void update_current_color_range_text(CtkColorControls *ctk_color_controls switch(color_range) { case NV_CTRL_CURRENT_COLOR_RANGE_FULL: gtk_label_set_text(GTK_LABEL(ctk_color_controls->current_color_range_txt), - "Full"); + _("Full")); break; case NV_CTRL_CURRENT_COLOR_RANGE_LIMITED: gtk_label_set_text(GTK_LABEL(ctk_color_controls->current_color_range_txt), - "Limited"); + _("Limited")); break; default: gtk_label_set_text(GTK_LABEL(ctk_color_controls->current_color_range_txt), - "Unknown"); + _("Unknown")); break; } } /* update_current_color_range_text() */ @@ -551,7 +556,7 @@ static void update_current_color_space_text(CtkColorControls *ctk_color_controls break; default: gtk_label_set_text(GTK_LABEL(ctk_color_controls->current_color_space_txt), - "Unknown"); + _("Unknown")); break; } } /* update_current_color_space_text() */ @@ -620,13 +625,13 @@ void post_current_color_range_update(CtkColorControls *ctk_color_controls, gint color_range) { static const char *color_range_table[] = { - "Full", /* NV_CTRL_CURRENT_COLOR_RANGE_FULL */ - "Limited", /* NV_CTRL_CURRENT_COLOR_RANGE_LIMITED */ + N_("Full"), /* NV_CTRL_CURRENT_COLOR_RANGE_FULL */ + N_("Limited"), /* NV_CTRL_CURRENT_COLOR_RANGE_LIMITED */ }; ctk_config_statusbar_message(ctk_color_controls->ctk_config, - "Current Color Range set to %s for %s.", - color_range_table[color_range], + _("Current Color Range set to %s for %s."), + _(color_range_table[color_range]), ctk_color_controls->name); } @@ -635,14 +640,14 @@ void post_color_range_update(CtkColorControls *ctk_color_controls, gint color_range) { static const char *color_range_table[] = { - "Full", /* NV_CTRL_COLOR_RANGE_FULL */ - "Limited", /* NV_CTRL_COLOR_RANGE_LIMITED */ + N_("Full"), /* NV_CTRL_COLOR_RANGE_FULL */ + N_("Limited"), /* NV_CTRL_COLOR_RANGE_LIMITED */ }; gtk_widget_set_sensitive(ctk_color_controls->reset_button, TRUE); ctk_config_statusbar_message(ctk_color_controls->ctk_config, - "Color Range set to %s for %s.", - color_range_table[color_range], + _("Color Range set to %s for %s."), + _(color_range_table[color_range]), ctk_color_controls->name); } @@ -658,7 +663,7 @@ void post_current_color_space_update(CtkColorControls *ctk_color_controls, }; ctk_config_statusbar_message(ctk_color_controls->ctk_config, - "Current Color Space set to %s for %s.", + _("Current Color Space set to %s for %s."), color_space_table[color_space], ctk_color_controls->name); } @@ -675,7 +680,7 @@ void post_color_space_update(CtkColorControls *ctk_color_controls, gtk_widget_set_sensitive(ctk_color_controls->reset_button, TRUE); ctk_config_statusbar_message(ctk_color_controls->ctk_config, - "Color Space set to %s for %s.", + _("Color Space set to %s for %s."), color_space_table[ctk_color_controls->color_space_table[color_space]], ctk_color_controls->name); } @@ -775,14 +780,14 @@ void add_color_controls_help(CtkColorControls *ctk_color_controls, return; } - ctk_help_heading(b, i, "Color Controls"); - ctk_help_para(b, i, "%s", __color_controls_help); + ctk_help_heading(b, i, _("Color Controls")); + ctk_help_para(b, i, "%s", _(__color_controls_help)); - ctk_help_term(b, i, "Color Space"); - ctk_help_para(b, i, "%s", __color_space_help); + ctk_help_term(b, i, _("Color Space")); + ctk_help_para(b, i, "%s", _(__color_space_help)); - ctk_help_term(b, i, "Color Range"); - ctk_help_para(b, i, "%s", __color_range_help); + ctk_help_term(b, i, _("Color Range")); + ctk_help_para(b, i, "%s", _(__color_range_help)); } /* add_color_controls_help() */ diff --git a/src/gtk+-2.x/ctkcolorcorrection.c b/src/gtk+-2.x/ctkcolorcorrection.c index d94b3100..a2479f2c 100644 --- a/src/gtk+-2.x/ctkcolorcorrection.c +++ b/src/gtk+-2.x/ctkcolorcorrection.c @@ -36,26 +36,29 @@ #include #include +#include +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING -static const char *__active_color_help = "The Active Color Channel drop-down " +static const char *__active_color_help = N_("The Active Color Channel drop-down " "menu allows you to select the color channel controlled by the Brightness, " "Contrast and Gamma sliders. You can adjust the red, green or blue channels " -"individually or all three channels at once."; +"individually or all three channels at once."); -static const char *__resest_button_help = "The Reset Hardware Defaults " -"button restores the color correction settings to their default values."; +static const char *__resest_button_help = N_("The Reset Hardware Defaults " +"button restores the color correction settings to their default values."); -static const char *__confirm_button_help = "Some color correction settings " +static const char *__confirm_button_help = N_("Some color correction settings " "can yield an unusable display " "(e.g., making the display unreadably dark or light). When you " "change the color correction values, the '10 Seconds to Confirm' " "button will count down to zero. If you have not clicked the " -"button by then to accept the changes, it will restore your previous values."; +"button by then to accept the changes, it will restore your previous values."); -static const char *__color_curve_help = "The color curve graph changes to " +static const char *__color_curve_help = N_("The color curve graph changes to " "reflect your adjustments made with the Brightness, Contrast, and Gamma " -"sliders."; +"sliders."); static void color_channel_changed (GtkComboBox *, gpointer); @@ -302,7 +305,7 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(leftvbox), alignment, TRUE, TRUE, 0); vbox = gtk_vbox_new(FALSE, 5); - label = gtk_label_new("Active Color Channel:"); + label = gtk_label_new(_("Active Color Channel:")); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(alignment), vbox); @@ -311,19 +314,19 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, gdk_pixbuf_new_from_xpm_data(rgb_xpm), - 1, "All Channels", -1); + 1, _("All Channels"), -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, gdk_pixbuf_new_from_xpm_data(red_xpm), - 1, "Red", -1); + 1, _("Red"), -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, gdk_pixbuf_new_from_xpm_data(green_xpm), - 1, "Green", -1); + 1, _("Green"), -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, gdk_pixbuf_new_from_xpm_data(blue_xpm), - 1, "Blue", -1); + 1, _("Blue"), -1); combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); @@ -353,7 +356,7 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, (gpointer) ctk_color_correction); ctk_config_set_tooltip(ctk_config, ctk_color_correction->color_channel, - __active_color_help); + _(__active_color_help)); /* * Gamma curve: BOTTOM - LEFT * @@ -369,7 +372,7 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, gtk_container_add(GTK_CONTAINER(eventbox), curve); gtk_container_add(GTK_CONTAINER(alignment), eventbox); - ctk_config_set_tooltip(ctk_config, eventbox, __color_curve_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__color_curve_help)); ctk_color_correction->curve = curve; /* @@ -380,11 +383,11 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, */ hbox = gtk_hbox_new(FALSE, 0); - button = gtk_button_new_with_label("Reset Hardware Defaults"); + button = gtk_button_new_with_label(_("Reset Hardware Defaults")); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); confirm_button = gtk_button_new(); - confirm_label = gtk_label_new("Confirm Current Changes"); + confirm_label = gtk_label_new(_("Confirm Current Changes")); gtk_container_add(GTK_CONTAINER(confirm_button), confirm_label); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), confirm_button); @@ -401,8 +404,8 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, ctk_color_correction->confirm_label = confirm_label; ctk_color_correction->confirm_button = confirm_button; ctk_color_correction->reset_button = button; - ctk_config_set_tooltip(ctk_config, eventbox, __confirm_button_help); - ctk_config_set_tooltip(ctk_config, button, __resest_button_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__confirm_button_help)); + ctk_config_set_tooltip(ctk_config, button, _(__resest_button_help)); /* * Control sliders: MIDDLE - CENTER->RIGHT @@ -437,9 +440,9 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, widget = CTK_SCALE(scale)->gtk_scale; - ctk_config_set_tooltip(ctk_config, widget, "The Brightness slider alters " + ctk_config_set_tooltip(ctk_config, widget, _("The Brightness slider alters " "the amount of brightness for the selected color " - "channel(s)."); + "channel(s).")); /* contrast slider */ @@ -466,9 +469,9 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, widget = CTK_SCALE(scale)->gtk_scale; - ctk_config_set_tooltip(ctk_config, widget, "The Contrast slider alters " + ctk_config_set_tooltip(ctk_config, widget, _("The Contrast slider alters " "the amount of contrast for the selected color " - "channel(s)."); + "channel(s).")); /* gamma slider */ @@ -488,15 +491,15 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, scale = ctk_scale_new (GTK_ADJUSTMENT(ctk_color_correction->gamma_adjustment), - "Gamma", ctk_config, G_TYPE_DOUBLE); + _("Gamma"), ctk_config, G_TYPE_DOUBLE); gtk_box_pack_start(GTK_BOX(rightvbox), scale, TRUE, TRUE, 0); widget = CTK_SCALE(scale)->gtk_scale; - ctk_config_set_tooltip(ctk_config, widget, "The Gamma slider alters " + ctk_config_set_tooltip(ctk_config, widget, _("The Gamma slider alters " "the amount of gamma for the selected color " - "channel(s)."); + "channel(s).")); /* horizontal separator */ @@ -526,9 +529,9 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 10); gtk_container_add(GTK_CONTAINER(center_alignment), hbox); - label = gtk_label_new("Warning: The color settings have been changed " + label = gtk_label_new(_("Warning: The color settings have been changed " "outside of nvidia-settings so the current slider " - "values may be incorrect."); + "values may be incorrect.")); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, @@ -724,7 +727,7 @@ static void confirm_button_clicked( /* Reset confirm button text */ gtk_label_set_text(GTK_LABEL(ctk_color_correction->confirm_label), - "Confirm Current Changes"); + _("Confirm Current Changes")); gtk_widget_set_sensitive(ctk_color_correction->confirm_button, FALSE); } /* confirm_button_clicked() */ @@ -767,7 +770,7 @@ static void reset_button_clicked( } ctk_config_statusbar_message(ctk_color_correction->ctk_config, - "Reset color correction hardware defaults."); + _("Reset color correction hardware defaults.")); gtk_widget_set_sensitive(GTK_WIDGET(ctk_color_correction->confirm_button), FALSE); @@ -780,7 +783,7 @@ static void reset_button_clicked( /* Reset confirm button text */ gtk_label_set_text(GTK_LABEL(ctk_color_correction->confirm_label), - "Confirm Current Changes"); + _("Confirm Current Changes")); } static void adjustment_value_changed( @@ -859,7 +862,7 @@ static void adjustment_value_changed( flush_attribute_channel_values(ctk_color_correction, attribute, channel); ctk_config_statusbar_message(ctk_color_correction->ctk_config, - "Set %s%s to %f.", + _("Set %s%s to %f."), channel_str, attribute_str, value); gtk_widget_set_sensitive(ctk_color_correction->confirm_button, TRUE); } @@ -1079,7 +1082,9 @@ static void apply_parsed_attribute_list( static void update_confirm_text(CtkColorCorrection *ctk_color_correction) { gchar *str; - str = g_strdup_printf("%d Seconds to Confirm", + str = g_strdup_printf(ngettext("%d Second to Confirm", + "%d Seconds to Confirm", + ctk_color_correction->confirm_countdown), ctk_color_correction->confirm_countdown); gtk_label_set_text(GTK_LABEL(ctk_color_correction->confirm_label), str); @@ -1134,12 +1139,12 @@ static gboolean do_confirm_countdown(gpointer data) /* Reset confirm button text */ gtk_label_set_text(GTK_LABEL(ctk_color_correction->confirm_label), - "Confirm Current Changes"); + _("Confirm Current Changes")); /* Update status bar message */ ctk_config_statusbar_message(ctk_color_correction->ctk_config, - "Reverted color correction changes, due to " - "confirmation timeout."); + _("Reverted color correction changes, due to " + "confirmation timeout.")); ctk_color_correction->confirm_timer = 0; @@ -1153,18 +1158,18 @@ GtkTextBuffer *ctk_color_correction_create_help(GtkTextTagTable *table) { GtkTextIter i; GtkTextBuffer *b; - const gchar *title = "X Server Color Correction"; + const gchar *title = _("X Server Color Correction"); b = gtk_text_buffer_new(table); gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "%s Help", title); + ctk_help_title(b, &i, _("%s Help"), title); ctk_color_correction_tab_help(b, &i, title, FALSE /* randr */); - ctk_help_heading(b, &i, "Reset Hardware Defaults"); - ctk_help_para(b, &i, "%s", __resest_button_help); + ctk_help_heading(b, &i, _("Reset Hardware Defaults")); + ctk_help_para(b, &i, "%s", _(__resest_button_help)); ctk_help_finish(b); @@ -1176,13 +1181,13 @@ void ctk_color_correction_tab_help(GtkTextBuffer *b, GtkTextIter *i, const gchar *title, gboolean randr) { - ctk_help_heading(b, i, "Color Correction"); + ctk_help_heading(b, i, _("Color Correction")); - ctk_help_term(b, i, "Active Color Channel"); - ctk_help_para(b, i, "%s", __active_color_help); + ctk_help_term(b, i, _("Active Color Channel")); + ctk_help_para(b, i, "%s", _(__active_color_help)); - ctk_help_term(b, i, "Brightness, Contrast and Gamma"); - ctk_help_para(b, i, "The Brightness, Contrast and Gamma sliders " + ctk_help_term(b, i, _("Brightness, Contrast and Gamma")); + ctk_help_para(b, i, _("The Brightness, Contrast and Gamma sliders " "allow you to adjust the brightness, contrast, " "or gamma values for the selected color channel(s). This " "helps you to compensate " @@ -1191,25 +1196,25 @@ void ctk_color_correction_tab_help(GtkTextBuffer *b, GtkTextIter *i, "working with image processing applications to help " "provide more accurate color reproduction of images (such " "as photographs) when they are displayed on your " - "monitor."); + "monitor.")); - ctk_help_para(b, i, "Also, many 3D-accelerated games may appear too " + ctk_help_para(b, i, _("Also, many 3D-accelerated games may appear too " "dark to play. Increasing the brightness and/or gamma " "value equally across all channels will make these games " - "appear brighter, making them more playable."); + "appear brighter, making them more playable.")); - ctk_help_para(b, i, "%s", __color_curve_help); + ctk_help_para(b, i, "%s", _(__color_curve_help)); if (randr) { - ctk_help_para(b, i, "The %s tab uses the RandR extension to " - "manipulate an RandR CRTC's gamma ramp.", title); + ctk_help_para(b, i, _("The %s tab uses the RandR extension to " + "manipulate an RandR CRTC's gamma ramp."), title); } else { - ctk_help_para(b, i, "The %s page uses the XF86VidMode extension " - "to manipulate the X screen's gamma ramps", title); + ctk_help_para(b, i, _("The %s page uses the XF86VidMode extension " + "to manipulate the X screen's gamma ramps"), title); } - ctk_help_term(b, i, "Confirm Current Changes"); - ctk_help_para(b, i, "%s", __confirm_button_help); + ctk_help_term(b, i, _("Confirm Current Changes")); + ctk_help_para(b, i, "%s", _(__confirm_button_help)); } diff --git a/src/gtk+-2.x/ctkconfig.c b/src/gtk+-2.x/ctkconfig.c index e5ca3e41..b020bc7f 100644 --- a/src/gtk+-2.x/ctkconfig.c +++ b/src/gtk+-2.x/ctkconfig.c @@ -33,22 +33,26 @@ #include #include #include +#include + +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING static const char *__status_bar_help = -"The status bar in the bottom " +N_("The status bar in the bottom " "left of the nvidia-settings GUI displays the most " "recent change that has been sent to the X " "server. The 'Display Status Bar' check box " -"controls whether this status bar is displayed."; +"controls whether this status bar is displayed."); static const char *__slider_text_entries_help = -"When the \"Slider Text Entries\" option is enabled, the current " +N_("When the \"Slider Text Entries\" option is enabled, the current " "value of an attribute controlled by a slider is " "displayed and can be modified with a text entry " -"shown next to the slider."; +"shown next to the slider."); static const char *__x_display_names_help = -"When the current settings are saved to the " +N_("When the current settings are saved to the " "configuration file, the attributes can either be " "qualified with just the screen to which the attribute " "should be applied, or the attribute can be qualified with " @@ -56,23 +60,23 @@ static const char *__x_display_names_help = "use the same configuration file across multiple " "computers, be sure to leave this option unchecked. " "It is normally recommended to leave this option " -"unchecked."; +"unchecked."); static const char *__show_quit_dialog_help = -"When this option is enabled, nvidia-settings will ask if you " -"really want to quit when the quit button is pressed."; +N_("When this option is enabled, nvidia-settings will ask if you " +"really want to quit when the quit button is pressed."); static const char *__save_current_config_help = -"When nvidia-settings exits, it saves the current X server " +N_("When nvidia-settings exits, it saves the current X server " "configuration to a configuration file (\"~/.nvidia-settings-rc\", " "by default). Use this button to save the current X server " -"configuration immediately, optionally to a different file."; +"configuration immediately, optionally to a different file."); static const char *__update_rules_on_profile_name_change_help = -"If this option is enabled, changing the name of a profile in the " +N_("If this option is enabled, changing the name of a profile in the " "Application Profile page of nvidia-settings will cause any rules " "that refer to that profile to also be updated to refer to the new " -"profile name."; +"profile name."); static void ctk_config_class_init(CtkConfigClass *ctk_config_class); @@ -167,34 +171,34 @@ GtkWidget* ctk_config_new(ConfigProperties *conf, CtrlSystem *pCtrlSystem) } config_check_button_entries[] = { { - "Display Status Bar", + _("Display Status Bar"), CONFIG_PROPERTIES_DISPLAY_STATUS_BAR, G_CALLBACK(display_status_bar_toggled), - __status_bar_help + _(__status_bar_help) }, { - "Slider Text Entries", + _("Slider Text Entries"), CONFIG_PROPERTIES_SLIDER_TEXT_ENTRIES, G_CALLBACK(slider_text_entries_toggled), - __slider_text_entries_help + _(__slider_text_entries_help) }, { - "Include X Display Names in the Config File", + _("Include X Display Names in the Config File"), CONFIG_PROPERTIES_INCLUDE_DISPLAY_NAME_IN_CONFIG_FILE, G_CALLBACK(display_name_toggled), - __x_display_names_help + _(__x_display_names_help) }, { - "Show \"Really Quit?\" Dialog", + _("Show \"Really Quit?\" Dialog"), CONFIG_PROPERTIES_SHOW_QUIT_DIALOG, G_CALLBACK(show_quit_dialog_toggled), - __show_quit_dialog_help + _(__show_quit_dialog_help) }, { - "Update Rules when an Application Profile Name changes", + _("Update Rules when an Application Profile Name changes"), CONFIG_PROPERTIES_UPDATE_RULES_ON_PROFILE_NAME_CHANGE, G_CALLBACK(update_rules_on_profile_name_change_toggled), - __update_rules_on_profile_name_change_help + _(__update_rules_on_profile_name_change_help) }, }; @@ -228,7 +232,7 @@ GtkWidget* ctk_config_new(ConfigProperties *conf, CtrlSystem *pCtrlSystem) hbox = gtk_hbox_new (FALSE, 5); gtk_box_pack_start(GTK_BOX(ctk_config), hbox, FALSE, FALSE, 0); - label = gtk_label_new("nvidia-settings Configuration"); + label = gtk_label_new(_("nvidia-settings Configuration")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -278,7 +282,7 @@ GtkWidget* ctk_config_new(ConfigProperties *conf, CtrlSystem *pCtrlSystem) /* "Save Current Configuration" button */ - label = gtk_label_new("Save Current Configuration"); + label = gtk_label_new(_("Save Current Configuration")); hbox = gtk_hbox_new(FALSE, 0); ctk_config->button_save_rc = gtk_button_new(); alignment = gtk_alignment_new(1, 1, 0, 0); @@ -294,7 +298,7 @@ GtkWidget* ctk_config_new(ConfigProperties *conf, CtrlSystem *pCtrlSystem) (gpointer) ctk_config); ctk_config_set_tooltip(ctk_config, ctk_config->button_save_rc, - __save_current_config_help); + _(__save_current_config_help)); ctk_config->rc_filename = NULL; @@ -316,7 +320,7 @@ static void save_rc_clicked(GtkWidget *widget, gpointer user_data) CTK_WINDOW(ctk_get_parent_window(GTK_WIDGET(ctk_config))); filename = - ctk_get_filename_from_dialog("Please select a file to save to.", + ctk_get_filename_from_dialog(_("Please select a file to save to."), GTK_WINDOW(ctk_window), ctk_config->rc_filename ? ctk_config->rc_filename : @@ -423,7 +427,7 @@ static void display_status_bar_toggled( if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { gtk_widget_show(ctk_config->status_bar.widget); ctk_config->conf->booleans |= CONFIG_PROPERTIES_DISPLAY_STATUS_BAR; - ctk_config_statusbar_message(ctk_config, "Status bar enabled."); + ctk_config_statusbar_message(ctk_config, _("Status bar enabled.")); } else { gtk_widget_hide(ctk_config->status_bar.widget); @@ -451,8 +455,7 @@ static void slider_text_entries_toggled(GtkWidget *widget, gpointer user_data) } ctk_config_statusbar_message(ctk_config, - "Slider text entries %s.", - active ? "enabled" : "disabled"); + active ? _("Slider text entries enabled.") : _("Slider text entries disabled.")); g_signal_emit(ctk_config, signals[0], 0); } @@ -471,8 +474,7 @@ static void display_name_toggled(GtkWidget *widget, gpointer user_data) } ctk_config_statusbar_message(ctk_config, - "Including X Display Names in Config File %s.", - active ? "enabled" : "disabled"); + active ? _("Including X Display Names in Config File enabled.") : _("Including X Display Names in Config File disabled.")); } static void show_quit_dialog_toggled(GtkWidget *widget, gpointer user_data) @@ -487,8 +489,7 @@ static void show_quit_dialog_toggled(GtkWidget *widget, gpointer user_data) } ctk_config_statusbar_message(ctk_config, - "Quit confirmation dialog %s.", - active ? "enabled" : "disabled"); + active ? _("Quit confirmation dialog enabled.") : _("Quit confirmation dialog disabled.")); } static void update_rules_on_profile_name_change_toggled(GtkWidget *widget, @@ -506,9 +507,9 @@ static void update_rules_on_profile_name_change_toggled(GtkWidget *widget, } ctk_config_statusbar_message(ctk_config, - "Updating rules when an application profile " - "name changes is %s.", - active ? "enabled" : "disabled"); + active ? + _("Updating rules when an application profile name changes is enabled.") : + _("Updating rules when an application profile name changes is disabled.")); } @@ -527,12 +528,12 @@ GtkTextBuffer *ctk_config_create_help(CtkConfig *ctk_config, GtkTextTagTable *ta gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "nvidia-settings Configuration Help"); + ctk_help_title(b, &i, _("nvidia-settings Configuration Help")); ctk_help_data_list_print_sections(b, &i, ctk_config->help_data); - ctk_help_heading(b, &i, "Active Timers"); - ctk_help_para(b, &i, "Some attributes are polled periodically " + ctk_help_heading(b, &i, _("Active Timers")); + ctk_help_para(b, &i, _("Some attributes are polled periodically " "to ensure the reported values are up-to-date. " "Each row in the 'Active Timers' table reflects " "the configuration of one of these timers and " @@ -542,10 +543,10 @@ GtkTextBuffer *ctk_config_create_help(CtkConfig *ctk_config, GtkTextTagTable *ta "field allows enabling/disabling it, the 'Time " "Interval' field controls the delay between two " "consecutive polls (in milliseconds). The Active " - "Timers table is only visible when timers are active."); + "Timers table is only visible when timers are active.")); - ctk_help_heading(b, &i, "Save Current Configuration"); - ctk_help_para(b, &i, "%s", __save_current_config_help); + ctk_help_heading(b, &i, _("Save Current Configuration")); + ctk_help_para(b, &i, "%s", _(__save_current_config_help)); ctk_help_finish(b); @@ -621,7 +622,7 @@ static GtkWidget *create_timer_list(CtkConfig *ctk_config) renderer = gtk_cell_renderer_toggle_new(); g_signal_connect(renderer, "toggled", G_CALLBACK(timer_enable_toggled), ctk_config); - column = gtk_tree_view_column_new_with_attributes("Enabled", renderer, + column = gtk_tree_view_column_new_with_attributes(_("Enabled"), renderer, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); @@ -637,7 +638,7 @@ static GtkWidget *create_timer_list(CtkConfig *ctk_config) /* Description */ renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Description", + column = gtk_tree_view_column_new_with_attributes(_("Description"), renderer, NULL); @@ -654,7 +655,7 @@ static GtkWidget *create_timer_list(CtkConfig *ctk_config) /* Time interval */ renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Time Interval", + column = gtk_tree_view_column_new_with_attributes(_("Time Interval"), renderer, NULL); @@ -676,7 +677,7 @@ static GtkWidget *create_timer_list(CtkConfig *ctk_config) vbox = gtk_vbox_new(FALSE, 5); - label = gtk_label_new("Active Timers:"); + label = gtk_label_new(_("Active Timers:")); alignment = gtk_alignment_new(0.0, 0.0, 0, 0); gtk_container_add(GTK_CONTAINER(alignment), label); gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0); @@ -685,9 +686,9 @@ static GtkWidget *create_timer_list(CtkConfig *ctk_config) /* create the tooltip for the treeview (can't do it per column) */ ctk_config_set_tooltip(ctk_config, treeview, - "The Active Timers describe operations that " + _("The Active Timers describe operations that " "nvidia-settings will perform at regular " - "intervals."); + "intervals.")); return vbox; @@ -854,10 +855,9 @@ static void timer_enable_toggled(GtkCellRendererToggle *cell, } } - ctk_config_statusbar_message(ctk_config, "Timer \"%s\" %s.", - timer_config->description, - timer_config->user_enabled ? - "enabled" : "disabled"); + ctk_config_statusbar_message(ctk_config, timer_config->user_enabled ? + _("Timer \"%s\" enabled.") : + _("Timer \"%s\" disabled."), timer_config->description); } void ctk_config_add_timer(CtkConfig *ctk_config, diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.c b/src/gtk+-2.x/ctkdisplayconfig-utils.c index eed91540..7d3458bd 100644 --- a/src/gtk+-2.x/ctkdisplayconfig-utils.c +++ b/src/gtk+-2.x/ctkdisplayconfig-utils.c @@ -21,6 +21,7 @@ #include /* strlen, strdup */ #include /* lseek, close */ #include +#include #include #include @@ -39,6 +40,7 @@ #include "ctkutils.h" #include "ctkgpu.h" +#define _(STRING) gettext(STRING) static void xconfig_update_buffer(GtkWidget *widget, gpointer user_data); static gchar *display_pick_config_name(nvDisplayPtr display, @@ -4214,16 +4216,16 @@ static int save_xconfig_file(SaveXConfDlg *dlg, /* Verify the file-write permission */ if ((access(filename, W_OK) != 0)) { err_msg = - g_strdup_printf("You do not have adequate permission to" - " open the existing X configuration file '%s' for writing.", + g_strdup_printf(_("You do not have adequate permission to" + " open the existing X configuration file '%s' for writing."), filename); /* Verify the user permissions */ if (stat(filename, &st) == 0) { if ((getuid() != 0) && (st.st_uid == 0) && !(st.st_mode & (S_IWGRP | S_IWOTH))) - err_msg = g_strconcat(err_msg, " You must be 'root'" - " to modify the file.", NULL); + err_msg = g_strconcat(err_msg, _(" You must be 'root'" + " to modify the file."), NULL); } goto done; } @@ -4238,8 +4240,8 @@ static int save_xconfig_file(SaveXConfDlg *dlg, if (unlink(backup_filename) != 0) { err_msg = - g_strdup_printf("Unable to remove old X config backup " - "file '%s'.", + g_strdup_printf(_("Unable to remove old X config backup " + "file '%s'."), backup_filename); goto done; } @@ -4248,8 +4250,8 @@ static int save_xconfig_file(SaveXConfDlg *dlg, /* Make the current x config file the backup */ if (rename(filename, backup_filename)) { err_msg = - g_strdup_printf("Unable to create new X config backup " - "file '%s'.", + g_strdup_printf(_("Unable to create new X config backup " + "file '%s'."), backup_filename); goto done; } @@ -4259,7 +4261,7 @@ static int save_xconfig_file(SaveXConfDlg *dlg, fp = fopen(filename, "w"); if (!fp) { err_msg = - g_strdup_printf("Unable to open X config file '%s' for writing.", + g_strdup_printf(_("Unable to open X config file '%s' for writing."), filename); goto done; } @@ -4365,8 +4367,8 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg) /* Make sure this is a regular file */ if (non_regular_file_type_description) { - err_msg = g_strdup_printf("Invalid file '%s': File exits but is a " - "%s!", + err_msg = g_strdup_printf(_("Invalid file '%s': File exits but is a " + "%s!"), filename, non_regular_file_type_description); gtk_widget_set_sensitive(dlg->btn_xconfig_merge, FALSE); @@ -4391,8 +4393,8 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg) /* If we failed to parse the config file, we should not * allow a merge. */ - err_msg = g_strdup_printf("Failed to parse existing X " - "config file '%s'!", + err_msg = g_strdup_printf(_("Failed to parse existing X " + "config file '%s'!"), filename); ctk_display_warning_msg (ctk_get_parent_window(GTK_WIDGET(dlg->parent)), err_msg); @@ -4406,8 +4408,8 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg) xconfigGetXServerInUse(&gop); if (!xconfigSanitizeConfig(xconfCur, NULL, &gop)) { - err_msg = g_strdup_printf("Failed to sanitize existing X " - "config file '%s'!", + err_msg = g_strdup_printf(_("Failed to sanitize existing X " + "config file '%s'!"), filename); ctk_display_warning_msg (ctk_get_parent_window(GTK_WIDGET(dlg->parent)), @@ -4443,7 +4445,7 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg) xconfGen = dlg->xconf_gen_func(xconfCur, merge, &merged, dlg->callback_data); if (!xconfGen) { - err_msg = g_strdup_printf("Failed to generate X config file!"); + err_msg = g_strdup_printf(_("Failed to generate X config file!")); goto fail; } @@ -4483,8 +4485,8 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg) tmp_filename = g_strdup_printf("/tmp/.xconfig.tmp.XXXXXX"); tmp_fd = mkstemp(tmp_filename); if (!tmp_fd) { - err_msg = g_strdup_printf("Failed to create temp X config file '%s' " - "for preview.", + err_msg = g_strdup_printf(_("Failed to create temp X config file '%s' " + "for preview."), tmp_filename); goto fail; } @@ -4492,21 +4494,21 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg) xconfigFreeConfig(&xconfGen); if (lseek(tmp_fd, 0, SEEK_SET) == (off_t)-1) { - err_msg = g_strdup_printf("Failed lseek() on temp X config file '%s' " - "for preview.", + err_msg = g_strdup_printf(_("Failed lseek() on temp X config file '%s' " + "for preview."), tmp_filename); goto fail; } if (fstat(tmp_fd, &st) == -1) { - err_msg = g_strdup_printf("Failed fstat() on temp X config file '%s' " - "for preview.", + err_msg = g_strdup_printf(_("Failed fstat() on temp X config file '%s' " + "for preview."), tmp_filename); goto fail; } buf = mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, tmp_fd, 0); if (buf == MAP_FAILED) { - err_msg = g_strdup_printf("Failed mmap() on temp X config file '%s' " - "for preview.", + err_msg = g_strdup_printf(_("Failed mmap() on temp X config file '%s' " + "for preview."), tmp_filename); goto fail; } @@ -4579,12 +4581,12 @@ static void xconfig_preview_clicked(GtkWidget *widget, gpointer user_data) TRUE); gtk_widget_set_size_request(dlg->txt_xconfig_save, 450, 350); gtk_button_set_label(GTK_BUTTON(dlg->btn_xconfig_preview), - "Hide Preview..."); + _("Hide Preview...")); } else { gtk_widget_hide(dlg->box_xconfig_save); gtk_window_set_resizable(GTK_WINDOW(dlg->dlg_xconfig_save), FALSE); gtk_button_set_label(GTK_BUTTON(dlg->btn_xconfig_preview), - "Show Preview..."); + _("Show Preview...")); } } /* xconfig_preview_clicked() */ @@ -4623,7 +4625,7 @@ static void xconfig_file_clicked(GtkWidget *widget, gpointer user_data) /* Ask user for a filename */ selected_filename = - ctk_get_filename_from_dialog("Please select the X configuration file", + ctk_get_filename_from_dialog(_("Please select the X configuration file"), GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(dlg->parent))), filename); @@ -4673,7 +4675,7 @@ void run_save_xconfig_dialog(SaveXConfDlg *dlg) gtk_window_set_resizable(GTK_WINDOW(dlg->dlg_xconfig_save), FALSE); gtk_button_set_label(GTK_BUTTON(dlg->btn_xconfig_preview), - "Show preview..."); + _("Show preview...")); gtk_widget_show(dlg->dlg_xconfig_save); result = gtk_dialog_run(GTK_DIALOG(dlg->dlg_xconfig_save)); gtk_widget_hide(dlg->dlg_xconfig_save); @@ -4777,7 +4779,7 @@ SaveXConfDlg *create_save_xconfig_dialog(GtkWidget *parent, /* Create the dialog */ dlg->dlg_xconfig_save = gtk_dialog_new_with_buttons - ("Save X Configuration", + (_("Save X Configuration"), GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(parent))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_SAVE, @@ -4817,14 +4819,14 @@ SaveXConfDlg *create_save_xconfig_dialog(GtkWidget *parent, (gpointer) dlg); /* Create the filename browse button */ - dlg->btn_xconfig_file = gtk_button_new_with_label("Browse..."); + dlg->btn_xconfig_file = gtk_button_new_with_label(_("Browse...")); g_signal_connect(G_OBJECT(dlg->btn_xconfig_file), "clicked", G_CALLBACK(xconfig_file_clicked), (gpointer) dlg); /* Create the merge checkbox */ dlg->btn_xconfig_merge = - gtk_check_button_new_with_label("Merge with existing file."); + gtk_check_button_new_with_label(_("Merge with existing file.")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->btn_xconfig_merge), TRUE); gtk_widget_set_sensitive(dlg->btn_xconfig_merge, merge_toggleable); diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c index 571574bf..2cd4891c 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.c +++ b/src/gtk+-2.x/ctkdisplayconfig.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,8 @@ #include "ctkdisplaylayout.h" #include "ctkdisplayconfig-utils.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING void layout_selected_callback(nvLayoutPtr layout, void *data); void layout_modified_callback(nvLayoutPtr layout, void *data); @@ -174,189 +177,189 @@ static int __position_table[] = { CONF_ADJ_ABSOLUTE, /* Layout tooltips */ static const char * __layout_hidden_label_help = -"To select a display, use the \"Selection\" dropdown menu."; +N_("To select a display, use the \"Selection\" dropdown menu."); static const char * __layout_xinerama_button_help = -"The Enable Xinerama checkbox enables the Xinerama X extension; changing " +N_("The Enable Xinerama checkbox enables the Xinerama X extension; changing " "this option will require restarting your X server. Note that when Xinerama " -"is enabled, resolution changes will also require restarting your X server."; +"is enabled, resolution changes will also require restarting your X server."); static const char * __selected_item_help = -"The Selection drop-down allows you to pick which X screen or display device " -"to configure."; +N_("The Selection drop-down allows you to pick which X screen or display device " +"to configure."); /* Display tooltips */ static const char * __dpy_configuration_mnu_help = -"The Configure drop-down allows you to select the desired configuration " -"for the currently selected display device."; +N_("The Configure drop-down allows you to select the desired configuration " +"for the currently selected display device."); static const char * __layout_sli_mosaic_button_help = -"The Enable SLI Mosaic checkbox enables SLI Mosaic for all GPUs"; +N_("The Enable SLI Mosaic checkbox enables SLI Mosaic for all GPUs"); static const char * __layout_base_mosaic_surround_button_help = -"The Enable Base Mosaic (Surround) checkbox enables Surround, where up to 3 " -"displays are supported."; +N_("The Enable Base Mosaic (Surround) checkbox enables Surround, where up to 3 " +"displays are supported."); static const char * __layout_base_mosaic_full_button_help = -"The Enable Base Mosaic checkbox enables Base Mosaic."; +N_("The Enable Base Mosaic checkbox enables Base Mosaic."); static const char * __dpy_resolution_mnu_help = -"The Resolution drop-down allows you to select a desired resolution " +N_("The Resolution drop-down allows you to select a desired resolution " "for the currently selected display device. The 'scaled' qualifier indicates " "an aspect-scaled common resolution simulated through a MetaMode ViewPort " -"configuration."; +"configuration."); static const char * __dpy_refresh_mnu_help = -"The Refresh drop-down allows you to select a desired refresh rate " +N_("The Refresh drop-down allows you to select a desired refresh rate " "for the currently selected display device. Note that the selected " -"resolution may restrict the available refresh rates."; +"resolution may restrict the available refresh rates."); static const char * __dpy_stereo_help = -"The Display Passive Stereo Eye drop-down allows you to select a desired " +N_("The Display Passive Stereo Eye drop-down allows you to select a desired " "stereo eye the display should output when Passive Stereo (Mode 4) is " -"enabled."; +"enabled."); static const char * __dpy_rotation_help = -"The Display Rotation drop-down allows you to select the desired orientation " -"for the display."; +N_("The Display Rotation drop-down allows you to select the desired orientation " +"for the display."); static const char * __dpy_reflection_help = -"The Display Reflection drop-down allows you to choose the axes across which " -"monitor contents should be reflected."; +N_("The Display Reflection drop-down allows you to choose the axes across which " +"monitor contents should be reflected."); static const char * __dpy_viewport_in_help = -"This defines the width and height in pixels of the region that should be " -"displayed from the desktop."; +N_("This defines the width and height in pixels of the region that should be " +"displayed from the desktop."); static const char * __dpy_viewport_out_help = -"This defines the width, height, and offset of the output region in raster " +N_("This defines the width, height, and offset of the output region in raster " "space, into which the ViewPortIn is to be displayed (along with any " -"transform, such as rotation, reflection, etc.)"; +"transform, such as rotation, reflection, etc.)"); static const char * __dpy_position_type_help = -"The Position Type drop-down allows you to set how the selected display " +N_("The Position Type drop-down allows you to set how the selected display " "device is placed within the X screen. This is only available when " -"multiple display devices are present."; +"multiple display devices are present."); static const char * __dpy_position_relative_help = -"The Position Relative drop-down allows you to set which other display " +N_("The Position Relative drop-down allows you to set which other display " "device (within the X screen) the selected display device should be " "relative to. This is only available when multiple display " -"devices are present."; +"devices are present."); static const char * __dpy_underscan_text_help = -"The Underscan feature allows configuration of an underscan border " -"(in pixels) around the ViewPortOut."; +N_("The Underscan feature allows configuration of an underscan border " +"(in pixels) around the ViewPortOut."); static const char * __dpy_position_offset_help = -"The Position Offset identifies the top left of the display device " +N_("The Position Offset identifies the top left of the display device " "as an offset from the top left of the X screen position. This is only " -"available when multiple display devices are present."; +"available when multiple display devices are present."); static const char * __dpy_panning_help = -"The Panning Domain sets the total width/height that the display " -"device may pan within."; +N_("The Panning Domain sets the total width/height that the display " +"device may pan within."); static const char * __dpy_primary_help = -"The primary display is often used by window managers to know which of the " +N_("The primary display is often used by window managers to know which of the " "displays in a multi-display setup to show information and other " "important windows etc; changing this option may require restarting your X " -"server, depending on your window manager."; +"server, depending on your window manager."); static const char * __dpy_forcecompositionpipeline_help = -"The NVIDIA X driver can use a composition pipeline to apply X screen " +N_("The NVIDIA X driver can use a composition pipeline to apply X screen " "transformations and rotations. \"ForceCompositionPipeline\" can be used to " "force the use of this pipeline, even when no transformations or rotations are " "applied to the screen. This option is implicitly set by " -"ForceFullCompositionPipeline."; +"ForceFullCompositionPipeline."); static const char * __dpy_forcefullcompositionpipeline_help = -"This option implicitly enables \"ForceCompositionPipeline\" and additionally " -"makes use of the composition pipeline to apply ViewPortOut scaling."; +N_("This option implicitly enables \"ForceCompositionPipeline\" and additionally " +"makes use of the composition pipeline to apply ViewPortOut scaling."); /* Screen tooltips */ static const char * __screen_virtual_size_help = -"The Virtual Size allows setting the size of the resulting X screen. " +N_("The Virtual Size allows setting the size of the resulting X screen. " "The virtual size must be at least large enough to hold all the display " -"devices that are currently enabled for scanout."; +"devices that are currently enabled for scanout."); static const char * __screen_depth_help = -"The Depth drop-down allows setting of the color quality for the selected " -"screen; changing this option will require restarting your X server."; +N_("The Depth drop-down allows setting of the color quality for the selected " +"screen; changing this option will require restarting your X server."); static const char * __screen_stereo_help = -"The Stereo Mode drop-down allows setting of the stereo mode for the selected " -"screen; changing this option will require restarting your X server."; +N_("The Stereo Mode drop-down allows setting of the stereo mode for the selected " +"screen; changing this option will require restarting your X server."); static const char * __screen_position_type_help = -"The Position Type drop-down appears when two or more X screens are active. " +N_("The Position Type drop-down appears when two or more X screens are active. " "This allows you to set how the selected screen " "is placed within the X server layout; changing this option will require " -"restarting your X server."; +"restarting your X server."); static const char * __screen_position_relative_help = -"The Position Relative drop-down appears when two or more X screens " +N_("The Position Relative drop-down appears when two or more X screens " "are active. This allows you to set which other Screen " "the selected screen should be relative to; changing this option will " -"require restarting your X server."; +"require restarting your X server."); static const char * __screen_position_offset_help = -"The Position Offset drop-down appears when two or more X screens " +N_("The Position Offset drop-down appears when two or more X screens " "are active. This identifies the top left of the selected Screen as " "an offset from the top left of the X server layout in absolute coordinates; " -"changing this option will require restarting your X server."; +"changing this option will require restarting your X server."); static const char * __screen_metamode_help = -"The MetaMode selection menu allows you to set the currently displayed " +N_("The MetaMode selection menu allows you to set the currently displayed " "MetaMode for the selected screen; This option can be applied to " -"your currently running X server."; +"your currently running X server."); static const char * __screen_metamode_add_button_help = -"The Add MetaMode button allows you to create a new MetaMode for the " +N_("The Add MetaMode button allows you to create a new MetaMode for the " "selected screen; This option can be applied to your currently " -"running X server."; +"running X server."); static const char * __screen_metamode_delete_button_help = -"The Delete MetaMode button allows you to delete the currently selected " +N_("The Delete MetaMode button allows you to delete the currently selected " "MetaMode for the screen; This option can be applied to your currently " -"running X server."; +"running X server."); /* Prime Display tooltips */ static const char *__prime_viewport_help = -"This shows the width, height, and offset in pixels of the region that " -"should be displayed from the desktop."; +N_("This shows the width, height, and offset in pixels of the region that " +"should be displayed from the desktop."); static const char *__prime_name_help = -"This is the name of the display."; +N_("This is the name of the display."); static const char *__prime_sync_help = -"This shows the status of synchronization for the PRIME display. Without " +N_("This shows the status of synchronization for the PRIME display. Without " "synchronization, applications will not be able to sync to the display's " -"vblank."; +"vblank."); /* General button tooltips */ static const char * __apply_button_help = -"The Apply button allows you to apply changes made to the server layout."; +N_("The Apply button allows you to apply changes made to the server layout."); static const char * __detect_displays_button_help = -"The Detect Displays button allows you to probe for new display devices " -"that may have been hotplugged."; +N_("The Detect Displays button allows you to probe for new display devices " +"that may have been hotplugged."); static const char * __advanced_button_help = -"The Advanced/Basic button toggles between a basic view, and an advanced view " -"with extra configuration options."; +N_("The Advanced/Basic button toggles between a basic view, and an advanced view " +"with extra configuration options."); static const char * __reset_button_help = -"The Reset button will re-probe the X server for current configuration. Any " -"alterations you may have made (and not applied) will be lost."; +N_("The Reset button will re-probe the X server for current configuration. Any " +"alterations you may have made (and not applied) will be lost."); static const char * __save_button_help = -"The Save to X Configuration File button allows you to save the current " -"X server configuration settings to an X configuration file."; +N_("The Save to X Configuration File button allows you to save the current " +"X server configuration settings to an X configuration file."); @@ -752,7 +755,7 @@ static int generate_xconf_metamode_str(CtkDisplayConfig *ctk_object, gint result; msg = g_strdup_printf - ("Truncate the MetaMode list?\n" + (_("Truncate the MetaMode list?\n" "\n" "Long MetaMode strings (greater than 900 characters) are not\n" "supported by the current X server. Truncating the MetaMode\n" @@ -762,7 +765,7 @@ static int generate_xconf_metamode_str(CtkDisplayConfig *ctk_object, "\n" "NOTE: Writing all the MetaModes to the X Configuration\n" "file may result in parse errors and failing to start the\n" - "X server.", + "X server."), metamode_idx); parent = ctk_get_parent_window(GTK_WIDGET(ctk_object)); @@ -780,10 +783,10 @@ static int generate_xconf_metamode_str(CtkDisplayConfig *ctk_object, "%s", msg); gtk_dialog_add_buttons(GTK_DIALOG(dlg), - "Truncate MetaModes", + _("Truncate MetaModes"), GTK_RESPONSE_YES, - "Write all MetaModes", GTK_RESPONSE_NO, - "Cancel", GTK_RESPONSE_CANCEL, + _("Write all MetaModes"), GTK_RESPONSE_NO, + _("Cancel"), GTK_RESPONSE_CANCEL, NULL); result = gtk_dialog_run(GTK_DIALOG(dlg)); @@ -954,7 +957,7 @@ static GtkWidget * create_validation_dialog(CtkDisplayConfig *ctk_object) /* Display validation override confirmation dialog */ dialog = gtk_dialog_new_with_buttons - ("Layout Inconsistencie(s)", + (_("Layout Inconsistencie(s)"), GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(ctk_object))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, NULL); @@ -974,7 +977,7 @@ static GtkWidget * create_validation_dialog(CtkDisplayConfig *ctk_object) gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); /* Pack the main message */ - label = gtk_label_new("The current layout has some inconsistencies."); + label = gtk_label_new(_("The current layout has some inconsistencies.")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.0f); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); @@ -1014,10 +1017,10 @@ static GtkWidget * create_validation_dialog(CtkDisplayConfig *ctk_object) ctk_object->box_validation_override_details = hbox; /* Action Buttons */ - gtk_dialog_add_button(GTK_DIALOG(dialog), "Auto Fix", GTK_RESPONSE_APPLY); - gtk_dialog_add_button(GTK_DIALOG(dialog), "Ignore", GTK_RESPONSE_ACCEPT); + gtk_dialog_add_button(GTK_DIALOG(dialog), _("Auto Fix"), GTK_RESPONSE_APPLY); + gtk_dialog_add_button(GTK_DIALOG(dialog), _("Ignore"), GTK_RESPONSE_ACCEPT); /* Keep track of the cancel button so we can set focus on it */ - button = gtk_dialog_add_button(GTK_DIALOG(dialog), "Cancel", + button = gtk_dialog_add_button(GTK_DIALOG(dialog), _("Cancel"), GTK_RESPONSE_REJECT); ctk_object->btn_validation_override_cancel = button; @@ -1053,7 +1056,7 @@ static GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) /* Display validation override confirmation dialog */ dialog = gtk_dialog_new_with_buttons - ("Cannot Apply", + (_("Cannot Apply"), GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(ctk_object))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -1076,7 +1079,7 @@ static GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); /* Pack the main message */ - str = g_strdup_printf("The current settings cannot be completely applied\n" + str = g_strdup_printf(_("The current settings cannot be completely applied\n" "due to one or more of the following reasons:\n" "\n" "%s The location of an X screen has changed.\n" @@ -1087,7 +1090,7 @@ static GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) "\n" "For all the requested settings to take effect,\n" "you must save the configuration to the X config\n" - "file and restart the X server.", + "file and restart the X server."), bullet, bullet, bullet, bullet, bullet); label = gtk_label_new(str); g_free(str); @@ -1095,9 +1098,9 @@ static GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); /* Action Buttons */ - gtk_dialog_add_button(GTK_DIALOG(dialog), "Apply What Is Possible", + gtk_dialog_add_button(GTK_DIALOG(dialog), _("Apply What Is Possible"), GTK_RESPONSE_ACCEPT); - gtk_dialog_add_button(GTK_DIALOG(dialog), "Cancel", GTK_RESPONSE_REJECT); + gtk_dialog_add_button(GTK_DIALOG(dialog), _("Cancel"), GTK_RESPONSE_REJECT); gtk_widget_show_all(ctk_dialog_get_content_area(GTK_DIALOG(dialog))); @@ -1373,11 +1376,11 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, gchar *str; if (!err_str) { - str = g_strdup("Unable to load X Server Display " - "Configuration page."); + str = g_strdup(_("Unable to load X Server Display " + "Configuration page.")); } else { - str = g_strdup_printf("Unable to load X Server Display " - "Configuration page:\n\n%s", err_str); + str = g_strdup_printf(_("Unable to load X Server Display " + "Configuration page:\n\n%s"), err_str); g_free(err_str); } @@ -1419,10 +1422,12 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Create label to replace layout widget */ eventbox = gtk_event_box_new(); - layout_str = g_strdup_printf("(hidden because screen height is less than %d pixels)", MIN_LAYOUT_SCREENSIZE); + layout_str = g_strdup_printf(ngettext("(hidden because screen height is less than %d pixel)", + "(hidden because screen height is less than %d pixels)", + MIN_LAYOUT_SCREENSIZE), MIN_LAYOUT_SCREENSIZE); ctk_object->label_layout = gtk_label_new(layout_str); gtk_container_add(GTK_CONTAINER(eventbox), ctk_object->label_layout); - ctk_config_set_tooltip(ctk_config, eventbox, __layout_hidden_label_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__layout_hidden_label_help)); g_free(layout_str); screen = gtk_widget_get_screen(GTK_WIDGET(ctk_object)); g_signal_connect(G_OBJECT(screen), "size-changed", @@ -1438,9 +1443,9 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Xinerama button */ ctk_object->chk_xinerama_enabled = - gtk_check_button_new_with_label("Enable Xinerama"); + gtk_check_button_new_with_label(_("Enable Xinerama")); ctk_config_set_tooltip(ctk_config, ctk_object->chk_xinerama_enabled, - __layout_xinerama_button_help); + _(__layout_xinerama_button_help)); g_signal_connect(G_OBJECT(ctk_object->chk_xinerama_enabled), "toggled", G_CALLBACK(xinerama_state_toggled), (gpointer) ctk_object); @@ -1448,7 +1453,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Selected display/X screen dropdown */ ctk_object->mnu_selected_item = ctk_combo_box_text_new(); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_selected_item, - __selected_item_help); + _(__selected_item_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_selected_item), "changed", G_CALLBACK(selected_item_changed), (gpointer) ctk_object); @@ -1456,7 +1461,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display configuration (Disabled, TwinView, Separate X screen) */ ctk_object->mnu_display_config = ctk_combo_box_text_new(); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_config, - __dpy_configuration_mnu_help); + _(__dpy_configuration_mnu_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_display_config), "changed", G_CALLBACK(display_config_changed), (gpointer) ctk_object); @@ -1464,16 +1469,16 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display disable dialog */ ctk_object->txt_display_disable = gtk_label_new(""); ctk_object->dlg_display_disable = gtk_dialog_new_with_buttons - ("Disable Display Device", + (_("Disable Display Device"), GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(ctk_object))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, NULL); ctk_object->btn_display_disable_off = gtk_dialog_add_button(GTK_DIALOG(ctk_object->dlg_display_disable), - "Remove", + _("Remove"), GTK_RESPONSE_ACCEPT); ctk_object->btn_display_disable_cancel = gtk_dialog_add_button(GTK_DIALOG(ctk_object->dlg_display_disable), - "Ignore", + _("Ignore"), GTK_RESPONSE_CANCEL); gtk_window_set_resizable(GTK_WINDOW(ctk_object->dlg_display_disable), FALSE); @@ -1482,7 +1487,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display resolution */ ctk_object->mnu_display_resolution = ctk_combo_box_text_new(); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_resolution, - __dpy_resolution_mnu_help); + _(__dpy_resolution_mnu_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_display_resolution), "changed", G_CALLBACK(display_resolution_changed), (gpointer) ctk_object); @@ -1491,7 +1496,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display refresh */ ctk_object->mnu_display_refresh = ctk_combo_box_text_new(); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_refresh, - __dpy_refresh_mnu_help); + _(__dpy_refresh_mnu_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_display_refresh), "changed", G_CALLBACK(display_refresh_changed), (gpointer) ctk_object); @@ -1503,13 +1508,13 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display passive stereo eye dropdown */ ctk_object->mnu_display_stereo = ctk_combo_box_text_new(); ctk_combo_box_text_append_text(ctk_object->mnu_display_stereo, - "None"); + _("None")); ctk_combo_box_text_append_text(ctk_object->mnu_display_stereo, - "Left"); + _("Left")); ctk_combo_box_text_append_text(ctk_object->mnu_display_stereo, - "Right"); + _("Right")); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_stereo, - __dpy_stereo_help); + _(__dpy_stereo_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_display_stereo), "changed", G_CALLBACK(display_stereo_changed), (gpointer) ctk_object); @@ -1517,15 +1522,15 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display rotation dropdown */ ctk_object->mnu_display_rotation = ctk_combo_box_text_new(); ctk_combo_box_text_append_text(ctk_object->mnu_display_rotation, - "No Rotation"); + _("No Rotation")); ctk_combo_box_text_append_text(ctk_object->mnu_display_rotation, - "Rotate Left"); + _("Rotate Left")); ctk_combo_box_text_append_text(ctk_object->mnu_display_rotation, - "Invert"); + _("Invert")); ctk_combo_box_text_append_text(ctk_object->mnu_display_rotation, - "Rotate Right"); + _("Rotate Right")); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_rotation, - __dpy_rotation_help); + _(__dpy_rotation_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_display_rotation), "changed", G_CALLBACK(display_rotation_changed), (gpointer) ctk_object); @@ -1533,15 +1538,15 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display reflection dropdown */ ctk_object->mnu_display_reflection = ctk_combo_box_text_new(); ctk_combo_box_text_append_text(ctk_object->mnu_display_reflection, - "No Reflection"); + _("No Reflection")); ctk_combo_box_text_append_text(ctk_object->mnu_display_reflection, - "Reflect along X"); + _("Reflect along X")); ctk_combo_box_text_append_text(ctk_object->mnu_display_reflection, - "Reflect along Y"); + _("Reflect along Y")); ctk_combo_box_text_append_text(ctk_object->mnu_display_reflection, - "Reflect along XY"); + _("Reflect along XY")); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_reflection, - __dpy_reflection_help); + _(__dpy_reflection_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_display_reflection), "changed", G_CALLBACK(display_reflection_changed), (gpointer) ctk_object); @@ -1552,7 +1557,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, gtk_entry_set_width_chars(GTK_ENTRY(ctk_object->txt_display_underscan), 6); gtk_entry_set_text(GTK_ENTRY(ctk_object->txt_display_underscan), "0"); ctk_config_set_tooltip(ctk_config, ctk_object->txt_display_underscan, - __dpy_underscan_text_help); + _(__dpy_underscan_text_help)); g_signal_connect(G_OBJECT(ctk_object->txt_display_underscan), "activate", G_CALLBACK(display_underscan_activate), (gpointer) ctk_object); @@ -1567,7 +1572,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, gtk_scale_set_draw_value(GTK_SCALE(ctk_object->sld_display_underscan), FALSE); ctk_config_set_tooltip(ctk_config, ctk_object->sld_display_underscan, - __dpy_underscan_text_help); + _(__dpy_underscan_text_help)); g_signal_connect(G_OBJECT(ctk_object->adj_display_underscan), "value_changed", G_CALLBACK(display_underscan_value_changed), (gpointer) ctk_object); @@ -1575,19 +1580,19 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display Position Type (Absolute/Relative Menu) */ ctk_object->mnu_display_position_type = ctk_combo_box_text_new(); ctk_combo_box_text_append_text(ctk_object->mnu_display_position_type, - "Absolute"); + _("Absolute")); ctk_combo_box_text_append_text(ctk_object->mnu_display_position_type, - "Right of"); + _("Right of")); ctk_combo_box_text_append_text(ctk_object->mnu_display_position_type, - "Left of"); + _("Left of")); ctk_combo_box_text_append_text(ctk_object->mnu_display_position_type, - "Above"); + _("Above")); ctk_combo_box_text_append_text(ctk_object->mnu_display_position_type, - "Below"); + _("Below")); ctk_combo_box_text_append_text(ctk_object->mnu_display_position_type, - "Same as"); + _("Same as")); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_position_type, - __dpy_position_type_help); + _(__dpy_position_type_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_display_position_type), "changed", G_CALLBACK(display_position_type_changed), (gpointer) ctk_object); @@ -1596,7 +1601,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->mnu_display_position_relative = ctk_combo_box_text_new(); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_position_relative, - __dpy_position_relative_help); + _(__dpy_position_relative_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_display_position_relative), "changed", G_CALLBACK(display_position_relative_changed), @@ -1605,7 +1610,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display Position Offset (Absolute position) */ ctk_object->txt_display_position_offset = gtk_entry_new(); ctk_config_set_tooltip(ctk_config, ctk_object->txt_display_position_offset, - __dpy_position_offset_help); + _(__dpy_position_offset_help)); g_signal_connect(G_OBJECT(ctk_object->txt_display_position_offset), "activate", G_CALLBACK(display_position_offset_activate), (gpointer) ctk_object); @@ -1613,7 +1618,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display ViewPortIn */ ctk_object->txt_display_viewport_in = gtk_entry_new(); ctk_config_set_tooltip(ctk_config, ctk_object->txt_display_viewport_in, - __dpy_viewport_in_help); + _(__dpy_viewport_in_help)); g_signal_connect(G_OBJECT(ctk_object->txt_display_viewport_in), "activate", G_CALLBACK(display_viewport_in_activate), (gpointer) ctk_object); @@ -1624,7 +1629,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display ViewPortOut */ ctk_object->txt_display_viewport_out = gtk_entry_new(); ctk_config_set_tooltip(ctk_config, ctk_object->txt_display_viewport_out, - __dpy_viewport_out_help); + _(__dpy_viewport_out_help)); g_signal_connect(G_OBJECT(ctk_object->txt_display_viewport_out), "activate", G_CALLBACK(display_viewport_out_activate), (gpointer) ctk_object); @@ -1635,7 +1640,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display Panning */ ctk_object->txt_display_panning = gtk_entry_new(); ctk_config_set_tooltip(ctk_config, ctk_object->txt_display_panning, - __dpy_panning_help); + _(__dpy_panning_help)); g_signal_connect(G_OBJECT(ctk_object->txt_display_panning), "activate", G_CALLBACK(display_panning_activate), (gpointer) ctk_object); @@ -1646,7 +1651,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* X screen virtual size */ ctk_object->txt_screen_virtual_size = gtk_entry_new(); ctk_config_set_tooltip(ctk_config, ctk_object->txt_screen_virtual_size, - __screen_virtual_size_help); + _(__screen_virtual_size_help)); g_signal_connect(G_OBJECT(ctk_object->txt_screen_virtual_size), "activate", G_CALLBACK(screen_virtual_size_activate), (gpointer) ctk_object); @@ -1658,7 +1663,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* X screen depth */ ctk_object->mnu_screen_depth = ctk_combo_box_text_new(); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_screen_depth, - __screen_depth_help); + _(__screen_depth_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_screen_depth), "changed", G_CALLBACK(screen_depth_changed), (gpointer) ctk_object); @@ -1708,7 +1713,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, } ctk_config_set_tooltip(ctk_config, ctk_object->mnu_screen_stereo, - __screen_stereo_help); + _(__screen_stereo_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_screen_stereo), "changed", G_CALLBACK(screen_stereo_changed), (gpointer) ctk_object); @@ -1719,20 +1724,20 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Screen Position Type (Absolute/Relative Menu) */ ctk_object->mnu_screen_position_type = ctk_combo_box_text_new(); ctk_combo_box_text_append_text(ctk_object->mnu_screen_position_type, - "Absolute"); + _("Absolute")); ctk_combo_box_text_append_text(ctk_object->mnu_screen_position_type, - "Right of"); + _("Right of")); ctk_combo_box_text_append_text(ctk_object->mnu_screen_position_type, - "Left of"); + _("Left of")); ctk_combo_box_text_append_text(ctk_object->mnu_screen_position_type, - "Above"); + _("Above")); ctk_combo_box_text_append_text(ctk_object->mnu_screen_position_type, - "Below"); + _("Below")); // XXX Add better support for this later. //ctk_combo_box_text_append_text(ctk_object->mnu_screen_position_type, // "Relative to"); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_screen_position_type, - __screen_position_type_help); + _(__screen_position_type_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_screen_position_type), "changed", G_CALLBACK(screen_position_type_changed), (gpointer) ctk_object); @@ -1741,7 +1746,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->mnu_screen_position_relative = ctk_combo_box_text_new(); ctk_config_set_tooltip(ctk_config, ctk_object->mnu_screen_position_relative, - __screen_position_relative_help); + _(__screen_position_relative_help)); g_signal_connect(G_OBJECT(ctk_object->mnu_screen_position_relative), "changed", G_CALLBACK(screen_position_relative_changed), @@ -1750,7 +1755,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Screen Position Offset (Absolute position) */ ctk_object->txt_screen_position_offset = gtk_entry_new(); ctk_config_set_tooltip(ctk_config, ctk_object->txt_screen_position_offset, - __screen_position_offset_help); + _(__screen_position_offset_help)); g_signal_connect(G_OBJECT(ctk_object->txt_screen_position_offset), "activate", G_CALLBACK(screen_position_offset_activate), (gpointer) ctk_object); @@ -1758,22 +1763,22 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* X screen metamode */ ctk_object->btn_screen_metamode = gtk_button_new(); ctk_config_set_tooltip(ctk_config, ctk_object->btn_screen_metamode, - __screen_metamode_help); + _(__screen_metamode_help)); g_signal_connect(G_OBJECT(ctk_object->btn_screen_metamode), "clicked", G_CALLBACK(screen_metamode_clicked), (gpointer) ctk_object); - ctk_object->btn_screen_metamode_add = gtk_button_new_with_label("Add"); + ctk_object->btn_screen_metamode_add = gtk_button_new_with_label(_("Add")); ctk_config_set_tooltip(ctk_config, ctk_object->btn_screen_metamode_add, - __screen_metamode_add_button_help); + _(__screen_metamode_add_button_help)); g_signal_connect(G_OBJECT(ctk_object->btn_screen_metamode_add), "clicked", G_CALLBACK(screen_metamode_add_clicked), (gpointer) ctk_object); ctk_object->btn_screen_metamode_delete = - gtk_button_new_with_label("Delete"); + gtk_button_new_with_label(_("Delete")); ctk_config_set_tooltip(ctk_config, ctk_object->btn_screen_metamode_delete, - __screen_metamode_delete_button_help); + _(__screen_metamode_delete_button_help)); g_signal_connect(G_OBJECT(ctk_object->btn_screen_metamode_delete), "clicked", G_CALLBACK(screen_metamode_delete_clicked), @@ -1793,7 +1798,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Reset confirmation dialog */ ctk_object->dlg_reset_confirm = gtk_dialog_new_with_buttons - ("Confirm Reset", + (_("Confirm Reset"), GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(ctk_object))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, @@ -1809,7 +1814,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display ModeSwitch confirmation dialog */ ctk_object->dlg_display_confirm = gtk_dialog_new_with_buttons - ("Confirm ModeSwitch", + (_("Confirm ModeSwitch"), GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(ctk_object))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, @@ -1836,37 +1841,37 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Apply button */ - ctk_object->btn_apply = gtk_button_new_with_label("Apply"); + ctk_object->btn_apply = gtk_button_new_with_label(_("Apply")); update_btn_apply(ctk_object, FALSE); ctk_config_set_tooltip(ctk_config, ctk_object->btn_apply, - __apply_button_help); + _(__apply_button_help)); g_signal_connect(G_OBJECT(ctk_object->btn_apply), "clicked", G_CALLBACK(apply_clicked), (gpointer) ctk_object); /* Probe button */ - ctk_object->btn_probe = gtk_button_new_with_label("Detect Displays"); + ctk_object->btn_probe = gtk_button_new_with_label(_("Detect Displays")); ctk_config_set_tooltip(ctk_config, ctk_object->btn_probe, - __detect_displays_button_help); + _(__detect_displays_button_help)); g_signal_connect(G_OBJECT(ctk_object->btn_probe), "clicked", G_CALLBACK(probe_clicked), (gpointer) ctk_object); /* Advanced button */ - ctk_object->btn_advanced = gtk_button_new_with_label("Advanced..."); + ctk_object->btn_advanced = gtk_button_new_with_label(_("Advanced...")); ctk_config_set_tooltip(ctk_config, ctk_object->btn_advanced, - __advanced_button_help); + _(__advanced_button_help)); g_signal_connect(G_OBJECT(ctk_object->btn_advanced), "clicked", G_CALLBACK(advanced_clicked), (gpointer) ctk_object); /* Reset button */ - ctk_object->btn_reset = gtk_button_new_with_label("Reset"); + ctk_object->btn_reset = gtk_button_new_with_label(_("Reset")); ctk_config_set_tooltip(ctk_config, ctk_object->btn_reset, - __reset_button_help); + _(__reset_button_help)); g_signal_connect(G_OBJECT(ctk_object->btn_reset), "clicked", G_CALLBACK(reset_clicked), (gpointer) ctk_object); @@ -1874,16 +1879,16 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Save button */ ctk_object->btn_save = gtk_button_new_with_label - ("Save to X Configuration File"); + (_("Save to X Configuration File")); ctk_config_set_tooltip(ctk_config, ctk_object->btn_save, - __save_button_help); + _(__save_button_help)); g_signal_connect(G_OBJECT(ctk_object->btn_save), "clicked", G_CALLBACK(save_clicked), (gpointer) ctk_object); { /* Layout section */ - frame = gtk_frame_new("Layout"); /* main panel */ + frame = gtk_frame_new(_("Layout")); /* main panel */ gtk_box_pack_start(GTK_BOX(ctk_object), frame, FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); @@ -1905,7 +1910,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Selection */ - label = gtk_label_new("Selection:"); + label = gtk_label_new(_("Selection:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -1929,12 +1934,12 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, labels = g_slist_append(labels, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); - label = gtk_label_new("(CTRL-Click + Drag to move X screens)"); + label = gtk_label_new(_("(CTRL-Click + Drag to move X screens)")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); ctk_object->box_screen_drag_info_display = hbox; /* Display Configuration */ - label = gtk_label_new("Configuration:"); + label = gtk_label_new(_("Configuration:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -1945,7 +1950,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->box_display_config = hbox; /* Display resolution and refresh dropdowns */ - label = gtk_label_new("Resolution:"); + label = gtk_label_new(_("Resolution:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -1958,7 +1963,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->box_display_resolution = hbox; /* Modeline modename info */ - label = gtk_label_new("Mode Name:"); + label = gtk_label_new(_("Mode Name:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -1969,7 +1974,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->box_display_modename = hbox; /* Display passive stereo eye dropdown */ - label = gtk_label_new("Stereo Eye:"); + label = gtk_label_new(_("Stereo Eye:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -1983,7 +1988,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, { GtkWidget *hbox2 = gtk_hbox_new(TRUE, 5); - label = gtk_label_new("Orientation:"); + label = gtk_label_new(_("Orientation:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2004,7 +2009,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* Display underscan */ { GtkWidget *hbox2 = gtk_hbox_new(TRUE, 0); - label = gtk_label_new("Underscan:"); + label = gtk_label_new(_("Underscan:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2023,7 +2028,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, } /* Display positioning */ - label = gtk_label_new("Position:"); + label = gtk_label_new(_("Position:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2041,7 +2046,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->box_display_position = hbox; /* Display ViewPortIn */ - label = gtk_label_new("ViewPortIn:"); + label = gtk_label_new(_("ViewPortIn:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2053,7 +2058,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->box_display_viewport_in = hbox; /* Display ViewPortOut */ - label = gtk_label_new("ViewPortOut:"); + label = gtk_label_new(_("ViewPortOut:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2065,7 +2070,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->box_display_viewport_out = hbox; /* Display panning text entry */ - label = gtk_label_new("Panning:"); + label = gtk_label_new(_("Panning:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2079,10 +2084,10 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); ctk_object->chk_primary_display = - gtk_check_button_new_with_label("Make this the primary display " - "for the X screen"); + gtk_check_button_new_with_label(_("Make this the primary display " + "for the X screen")); ctk_config_set_tooltip(ctk_config, ctk_object->chk_primary_display, - __dpy_primary_help); + _(__dpy_primary_help)); g_signal_connect(G_OBJECT(ctk_object->chk_primary_display), "toggled", G_CALLBACK(screen_primary_display_toggled), (gpointer) ctk_object); @@ -2093,10 +2098,10 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); ctk_object->chk_forcecompositionpipeline_enabled = - gtk_check_button_new_with_label("Force Composition Pipeline"); + gtk_check_button_new_with_label(_("Force Composition Pipeline")); ctk_config_set_tooltip(ctk_config, ctk_object->chk_forcecompositionpipeline_enabled, - __dpy_forcecompositionpipeline_help); + _(__dpy_forcecompositionpipeline_help)); g_signal_connect(G_OBJECT(ctk_object->chk_forcecompositionpipeline_enabled), "toggled", G_CALLBACK(display_forcecompositionpipeline_toggled), @@ -2106,11 +2111,11 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, TRUE, TRUE, 0); ctk_object->chk_forcefullcompositionpipeline_enabled = - gtk_check_button_new_with_label("Force Full Composition Pipeline"); + gtk_check_button_new_with_label(_("Force Full Composition Pipeline")); ctk_config_set_tooltip(ctk_config, ctk_object-> chk_forcefullcompositionpipeline_enabled, - __dpy_forcefullcompositionpipeline_help); + _(__dpy_forcefullcompositionpipeline_help)); g_signal_connect(G_OBJECT(ctk_object->chk_forcefullcompositionpipeline_enabled), "toggled", G_CALLBACK(display_forcefullcompositionpipeline_toggled), @@ -2141,12 +2146,12 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, labels = g_slist_append(labels, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); - label = gtk_label_new("(CTRL-Click + Drag to move X screens)"); + label = gtk_label_new(_("(CTRL-Click + Drag to move X screens)")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); ctk_object->box_screen_drag_info_screen = hbox; /* X screen virtual size */ - label = gtk_label_new("Virtual Size:"); + label = gtk_label_new(_("Virtual Size:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2157,7 +2162,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->box_screen_virtual_size = hbox; /* X screen depth dropdown */ - label = gtk_label_new("Color Depth:"); + label = gtk_label_new(_("Color Depth:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2169,7 +2174,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, /* X screen stereo dropdown */ if (ctk_object->mnu_screen_stereo) { - label = gtk_label_new("Stereo Mode:"); + label = gtk_label_new(_("Stereo Mode:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2183,7 +2188,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, } /* X screen positioning */ - label = gtk_label_new("Position:"); + label = gtk_label_new(_("Position:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2201,7 +2206,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, ctk_object->box_screen_position = hbox; /* X screen metamode drop down & buttons */ - label = gtk_label_new("MetaMode:"); + label = gtk_label_new(_("MetaMode:")); labels = g_slist_append(labels, label); hbox = gtk_hbox_new(FALSE, 5); @@ -2232,17 +2237,17 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - label = gtk_label_new("PRIME Displays cannot be controlled by " + label = gtk_label_new(_("PRIME Displays cannot be controlled by " "nvidia-settings and must be configured by an external " "RandR capable tool. The display is shown in the layout " - "window above for informational purposes only."); + "window above for informational purposes only.")); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - label = gtk_label_new("Viewport:"); + label = gtk_label_new(_("Viewport:")); labels = g_slist_append(labels, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); @@ -2256,7 +2261,7 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - label = gtk_label_new("Name:"); + label = gtk_label_new(_("Name:")); labels = g_slist_append(labels, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); ctk_object->lbl_prime_display_name = gtk_label_new(""); @@ -2338,8 +2343,8 @@ GtkWidget* ctk_display_config_new(CtrlTarget *ctrl_target, gtk_widget_show_all(ctk_dialog_get_content_area(GTK_DIALOG(ctk_object->dlg_display_disable))); /* Reset Confirm Dialog */ - label = gtk_label_new("Do you really want to reset the " - "configuration?"); + label = gtk_label_new(_("Do you really want to reset the " + "configuration?")); hbox = gtk_hbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 20); gtk_box_pack_start @@ -2405,171 +2410,171 @@ GtkTextBuffer *ctk_display_config_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "Display Configuration Help"); - ctk_help_para(b, &i, "This page gives access to configuration of " - "the X server's display devices."); + ctk_help_title(b, &i, _("Display Configuration Help")); + ctk_help_para(b, &i, _("This page gives access to configuration of " + "the X server's display devices.")); ctk_help_para(b, &i, ""); - ctk_help_heading(b, &i, "Layout Section"); - ctk_help_para(b, &i, "This section shows information and configuration " - "settings for the X server layout."); - ctk_help_heading(b, &i, "Layout Image"); - ctk_help_para(b, &i, "The layout image shows the geometric relationship " + ctk_help_heading(b, &i, _("Layout Section")); + ctk_help_para(b, &i, _("This section shows information and configuration " + "settings for the X server layout.")); + ctk_help_heading(b, &i, _("Layout Image")); + ctk_help_para(b, &i, _("The layout image shows the geometric relationship " "that display devices and X screens have to each other. " "You may drag display devices around to reposition them. " "When in advanced view, the display's panning domain may " "be resized by holding SHIFT while dragging. Also, The " "X screen a display belongs to may be selected by holding " "down the CONTROL key while clicking on the display, and can " - "be moved by holding CONTROL-Click and dragging."); - ctk_help_heading(b, &i, "Layout Hidden Label"); - ctk_help_para(b, &i, "%s", __layout_hidden_label_help); + "be moved by holding CONTROL-Click and dragging.")); + ctk_help_heading(b, &i, _("Layout Hidden Label")); + ctk_help_para(b, &i, "%s", _(__layout_hidden_label_help)); if (gpu) { switch (gpu->mosaic_type) { case MOSAIC_TYPE_SLI_MOSAIC: - ctk_help_heading(b, &i, "Enable SLI Mosaic"); - ctk_help_para(b, &i, "%s", __layout_sli_mosaic_button_help); + ctk_help_heading(b, &i, _("Enable SLI Mosaic")); + ctk_help_para(b, &i, "%s", _(__layout_sli_mosaic_button_help)); break; case MOSAIC_TYPE_BASE_MOSAIC: - ctk_help_heading(b, &i, "Enable Base Mosaic"); - ctk_help_para(b, &i, "%s", __layout_base_mosaic_full_button_help); + ctk_help_heading(b, &i, _("Enable Base Mosaic")); + ctk_help_para(b, &i, "%s", _(__layout_base_mosaic_full_button_help)); break; case MOSAIC_TYPE_BASE_MOSAIC_LIMITED: - ctk_help_heading(b, &i, "Enable Base Mosaic (Surround)"); - ctk_help_para(b, &i, "%s", __layout_base_mosaic_surround_button_help); + ctk_help_heading(b, &i, _("Enable Base Mosaic (Surround)")); + ctk_help_para(b, &i, "%s", _(__layout_base_mosaic_surround_button_help)); break; default: break; } } - ctk_help_heading(b, &i, "Enable Xinerama"); - ctk_help_para(b, &i, "%s This setting is only available when multiple " - "X screens are present.", __layout_xinerama_button_help); - ctk_help_heading(b, &i, "Selection"); - ctk_help_para(b, &i, "%s", __selected_item_help); + ctk_help_heading(b, &i, _("Enable Xinerama")); + ctk_help_para(b, &i, _("%s This setting is only available when multiple " + "X screens are present."), _(__layout_xinerama_button_help)); + ctk_help_heading(b, &i, _("Selection")); + ctk_help_para(b, &i, "%s", _(__selected_item_help)); ctk_help_para(b, &i, ""); - ctk_help_heading(b, &i, "Display Options"); - ctk_help_para(b, &i, "The following options are available when a display " + ctk_help_heading(b, &i, _("Display Options")); + ctk_help_para(b, &i, _("The following options are available when a display " "device is selected in the Selection drop-down to configure " - "the settings for that display device."); - ctk_help_heading(b, &i, "Configuration"); - ctk_help_para(b, &i, "%s \"Disabled\" disables the selected display " + "the settings for that display device.")); + ctk_help_heading(b, &i, _("Configuration")); + ctk_help_para(b, &i, _("%s \"Disabled\" disables the selected display " "device. \"X screen \" associates the selected " "display device with the specified X Screen. \"New X screen " "(requires X restart)\" creates a new X Screen and " - "associates the selected display device with it.", - __dpy_configuration_mnu_help); - ctk_help_heading(b, &i, "Resolution"); - ctk_help_para(b, &i, "%s", __dpy_resolution_mnu_help); - ctk_help_heading(b, &i, "Refresh"); - ctk_help_para(b, &i, "The Refresh drop-down is to the right of the " - "Resolution drop-down. %s", __dpy_refresh_mnu_help); - ctk_help_heading(b, &i, "Mode Name"); - ctk_help_para(b, &i, "The Mode name is the name of the modeline that is " + "associates the selected display device with it."), + _(__dpy_configuration_mnu_help)); + ctk_help_heading(b, &i, _("Resolution")); + ctk_help_para(b, &i, "%s", _(__dpy_resolution_mnu_help)); + ctk_help_heading(b, &i, _("Refresh")); + ctk_help_para(b, &i, _("The Refresh drop-down is to the right of the " + "Resolution drop-down. %s"), _(__dpy_refresh_mnu_help)); + ctk_help_heading(b, &i, _("Mode Name")); + ctk_help_para(b, &i, _("The Mode name is the name of the modeline that is " "currently chosen for the selected display device. " - "This is only available when advanced view is enabled."); - ctk_help_heading(b, &i, "Stereo Eye"); - ctk_help_para(b, &i, "%s", __dpy_stereo_help); - ctk_help_heading(b, &i, "Orientation"); - ctk_help_para(b, &i, "The Orientation drop-downs control how the desktop " + "This is only available when advanced view is enabled.")); + ctk_help_heading(b, &i, _("Stereo Eye")); + ctk_help_para(b, &i, "%s", _(__dpy_stereo_help)); + ctk_help_heading(b, &i, _("Orientation")); + ctk_help_para(b, &i, _("The Orientation drop-downs control how the desktop " "image is rotated and/or reflected. %s %s Note that " - "reflection is applied before rotation.", - __dpy_rotation_help, __dpy_reflection_help); - ctk_help_heading(b, &i, "Underscan"); - ctk_help_para(b, &i, "%s The aspect ratio of the ViewPortOut is preserved " + "reflection is applied before rotation."), + _(__dpy_rotation_help), _(__dpy_reflection_help)); + ctk_help_heading(b, &i, _("Underscan")); + ctk_help_para(b, &i, _("%s The aspect ratio of the ViewPortOut is preserved " " and the ViewPortIn is updated to exactly match this new " "size. This feature is formerly known as Overscan " - "Compensation.", __dpy_underscan_text_help); - ctk_help_heading(b, &i, "Position Type"); - ctk_help_para(b, &i, "%s", __dpy_position_type_help); - ctk_help_heading(b, &i, "Position Relative"); - ctk_help_para(b, &i, "%s", __dpy_position_relative_help); - ctk_help_heading(b, &i, "Position Offset"); - ctk_help_para(b, &i, "%s", __dpy_position_offset_help); - ctk_help_heading(b, &i, "ViewPortIn"); - ctk_help_para(b, &i, "%s", __dpy_viewport_in_help); - ctk_help_heading(b, &i, "ViewPortOut"); - ctk_help_para(b, &i, "%s", __dpy_viewport_out_help); - ctk_help_heading(b, &i, "Panning"); - ctk_help_para(b, &i, "%s This is only available when advanced " - "view is enabled.", __dpy_panning_help); - ctk_help_heading(b, &i, "Primary Display"); - ctk_help_para(b, &i, "%s", __dpy_primary_help); - ctk_help_heading(b, &i, "Force Composition Pipeline"); - ctk_help_para(b, &i, "%s", __dpy_forcecompositionpipeline_help); - ctk_help_heading(b, &i, "Force Full Composition Pipeline"); - ctk_help_para(b, &i, "%s", __dpy_forcefullcompositionpipeline_help); + "Compensation."), _(__dpy_underscan_text_help)); + ctk_help_heading(b, &i, _("Position Type")); + ctk_help_para(b, &i, "%s", _(__dpy_position_type_help)); + ctk_help_heading(b, &i, _("Position Relative")); + ctk_help_para(b, &i, "%s", _(__dpy_position_relative_help)); + ctk_help_heading(b, &i, _("Position Offset")); + ctk_help_para(b, &i, "%s", _(__dpy_position_offset_help)); + ctk_help_heading(b, &i, _("ViewPortIn")); + ctk_help_para(b, &i, "%s", _(__dpy_viewport_in_help)); + ctk_help_heading(b, &i, _("ViewPortOut")); + ctk_help_para(b, &i, "%s", _(__dpy_viewport_out_help)); + ctk_help_heading(b, &i, _("Panning")); + ctk_help_para(b, &i, _("%s This is only available when advanced " + "view is enabled."), _(__dpy_panning_help)); + ctk_help_heading(b, &i, _("Primary Display")); + ctk_help_para(b, &i, "%s", _(__dpy_primary_help)); + ctk_help_heading(b, &i, _("Force Composition Pipeline")); + ctk_help_para(b, &i, "%s", _(__dpy_forcecompositionpipeline_help)); + ctk_help_heading(b, &i, _("Force Full Composition Pipeline")); + ctk_help_para(b, &i, "%s", _(__dpy_forcefullcompositionpipeline_help)); ctk_help_para(b, &i, ""); - ctk_help_heading(b, &i, "X Screen Options"); - ctk_help_para(b, &i, "The following options are available when an X " + ctk_help_heading(b, &i, _("X Screen Options")); + ctk_help_para(b, &i, _("The following options are available when an X " "screen is selected in the Selection drop-down to configure " - "the settings for that X screen."); - ctk_help_heading(b, &i, "Virtual Size"); - ctk_help_para(b, &i, "%s The Virtual screen size must be at least " - "304x200, and the width must be a multiple of 8.", - __screen_virtual_size_help); - ctk_help_heading(b, &i, "Color Depth"); - ctk_help_para(b, &i, "%s", __screen_depth_help); - ctk_help_heading(b, &i, "Stereo Mode"); - ctk_help_para(b, &i, "%s", __screen_stereo_help); - ctk_help_heading(b, &i, "Position Type"); - ctk_help_para(b, &i, "%s", __screen_position_type_help); - ctk_help_heading(b, &i, "Position Relative"); - ctk_help_para(b, &i, "%s", __screen_position_relative_help); - ctk_help_heading(b, &i, "Position Offset"); - ctk_help_para(b, &i, "%s", __screen_position_offset_help); - ctk_help_heading(b, &i, "MetaMode Selection"); - ctk_help_para(b, &i, "%s This is only available when advanced view " - "is enabled.", __screen_metamode_help); - ctk_help_heading(b, &i, "Add Metamode"); - ctk_help_para(b, &i, "%s This is only available when advanced view " - "is enabled.", __screen_metamode_add_button_help); - ctk_help_heading(b, &i, "Delete Metamode"); - ctk_help_para(b, &i, "%s This is only available when advanced view " - "is enabled.", __screen_metamode_delete_button_help); + "the settings for that X screen.")); + ctk_help_heading(b, &i, _("Virtual Size")); + ctk_help_para(b, &i, _("%s The Virtual screen size must be at least " + "304x200, and the width must be a multiple of 8."), + _(__screen_virtual_size_help)); + ctk_help_heading(b, &i, _("Color Depth")); + ctk_help_para(b, &i, "%s", _(__screen_depth_help)); + ctk_help_heading(b, &i, _("Stereo Mode")); + ctk_help_para(b, &i, "%s", _(__screen_stereo_help)); + ctk_help_heading(b, &i, _("Position Type")); + ctk_help_para(b, &i, "%s", _(__screen_position_type_help)); + ctk_help_heading(b, &i, _("Position Relative")); + ctk_help_para(b, &i, "%s", _(__screen_position_relative_help)); + ctk_help_heading(b, &i, _("Position Offset")); + ctk_help_para(b, &i, "%s", _(__screen_position_offset_help)); + ctk_help_heading(b, &i, _("MetaMode Selection")); + ctk_help_para(b, &i, _("%s This is only available when advanced view " + "is enabled."), _(__screen_metamode_help)); + ctk_help_heading(b, &i, _("Add Metamode")); + ctk_help_para(b, &i, _("%s This is only available when advanced view " + "is enabled."), _(__screen_metamode_add_button_help)); + ctk_help_heading(b, &i, _("Delete Metamode")); + ctk_help_para(b, &i, _("%s This is only available when advanced view " + "is enabled."), _(__screen_metamode_delete_button_help)); ctk_help_para(b, &i, ""); - ctk_help_heading(b, &i, "PRIME Display Options"); - ctk_help_para(b, &i, "The following attributes are available when a " + ctk_help_heading(b, &i, _("PRIME Display Options")); + ctk_help_para(b, &i, _("The following attributes are available when a " "configured PRIME display is selected in the Selection " "drop-down. These attributes cannot be changed within " - "nvidia-settings."); - ctk_help_heading(b, &i, "Viewport"); - ctk_help_para(b, &i, "%s", __prime_viewport_help); - ctk_help_heading(b, &i, "Name"); - ctk_help_para(b, &i, "%s This attribute may not be available.", - __prime_name_help); - ctk_help_heading(b, &i, "Synchronization"); - ctk_help_para(b, &i, "%s", __prime_sync_help); + "nvidia-settings.")); + ctk_help_heading(b, &i, _("Viewport")); + ctk_help_para(b, &i, "%s", _(__prime_viewport_help)); + ctk_help_heading(b, &i, _("Name")); + ctk_help_para(b, &i, _("%s This attribute may not be available."), + _(__prime_name_help)); + ctk_help_heading(b, &i, _("Synchronization")); + ctk_help_para(b, &i, "%s", _(__prime_sync_help)); ctk_help_para(b, &i, ""); - ctk_help_heading(b, &i, "Buttons"); - ctk_help_heading(b, &i, "Apply"); - ctk_help_para(b, &i, "%s Note that not all settings can be applied to an " + ctk_help_heading(b, &i, _("Buttons")); + ctk_help_heading(b, &i, _("Apply")); + ctk_help_para(b, &i, _("%s Note that not all settings can be applied to an " "active X server; " "these require restarting the X server after saving the " "desired settings to the X configuration file. Examples " "of such settings include changing the position of any X " "screen, adding/removing an X screen, and changing the X " - "screen color depth.", __apply_button_help); - ctk_help_heading(b, &i, "Detect Displays"); - ctk_help_para(b, &i, "%s", __detect_displays_button_help); - ctk_help_heading(b, &i, "Advanced/Basic..."); - ctk_help_para(b, &i, "%s The Basic view modifies the currently active " + "screen color depth."), _(__apply_button_help)); + ctk_help_heading(b, &i, _("Detect Displays")); + ctk_help_para(b, &i, "%s", _(__detect_displays_button_help)); + ctk_help_heading(b, &i, _("Advanced/Basic...")); + ctk_help_para(b, &i, _("%s The Basic view modifies the currently active " "MetaMode for an X screen, while the advanced view exposes " "all the MetaModes available on an X screen, and lets you " - "modify each of them.", __advanced_button_help); - ctk_help_heading(b, &i, "Reset"); - ctk_help_para(b, &i, "%s", __reset_button_help); - ctk_help_heading(b, &i, "Save to X Configuration File"); - ctk_help_para(b, &i, "%s", __save_button_help); + "modify each of them."), _(__advanced_button_help)); + ctk_help_heading(b, &i, _("Reset")); + ctk_help_para(b, &i, "%s", _(__reset_button_help)); + ctk_help_heading(b, &i, _("Save to X Configuration File")); + ctk_help_para(b, &i, "%s", _(__save_button_help)); ctk_help_finish(b); @@ -2613,16 +2618,16 @@ static void setup_mosaic_config(CtkDisplayConfig *ctk_object) switch (gpu->mosaic_type) { case MOSAIC_TYPE_SLI_MOSAIC: - tooltip = __layout_sli_mosaic_button_help; - label = "Enable SLI Mosaic"; + tooltip = _(__layout_sli_mosaic_button_help); + label = _("Enable SLI Mosaic"); break; case MOSAIC_TYPE_BASE_MOSAIC: - tooltip = __layout_base_mosaic_full_button_help; - label = "Enable Base Mosaic"; + tooltip = _(__layout_base_mosaic_full_button_help); + label = _("Enable Base Mosaic"); break; case MOSAIC_TYPE_BASE_MOSAIC_LIMITED: - tooltip = __layout_base_mosaic_surround_button_help; - label = "Enable Base Mosaic (Surround)"; + tooltip = _(__layout_base_mosaic_surround_button_help); + label = _("Enable Base Mosaic (Surround)"); break; default: gtk_widget_hide(ctk_object->chk_mosaic_enabled); @@ -2786,7 +2791,7 @@ static void generate_selected_item_dropdown(CtkDisplayConfig *ctk_object, *cur_idx = idx; } - str = g_strdup_printf("X screen %d", screen->scrnum); + str = g_strdup_printf(_("X screen %d"), screen->scrnum); ctk_combo_box_text_append_text(ctk_object->mnu_selected_item, str); g_free(str); @@ -2808,7 +2813,7 @@ static void generate_selected_item_dropdown(CtkDisplayConfig *ctk_object, display->randrName); if (show_gpu_info) { tmp = str; - str = g_strdup_printf("%s on GPU-%d", tmp, + str = g_strdup_printf(_("%s on GPU-%d"), tmp, NvCtrlGetTargetId(gpu->ctrl_target)); g_free(tmp); } @@ -2833,9 +2838,9 @@ static void generate_selected_item_dropdown(CtkDisplayConfig *ctk_object, } if (prime->label) { - str = g_strdup_printf("PRIME Display: %s", prime->label); + str = g_strdup_printf(_("PRIME Display: %s"), prime->label); } else { - str = g_strdup("PRIME Display"); + str = g_strdup(_("PRIME Display")); } ctk_combo_box_text_append_text(ctk_object->mnu_selected_item, str); @@ -3025,15 +3030,15 @@ static void setup_display_config(CtkDisplayConfig *ctk_object) switch (options[i].config) { case DPY_CFG_DISABLED: ctk_combo_box_text_append_text(ctk_object->mnu_display_config, - "Disabled"); + _("Disabled")); break; case DPY_CFG_NEW_X_SCREEN: ctk_combo_box_text_append_text( ctk_object->mnu_display_config, - "New X screen (requires X restart)"); + _("New X screen (requires X restart)")); break; case DPY_CFG_X_SCREEN: - label = g_strdup_printf("X screen %d", + label = g_strdup_printf(_("X screen %d"), options[i].screen->scrnum); ctk_combo_box_text_append_text(ctk_object->mnu_display_config, label); @@ -3112,7 +3117,7 @@ static void setup_display_refresh_dropdown(CtkDisplayConfig *ctk_object) /* Special case the 'nvidia-auto-select' mode. */ if (IS_NVIDIA_DEFAULT_MODE(cur_modeline)) { - ctk_combo_box_text_append_text(combo_box, "Auto"); + ctk_combo_box_text_append_text(combo_box, _("Auto")); ctk_object->refresh_table[ctk_object->refresh_table_len++] = cur_modeline; modelines = NULL; /* Skip building rest of refresh dropdown */ @@ -3137,7 +3142,7 @@ static void setup_display_refresh_dropdown(CtkDisplayConfig *ctk_object) continue; } - name = g_strdup_printf("%0.*f Hz", (display->is_sdi ? 3 : 0), + name = g_strdup_printf(_("%0.*f Hz"), (display->is_sdi ? 3 : 0), modeline->refresh_rate); /* Get a unique number for this modeline */ @@ -3145,7 +3150,7 @@ static void setup_display_refresh_dropdown(CtkDisplayConfig *ctk_object) num_ref = 0; /* Modeline # in a group of similar refresh rates */ for (m = modelines; m; m = m->next) { float m_rate = m->refresh_rate; - gchar *tmp = g_strdup_printf("%.0f Hz", m_rate); + gchar *tmp = g_strdup_printf(_("%.0f Hz"), m_rate); if (!IS_NVIDIA_DEFAULT_MODE(m) && m->data.hdisplay == modeline->data.hdisplay && @@ -3168,7 +3173,7 @@ static void setup_display_refresh_dropdown(CtkDisplayConfig *ctk_object) if (!ctk_object->refresh_table_len && !display->is_sdi) { auto_modeline = modeline; g_free(name); - name = g_strdup("Auto"); + name = g_strdup(_("Auto")); /* In advanced mode, all modelines are selectable */ } else if (count_ref > 1 && ctk_object->advanced_mode) { @@ -3184,23 +3189,23 @@ static void setup_display_refresh_dropdown(CtkDisplayConfig *ctk_object) /* Add "DoubleScan", "Interlace", and "HDMI 3D" information */ - if (g_ascii_strcasecmp(name, "Auto")) { + if (g_ascii_strcasecmp(name, _("Auto"))) { gchar *extra = NULL; gchar *tmp; ReturnStatus ret; gboolean hdmi3D = FALSE; if (modeline->data.flags & V_DBLSCAN) { - extra = g_strdup_printf("DoubleScan"); + extra = g_strdup_printf(_("DoubleScan")); } if (modeline->data.flags & V_INTERLACE) { if (extra) { - tmp = g_strdup_printf("%s, Interlace", extra); + tmp = g_strdup_printf(_("%s, Interlace"), extra); g_free(extra); extra = tmp; } else { - extra = g_strdup_printf("Interlace"); + extra = g_strdup_printf(_("Interlace")); } } @@ -3209,11 +3214,11 @@ static void setup_display_refresh_dropdown(CtkDisplayConfig *ctk_object) &hdmi3D); if (ret == NvCtrlSuccess && hdmi3D) { if (extra) { - tmp = g_strdup_printf("%s, HDMI 3D", extra); + tmp = g_strdup_printf(_("%s, HDMI 3D"), extra); g_free(extra); extra = tmp; } else { - extra = g_strdup_printf("HDMI 3D"); + extra = g_strdup_printf(_("HDMI 3D")); } } @@ -3541,7 +3546,7 @@ static void generate_selected_modes(const nvDisplayPtr display) /* Add the off item if we have more than one display */ if (display->screen->num_displays > 1) { - selected_mode = allocate_selected_mode("Off", + selected_mode = allocate_selected_mode(_("Off"), NULL /* modeline */, TRUE /* isSpecial */, NULL /* viewPortIn */, @@ -3558,7 +3563,7 @@ static void generate_selected_modes(const nvDisplayPtr display) Bool mode_added; if (IS_NVIDIA_DEFAULT_MODE(modeline)) { - name = g_strdup_printf("Auto"); + name = g_strdup_printf(_("Auto")); isSpecial = TRUE; } else { name = g_strdup_printf("%dx%d", @@ -3645,7 +3650,7 @@ static void generate_scaled_selected_modes(const nvDisplayPtr display) viewPortOut = NVVRGetScaledViewPortOut(&raster, &viewPortIn, NVVR_SCALING_ASPECT_SCALED); - name = g_strdup_printf("%dx%d (scaled)", viewPortIn.w, viewPortIn.h); + name = g_strdup_printf(_("%dx%d (scaled)"), viewPortIn.w, viewPortIn.h); selected_mode = allocate_selected_mode(name, default_modeline, FALSE /* isSpecial */, &viewPortIn, &viewPortOut); @@ -4079,7 +4084,7 @@ static void setup_display_underscan(CtkDisplayConfig *ctk_object) G_CALLBACK(display_underscan_activate), (gpointer) ctk_object); if (hpixel_value < 0) { - txt_entry = g_strdup_printf("n/a"); + txt_entry = g_strdup_printf(_("n/a")); } else { txt_entry = g_strdup_printf("%d", hpixel_value); } @@ -4717,32 +4722,32 @@ static void setup_screen_depth_dropdown(CtkDisplayConfig *ctk_object) if (grow_screen_depth_table(ctk_object)) { ctk_combo_box_text_append_text (ctk_object->mnu_screen_depth, - "1.1 Billion Colors (Depth 30) - Experimental"); + _("1.1 Billion Colors (Depth 30) - Experimental")); ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 30; } } if (grow_screen_depth_table(ctk_object)) { ctk_combo_box_text_append_text(ctk_object->mnu_screen_depth, - "16.7 Million Colors (Depth 24)"); + _("16.7 Million Colors (Depth 24)")); ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 24; } if (grow_screen_depth_table(ctk_object)) { ctk_combo_box_text_append_text(ctk_object->mnu_screen_depth, - "65,536 Colors (Depth 16)"); + _("65,536 Colors (Depth 16)")); ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 16; } if (grow_screen_depth_table(ctk_object)) { ctk_combo_box_text_append_text(ctk_object->mnu_screen_depth, - "32,768 Colors (Depth 15)"); + _("32,768 Colors (Depth 15)")); ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 15; } if (grow_screen_depth_table(ctk_object)) { ctk_combo_box_text_append_text(ctk_object->mnu_screen_depth, - "256 Colors (Depth 8)"); + _("256 Colors (Depth 8)")); ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 8; } @@ -4918,7 +4923,7 @@ static void setup_screen_position_relative(CtkDisplayConfig *ctk_object) ctk_object->screen_position_table[idx] = relative_to; - tmp_str = g_strdup_printf("X screen %d", + tmp_str = g_strdup_printf(_("X screen %d"), relative_to->scrnum); ctk_combo_box_text_append_text(ctk_object->mnu_screen_position_relative, tmp_str); @@ -5353,8 +5358,8 @@ static gchar * validate_screen(nvScreenPtr screen, /* There must be at least one display active in the metamode. */ if (!num_displays) { - tmp = g_strdup_printf("%s MetaMode %d of Screen %d does not have " - "an active display device.\n\n", + tmp = g_strdup_printf(_("%s MetaMode %d of Screen %d does not have " + "an active display device.\n\n"), bullet, i+1, screen->scrnum); tmp2 = g_strconcat((err_str ? err_str : ""), tmp, NULL); g_free(err_str); @@ -5366,8 +5371,8 @@ static gchar * validate_screen(nvScreenPtr screen, /* There can be at most max supported displays active in the metamode. */ if (max_displays >= 0 && num_displays > max_displays) { - tmp = g_strdup_printf("%s MetaMode %d of Screen %d has more than " - "%d active display devices.\n\n", + tmp = g_strdup_printf(ngettext("%s MetaMode %d of Screen %d has more than %d active display device.\n\n", + "%s MetaMode %d of Screen %d has more than %d active display devices.\n\n", max_displays), bullet, i+1, screen->scrnum, max_displays); tmp2 = g_strconcat((err_str ? err_str : ""), tmp, NULL); @@ -5435,12 +5440,12 @@ static int validate_layout(CtkDisplayConfig *ctk_object, int validation_type) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - "Multiple X screens are set to use absolute " + _("Multiple X screens are set to use absolute " "positioning. Though it is valid to do so, one or more " "X screens may be (or may become) unreachable due to " "overlapping and/or dead space. It is recommended to " "only use absolute positioning for the first X screen, " - "and relative positioning for all subsequent X screens."); + "and relative positioning for all subsequent X screens.")); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } @@ -5471,7 +5476,7 @@ static int validate_layout(CtkDisplayConfig *ctk_object, int validation_type) gtk_window_set_resizable(GTK_WINDOW(ctk_object->dlg_validation_override), FALSE); gtk_button_set_label(GTK_BUTTON(ctk_object->btn_validation_override_show), - "Show Details..."); + _("Show Details...")); /* Show the confirm dialog */ gtk_window_set_transient_for @@ -5949,13 +5954,13 @@ static void do_disable_display(CtkDisplayConfig *ctk_object, /* Setup the remove display dialog */ if (ctk_object->advanced_mode) { - str = g_strdup_printf("Disable the display device %s (%s) " - "on GPU-%d (%s)?", + str = g_strdup_printf(_("Disable the display device %s (%s) " + "on GPU-%d (%s)?"), display->logName, display->typeIdName, NvCtrlGetTargetId(gpu->ctrl_target), gpu->name); } else { - str = g_strdup_printf("Disable the display device %s (%s)?", + str = g_strdup_printf(_("Disable the display device %s (%s)?"), display->logName, display->typeIdName); } @@ -5964,9 +5969,9 @@ static void do_disable_display(CtkDisplayConfig *ctk_object, g_free(str); gtk_button_set_label(GTK_BUTTON(ctk_object->btn_display_disable_off), - "Disable"); + _("Disable")); gtk_button_set_label(GTK_BUTTON(ctk_object->btn_display_disable_cancel), - "Cancel"); + _("Cancel")); /* Confirm with user before disabling */ if (do_query_remove_display(ctk_object, display)) { @@ -7035,13 +7040,13 @@ static void screen_depth_changed(GtkWidget *widget, gpointer user_data) GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Note that Depth 30 requires recent X " + _("Note that Depth 30 requires recent X " "server updates for correct operation. " "Also, some X applications may not work " "correctly with depth 30.\n\n" "Please see the Chapter \"Configuring " "Depth 30 Displays\" " - "in the README for details."); + "in the README for details.")); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy (dlg); @@ -7439,9 +7444,11 @@ static void update_display_confirm_text(CtkDisplayConfig *ctk_object, int screen) { gchar *str; - str = g_strdup_printf("The mode on X screen %d has been set.\n" - "Would you like to keep the current settings?\n\n" - "Reverting in %d seconds...", + str = g_strdup_printf(g_strconcat(_("The mode on X screen %d has been set.\n" + "Would you like to keep the current settings?\n\n"), + ngettext("Reverting in %d second...", + "Reverting in %d seconds...", + ctk_object->display_confirm_countdown), NULL), screen, ctk_object->display_confirm_countdown); gtk_label_set_text(GTK_LABEL(ctk_object->txt_display_confirm), str); g_free(str); @@ -7570,9 +7577,9 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object, NvCtrlGetTargetId(screen->ctrl_target)); if (screen->num_metamodes > 1) { - msg = g_strdup_printf("Failed to set MetaMode (%d) '%s' " + msg = g_strdup_printf(_("Failed to set MetaMode (%d) '%s' " "(Mode %dx%d, id: %d) on X screen %d\n\n" - "Would you like to remove this MetaMode?", + "Would you like to remove this MetaMode?"), screen->cur_metamode_idx+1, metamode->cpl_str, new_width, new_height, new_rate, @@ -7584,8 +7591,8 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object, GTK_BUTTONS_YES_NO, "%s", msg); } else { - msg = g_strdup_printf("Failed to set MetaMode (%d) '%s' " - "(Mode %dx%d, id: %d) on X screen %d.", + msg = g_strdup_printf(_("Failed to set MetaMode (%d) '%s' " + "(Mode %dx%d, id: %d) on X screen %d."), screen->cur_metamode_idx+1, metamode->cpl_str, new_width, new_height, new_rate, @@ -8315,7 +8322,7 @@ static int update_screen_metamodes(CtkDisplayConfig *ctk_object, cur_metamode_str)) { ctk_config_statusbar_message(ctk_object->ctk_config, - "Switched to MetaMode %dx%d.", + _("Switched to MetaMode %dx%d."), screen->cur_metamode->edim.width, screen->cur_metamode->edim.height); @@ -9341,9 +9348,9 @@ static XConfigPtr xconfig_generate(XConfigPtr xconfCur, /* Merge xconfGen into xconfCur */ result = xconfigMergeConfigs(xconfCur, xconfGen); if (!result) { - gchar *err_msg = g_strdup_printf("Failed to merge generated " + gchar *err_msg = g_strdup_printf(_("Failed to merge generated " "configuration with existing " - "X config file!"); + "X config file!")); ctk_display_warning_msg(ctk_get_parent_window(GTK_WIDGET(ctk_object)), err_msg); g_free(err_msg); @@ -9407,13 +9414,13 @@ static void advanced_clicked(GtkWidget *widget, gpointer user_data) /* Show advanced display options */ if (ctk_object->advanced_mode) { - gtk_button_set_label(GTK_BUTTON(widget), "Basic..."); + gtk_button_set_label(GTK_BUTTON(widget), _("Basic...")); ctk_display_layout_set_advanced_mode (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), 1); /* Show basic display options */ } else { - gtk_button_set_label(GTK_BUTTON(widget), "Advanced..."); + gtk_button_set_label(GTK_BUTTON(widget), _("Advanced...")); ctk_display_layout_set_advanced_mode (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), 0); } @@ -9648,19 +9655,19 @@ static gboolean force_layout_reset(gpointer user_data) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, - "Your current changes to the X server display configuration may no " + _("Your current changes to the X server display configuration may no " "longer be applied due to changes made to the running X server.\n\n" "You may either reload the current X server settings and lose any " "configuration setup in this page, or select \"Cancel\" and save " "your changes to the X configuration file (requires restarting X " "to take effect.)\n\n" "If you select \"Cancel\", you will only be allowed to apply " - "settings once you have reset the configuration."); + "settings once you have reset the configuration.")); gtk_dialog_add_buttons(GTK_DIALOG(dlg), - "Reload current X server settings", + _("Reload current X server settings"), GTK_RESPONSE_YES, - "Cancel", GTK_RESPONSE_CANCEL, + _("Cancel"), GTK_RESPONSE_CANCEL, NULL); result = gtk_dialog_run(GTK_DIALOG(dlg)); @@ -9782,14 +9789,14 @@ static void validation_details_clicked(GtkWidget *widget, gpointer user_data) (ctk_object->box_validation_override_details, 450, 150); gtk_button_set_label (GTK_BUTTON(ctk_object->btn_validation_override_show), - "Hide Details..."); + _("Hide Details...")); } else { gtk_widget_hide(ctk_object->box_validation_override_details); gtk_window_set_resizable (GTK_WINDOW(ctk_object->dlg_validation_override), FALSE); gtk_button_set_label (GTK_BUTTON(ctk_object->btn_validation_override_show), - "Show Details..."); + _("Show Details...")); } } /* validation_details_clicked() */ diff --git a/src/gtk+-2.x/ctkdisplaydevice.c b/src/gtk+-2.x/ctkdisplaydevice.c index c62dd0e3..66d3c324 100644 --- a/src/gtk+-2.x/ctkdisplaydevice.c +++ b/src/gtk+-2.x/ctkdisplaydevice.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "ctkbanner.h" @@ -36,6 +37,9 @@ #include "ctkhelp.h" #include "ctkutils.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + static void ctk_display_device_class_init(CtkDisplayDeviceClass *); static void ctk_display_device_finalize(GObject *); @@ -78,41 +82,41 @@ static void add_color_correction_tab(CtkDisplayDevice *ctk_object, #define FRAME_PADDING 5 static const char *__info_help = -"This section describes basic information about the connection to the display " -"device."; +N_("This section describes basic information about the connection to the display " +"device."); static const char*__guid_help = -"The Global Unique Identifier for the display port display device."; +N_("The Global Unique Identifier for the display port display device."); static const char* __tv_encoder_name_help = -"The TV Encoder name displays the name of the TV Encoder."; +N_("The TV Encoder name displays the name of the TV Encoder."); static const char *__info_chip_location_help = -"Report whether the display device is driven by the on-chip controller " +N_("Report whether the display device is driven by the on-chip controller " "(internal), or a separate controller chip elsewhere on the graphics " -"board (external)."; +"board (external)."); static const char *__info_link_help = -"For DVI connections, reports whether the specified display device is " +N_("For DVI connections, reports whether the specified display device is " "driven by a single link or dual link connection. For DisplayPort " -"connections, reports the bandwidth of the connection."; +"connections, reports the bandwidth of the connection."); static const char *__info_signal_help = -"Report whether the flat panel is driven by an LVDS, TMDS, or DisplayPort " -"signal."; +N_("Report whether the flat panel is driven by an LVDS, TMDS, or DisplayPort " +"signal."); static const char * __refresh_rate_help = -"The refresh rate displays the rate at which the screen is currently " -"refreshing the image."; +N_("The refresh rate displays the rate at which the screen is currently " +"refreshing the image."); static const char * __connector_type_help = -"Report the connector type that the DisplayPort display is using."; +N_("Report the connector type that the DisplayPort display is using."); static const char * __multistream_help = -"Report whether the configured DisplayPort display supports multistream."; +N_("Report whether the configured DisplayPort display supports multistream."); static const char * __audio_help = -"Report whether the configured DisplayPort display is capable of playing audio."; +N_("Report whether the configured DisplayPort display is capable of playing audio."); typedef gboolean (*InfoEntryFunc)(InfoEntry *entry); @@ -126,63 +130,63 @@ typedef struct { static InfoEntryData __info_entry_data[] = { { - "GUID", + N_("GUID"), &__guid_help, update_guid_info, NULL, NULL, }, { - "TV Encoder", + N_("TV Encoder"), &__tv_encoder_name_help, update_tv_encoder_info, NULL, NULL, }, { - "Chip Location", + N_("Chip Location"), &__info_chip_location_help, update_chip_info, NULL, NULL, }, { - "Signal", + N_("Signal"), &__info_signal_help, update_signal_info, NULL, NULL, }, { - "Connection link", + N_("Connection link"), &__info_link_help, update_link_info, register_link_events, unregister_link_events, }, { - "Refresh Rate", + N_("Refresh Rate"), &__refresh_rate_help, update_refresh_rate, register_refresh_rate_events, unregister_refresh_rate_events, }, { - "DisplayPort Connector Type", + N_("DisplayPort Connector Type"), &__connector_type_help, update_connector_type_info, NULL, NULL, }, { - "DisplayPort Multistream Available", + N_("DisplayPort Multistream Available"), &__multistream_help, update_multistream_info, NULL, NULL, }, { - "DisplayPort Audio Available", + N_("DisplayPort Audio Available"), &__audio_help, update_audio_info, NULL, @@ -312,7 +316,7 @@ GtkWidget* ctk_display_device_new(CtrlTarget *ctrl_target, nbox = gtk_vbox_new(FALSE, FRAME_PADDING); gtk_container_set_border_width(GTK_CONTAINER(nbox), FRAME_PADDING); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nbox, - gtk_label_new("Information")); + gtk_label_new(_("Information"))); /* Device info */ @@ -320,7 +324,7 @@ GtkWidget* ctk_display_device_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(nbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Display Device Information"); + label = gtk_label_new(_("Display Device Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -357,7 +361,7 @@ GtkWidget* ctk_display_device_new(CtrlTarget *ctrl_target, gchar *str; entry->ctk_object = ctk_object; - str = g_strconcat(entryData->str, ":", NULL); + str = g_strconcat(_(entryData->str), ":", NULL); entry->label = gtk_label_new(str); g_free(str); @@ -368,10 +372,10 @@ GtkWidget* ctk_display_device_new(CtrlTarget *ctrl_target, ctk_config_set_tooltip(ctk_config, entry->label, - *(entryData->tooltip)); + _(*(entryData->tooltip))); ctk_config_set_tooltip(ctk_config, entry->txt, - *(entryData->tooltip)); + _(*(entryData->tooltip))); entry->hbox = gtk_hbox_new(FALSE, FRAME_PADDING); gtk_box_pack_start(GTK_BOX(entry->hbox), entry->label, @@ -405,7 +409,7 @@ GtkWidget* ctk_display_device_new(CtrlTarget *ctrl_target, /* pack the reset button */ - button = gtk_button_new_with_label("Reset Hardware Defaults"); + button = gtk_button_new_with_label(_("Reset Hardware Defaults")); str = ctk_help_create_reset_hardware_defaults_text(typeBaseName, name); ctk_config_set_tooltip(ctk_config, button, str); @@ -453,7 +457,7 @@ GtkWidget* ctk_display_device_new(CtrlTarget *ctrl_target, ctk_object->dithering_controls || ctk_object->image_sliders) { gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nbox, - gtk_label_new("Controls")); + gtk_label_new(_("Controls"))); } /* @@ -518,7 +522,7 @@ static void reset_button_clicked(GtkButton *button, gpointer user_data) ctk_image_sliders_reset(CTK_IMAGE_SLIDERS(ctk_object->image_sliders)); ctk_config_statusbar_message(ctk_object->ctk_config, - "Reset hardware defaults for %s.", + _("Reset hardware defaults for %s."), ctk_object->name); } /* reset_button_clicked() */ @@ -541,18 +545,18 @@ GtkTextBuffer *ctk_display_device_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "%s Help", ctk_object->name); + ctk_help_title(b, &i, _("%s Help"), ctk_object->name); - ctk_help_heading(b, &i, "Device Information"); - ctk_help_para(b, &i, "%s", __info_help); + ctk_help_heading(b, &i, _("Device Information")); + ctk_help_para(b, &i, "%s", _(__info_help)); for (j = 0; j < ARRAY_LEN(__info_entry_data); j++) { InfoEntryData *entryData = __info_entry_data+j; InfoEntry *entry = ctk_object->info_entries+j; if (entry->present) { - ctk_help_term(b, &i, "%s", entryData->str); - ctk_help_para(b, &i, "%s", *entryData->tooltip); + ctk_help_term(b, &i, "%s", _(entryData->str)); + ctk_help_para(b, &i, "%s", _(*entryData->tooltip)); } } @@ -568,7 +572,7 @@ GtkTextBuffer *ctk_display_device_create_help(GtkTextTagTable *table, (CTK_IMAGE_SLIDERS(ctk_object->image_sliders), b, &i); if (ctk_object->color_correction_available) { - ctk_color_correction_tab_help(b, &i, "X Server Color Correction", TRUE); + ctk_color_correction_tab_help(b, &i, _("X Server Color Correction"), TRUE); } tip_text = ctk_widget_get_tooltip_text(GTK_WIDGET(ctk_object->reset_button)); @@ -645,13 +649,13 @@ static gboolean update_chip_info(InfoEntry *entry) switch (val) { case NV_CTRL_FLATPANEL_CHIP_LOCATION_INTERNAL: - str = "Internal"; + str = _("Internal"); break; case NV_CTRL_FLATPANEL_CHIP_LOCATION_EXTERNAL: - str = "External"; + str = _("External"); break; default: - str = "Unknown"; + str = _("Unknown"); break; } @@ -677,16 +681,16 @@ static gboolean update_signal_info(InfoEntry *entry) switch (val) { case NV_CTRL_FLATPANEL_SIGNAL_LVDS: - str = "LVDS"; + str = _("LVDS"); break; case NV_CTRL_FLATPANEL_SIGNAL_TMDS: - str = "TMDS"; + str = _("TMDS"); break; case NV_CTRL_FLATPANEL_SIGNAL_DISPLAYPORT: - str = "DisplayPort"; + str = _("DisplayPort"); break; default: - str = "Unknown"; + str = _("Unknown"); break; } @@ -724,18 +728,16 @@ static gboolean update_link_info(InfoEntry *entry) &val); if ((ret == NvCtrlSuccess) && (val == NV_CTRL_DISPLAYPORT_LINK_RATE_DISABLED)) { - link = "Disabled"; + link = _("Disabled"); } else { if (ret != NvCtrlSuccess) { val = 0; } if (val > 0) { - snprintf(tmp, 32, "%d lane%s @ %.2f Gbps", lanes, lanes == 1 ? "" : "s", - val * 0.27); + snprintf(tmp, 32, ngettext("%d lane @ %.2f Gbps", "%d lanes @ %.2f Gbps", lanes), lanes, val * 0.27); } else { - snprintf(tmp, 32, "%d lane%s @ unknown bandwidth", lanes, - lanes == 1 ? "" : "s"); + snprintf(tmp, 32, ngettext("%d lane @ unknown bandwidth", "%d lanes @ unknown bandwidth", lanes), lanes); } link = tmp; } @@ -743,13 +745,13 @@ static gboolean update_link_info(InfoEntry *entry) // LVDS or TMDS switch(val) { case NV_CTRL_FLATPANEL_LINK_SINGLE: - link = "Single"; + link = _("Single"); break; case NV_CTRL_FLATPANEL_LINK_DUAL: - link = "Dual"; + link = _("Dual"); break; default: - link = "Unknown"; + link = _("Unknown"); break; } } @@ -776,20 +778,20 @@ static gboolean update_connector_type_info(InfoEntry *entry) switch (val) { case NV_CTRL_DISPLAYPORT_CONNECTOR_TYPE_DISPLAYPORT: - str = "DisplayPort"; + str = _("DisplayPort"); break; case NV_CTRL_DISPLAYPORT_CONNECTOR_TYPE_HDMI: - str = "HDMI"; + str = _("HDMI"); break; case NV_CTRL_DISPLAYPORT_CONNECTOR_TYPE_DVI: - str = "DVI"; + str = _("DVI"); break; case NV_CTRL_DISPLAYPORT_CONNECTOR_TYPE_VGA: - str = "VGA"; + str = _("VGA"); break; default: case NV_CTRL_DISPLAYPORT_CONNECTOR_TYPE_UNKNOWN: - str = "Unknown"; + str = _("Unknown"); break; } @@ -812,7 +814,7 @@ static gboolean update_multistream_info(InfoEntry *entry) return FALSE; } - gtk_label_set_text(GTK_LABEL(entry->txt), val ? "Yes": "No"); + gtk_label_set_text(GTK_LABEL(entry->txt), val ? _("Yes"): _("No")); return TRUE; } @@ -831,7 +833,7 @@ static gboolean update_audio_info(InfoEntry *entry) return FALSE; } - gtk_label_set_text(GTK_LABEL(entry->txt), val ? "Yes": "No"); + gtk_label_set_text(GTK_LABEL(entry->txt), val ? _("Yes"): _("No")); return TRUE; } @@ -866,7 +868,7 @@ static gboolean update_refresh_rate(InfoEntry *entry) fvalue /= 2; } - str = g_strdup_printf("%.2f Hz%s", fvalue, hdmi3D ? " (HDMI 3D)" : ""); + str = g_strdup_printf(_("%.2f Hz%s"), fvalue, hdmi3D ? " (HDMI 3D)" : ""); gtk_label_set_text(GTK_LABEL(entry->txt), str); g_free(str); @@ -1082,6 +1084,6 @@ static void add_color_correction_tab(CtkDisplayDevice *ctk_object, gtk_box_pack_start(GTK_BOX(box), ctk_color_correction, TRUE, TRUE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box, - gtk_label_new("Color Correction")); + gtk_label_new(_("Color Correction"))); gtk_widget_show(box); } diff --git a/src/gtk+-2.x/ctkdisplaylayout.c b/src/gtk+-2.x/ctkdisplaylayout.c index 93a4ddd4..d1a1cb26 100644 --- a/src/gtk+-2.x/ctkdisplaylayout.c +++ b/src/gtk+-2.x/ctkdisplaylayout.c @@ -19,6 +19,7 @@ #include /* malloc */ #include /* strlen */ +#include #include #include @@ -33,7 +34,7 @@ #include "ctkutils.h" - +#define _(STRING) gettext(STRING) /* GUI look and feel */ @@ -2526,7 +2527,7 @@ static char *get_display_tooltip(nvDisplayPtr display, Bool advanced) /* Display does not have a screen (not configured) */ if (!(display->screen)) { - tip = g_strdup_printf("%s : Disabled (GPU: %s)", + tip = g_strdup_printf(_("%s : Disabled (GPU: %s)"), display->logName, display->gpu->name); @@ -2540,13 +2541,13 @@ static char *get_display_tooltip(nvDisplayPtr display, Bool advanced) /* Display does not have a current modeline (Off) */ } else if (!(display->cur_mode->modeline)) { - tip = g_strdup_printf("%s : Off", + tip = g_strdup_printf(_("%s : Off"), display->logName); /* Display has mode/modeline */ } else { float ref = display->cur_mode->modeline->refresh_rate; - tip = g_strdup_printf("%s : %dx%d @ %.*f Hz", + tip = g_strdup_printf(_("%s : %dx%d @ %.*f Hz"), display->logName, display->cur_mode->modeline->data.hdisplay, display->cur_mode->modeline->data.vdisplay, @@ -2561,14 +2562,14 @@ static char *get_display_tooltip(nvDisplayPtr display, Bool advanced) /* Display has no mode */ if (!display->cur_mode) { - tip = g_strdup_printf("%s\n(X Screen %d)\n(GPU: %s)", + tip = g_strdup_printf(_("%s\n(X Screen %d)\n(GPU: %s)"), display->logName, display->screen->scrnum, display->gpu->name); /* Display does not have a current modeline (Off) */ } else if (!(display->cur_mode->modeline)) { - tip = g_strdup_printf("%s : Off\n(X Screen %d)\n(GPU: %s)", + tip = g_strdup_printf(_("%s : Off\n(X Screen %d)\n(GPU: %s)"), display->logName, display->screen->scrnum, display->gpu->name); @@ -2576,8 +2577,8 @@ static char *get_display_tooltip(nvDisplayPtr display, Bool advanced) /* Display has mode/modeline */ } else { float ref = display->cur_mode->modeline->refresh_rate; - tip = g_strdup_printf("%s : %dx%d @ %.*f Hz\n(X Screen %d)\n" - "(GPU: %s)", + tip = g_strdup_printf(_("%s : %dx%d @ %.*f Hz\n(X Screen %d)\n" + "(GPU: %s)"), display->logName, display->cur_mode->modeline->data.hdisplay, display->cur_mode->modeline->data.vdisplay, @@ -2611,8 +2612,7 @@ static char *get_screen_tooltip(nvScreenPtr screen) return NULL; } - tip = g_strdup_printf("X Screen %d%s", screen->scrnum, - screen->no_scanout ? " : No Scanout" : ""); + tip = g_strdup_printf(screen->no_scanout ? _("X Screen %d : No Scanout") : _("X Screen %d"), screen->scrnum); return tip; @@ -2682,9 +2682,9 @@ static char *get_tooltip_under_mouse(CtkDisplayLayout *ctk_object, goto found; } if (prime->label) { - tip = g_strdup_printf("PRIME display: %s", prime->label); + tip = g_strdup_printf(_("PRIME display: %s"), prime->label); } else { - tip = g_strdup("PRIME display"); + tip = g_strdup(_("PRIME display")); } goto found; } @@ -2696,7 +2696,7 @@ static char *get_tooltip_under_mouse(CtkDisplayLayout *ctk_object, last_display = NULL; last_screen = NULL; last_prime = NULL; - return g_strdup("No Display"); + return g_strdup(_("No Display")); } return NULL; @@ -2962,14 +2962,14 @@ GtkWidget* ctk_display_layout_new(CtkConfig *ctk_config, ctk_object->tooltip_area = gtk_event_box_new(); #ifdef CTK_GTK3 - gtk_widget_set_tooltip_text(ctk_object->tooltip_area, "*** No Display ***"); + gtk_widget_set_tooltip_text(ctk_object->tooltip_area, _("*** No Display ***")); #else ctk_object->tooltip_group = gtk_tooltips_new(); gtk_tooltips_enable(ctk_object->tooltip_group); gtk_tooltips_set_tip(ctk_object->tooltip_group, ctk_object->tooltip_area, - "*** No Display ***", NULL); + _("*** No Display ***"), NULL); #endif gtk_container_add(GTK_CONTAINER(ctk_object->tooltip_area), tmp); @@ -3365,9 +3365,9 @@ static void draw_prime_display(CtkDisplayLayout *ctk_object, /* Draw text information */ if (prime_display->label) { - tmp_str_name = g_strdup_printf("PRIME: %s", prime_display->label); + tmp_str_name = g_strdup_printf(_("PRIME: %s"), prime_display->label); } else { - tmp_str_name = g_strdup("PRIME Display"); + tmp_str_name = g_strdup(_("PRIME Display")); } tmp_str_data = g_strdup_printf("%dx%d", rect->width, rect->height); @@ -3423,12 +3423,12 @@ static void draw_display(CtkDisplayLayout *ctk_object, /* Draw text information */ if (!mode->display->screen) { - tmp_str = g_strdup("(Disabled)"); + tmp_str = g_strdup(_("(Disabled)")); } else if (mode->modeline) { tmp_str = g_strdup_printf("%dx%d", mode->viewPortIn.width, mode->viewPortIn.height); } else { - tmp_str = g_strdup("(Off)"); + tmp_str = g_strdup(_("(Off)")); } draw_rect_strs(ctk_object, &rect, @@ -3499,13 +3499,13 @@ static void draw_screen(CtkDisplayLayout *ctk_object, /* Show the name of the screen if no-scanout is selected */ if (screen->no_scanout) { - tmp_str = g_strdup_printf("X Screen %d", screen->scrnum); + tmp_str = g_strdup_printf(_("X Screen %d"), screen->scrnum); draw_rect_strs(ctk_object, &(screen->dim), &(ctk_object->fg_color), tmp_str, - "(No Scanout)"); + _("(No Scanout)")); g_free(tmp_str); } diff --git a/src/gtk+-2.x/ctkditheringcontrols.c b/src/gtk+-2.x/ctkditheringcontrols.c index 2467bb9f..ebcf7065 100644 --- a/src/gtk+-2.x/ctkditheringcontrols.c +++ b/src/gtk+-2.x/ctkditheringcontrols.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "ctkconfig.h" #include "ctkhelp.h" @@ -35,6 +36,9 @@ #include "ctkdropdownmenu.h" #include "ctkutils.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + /* function prototypes */ static void ctk_dither_controls_class_init(CtkDitheringControlsClass *ctk_object_class); @@ -89,20 +93,20 @@ static gint map_dithering_depth_menu_idx_to_nvctrl(gint idx); /* help text */ static const char * __dithering_help = -"The Dithering Controls show the current state of dithering and allow " -"changing the dithering configuration, mode and/or depth."; +N_("The Dithering Controls show the current state of dithering and allow " +"changing the dithering configuration, mode and/or depth."); static const char * __dithering_config_help = -"Dithering will be performed when dithering is enabled here and the " -"panel's bitdepth is less than that of the GPU's internal pixel pipeline."; +N_("Dithering will be performed when dithering is enabled here and the " +"panel's bitdepth is less than that of the GPU's internal pixel pipeline."); static const char * __dithering_mode_help = -"Dithering mode can be Dynamic 2x2, Static 2x2 or Temporal " -"depending on the type of the display device."; +N_("Dithering mode can be Dynamic 2x2, Static 2x2 or Temporal " +"depending on the type of the display device."); static const char * __dithering_depth_help = -"The depth can be adjusted to 6 or 8 bits per channel depending on " -"the type of display device."; +N_("The depth can be adjusted to 6 or 8 bits per channel depending on " +"the type of display device."); GType ctk_dithering_controls_get_type(void) { @@ -190,7 +194,7 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, FRAME_PADDING); ctk_dithering_controls->dithering_controls_box = hbox; - frame = gtk_frame_new("Dithering Controls"); + frame = gtk_frame_new(_("Dithering Controls")); gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); table = gtk_table_new(5, 4, FALSE); @@ -204,9 +208,9 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, menu = (CtkDropDownMenu *) ctk_drop_down_menu_new(CTK_DROP_DOWN_MENU_FLAG_READONLY); - ctk_drop_down_menu_append_item(menu, "Auto", 0); - ctk_drop_down_menu_append_item(menu, "Enabled", 1); - ctk_drop_down_menu_append_item(menu, "Disabled", 2); + ctk_drop_down_menu_append_item(menu, _("Auto"), 0); + ctk_drop_down_menu_append_item(menu, _("Enabled"), 1); + ctk_drop_down_menu_append_item(menu, _("Disabled"), 2); ctk_dithering_controls->dithering_config_menu = GTK_WIDGET(menu); @@ -223,7 +227,7 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Dithering: "); + label = gtk_label_new(_("Dithering: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -238,7 +242,7 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Current Dithering: "); + label = gtk_label_new(_("Current Dithering: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -273,7 +277,7 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Mode: "); + label = gtk_label_new(_("Mode: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -289,7 +293,7 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 2, 3, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Current Mode: "); + label = gtk_label_new(_("Current Mode: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -312,9 +316,9 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, menu = (CtkDropDownMenu *) ctk_drop_down_menu_new(CTK_DROP_DOWN_MENU_FLAG_READONLY); - ctk_drop_down_menu_append_item(menu, "Auto", 0); - ctk_drop_down_menu_append_item(menu, "6 bpc", 1); - ctk_drop_down_menu_append_item(menu, "8 bpc", 2); + ctk_drop_down_menu_append_item(menu, _("Auto"), 0); + ctk_drop_down_menu_append_item(menu, _("6 bpc"), 1); + ctk_drop_down_menu_append_item(menu, _("8 bpc"), 2); ctk_dithering_controls->dithering_depth_menu = GTK_WIDGET(menu); @@ -331,7 +335,7 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 4, 5, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Depth: "); + label = gtk_label_new(_("Depth: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -347,7 +351,7 @@ GtkWidget* ctk_dithering_controls_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 2, 3, 4, 5, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Current Depth: "); + label = gtk_label_new(_("Current Depth: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -508,17 +512,17 @@ setup_dithering_mode_menu(CtkDitheringControls *ctk_dithering_controls) for (i = 0; i < ctk_dithering_controls->dithering_mode_table_size; i++) { switch (ctk_dithering_controls->dithering_mode_table[i]) { case NV_CTRL_DITHERING_MODE_DYNAMIC_2X2: - ctk_drop_down_menu_append_item(dithering_mode_menu, "Dynamic 2x2", i); + ctk_drop_down_menu_append_item(dithering_mode_menu, _("Dynamic 2x2"), i); break; case NV_CTRL_DITHERING_MODE_STATIC_2X2: - ctk_drop_down_menu_append_item(dithering_mode_menu, "Static 2x2", i); + ctk_drop_down_menu_append_item(dithering_mode_menu, _("Static 2x2"), i); break; case NV_CTRL_DITHERING_MODE_TEMPORAL: - ctk_drop_down_menu_append_item(dithering_mode_menu, "Temporal", i); + ctk_drop_down_menu_append_item(dithering_mode_menu, _("Temporal"), i); break; default: case NV_CTRL_DITHERING_MODE_AUTO: - ctk_drop_down_menu_append_item(dithering_mode_menu, "Auto", i); + ctk_drop_down_menu_append_item(dithering_mode_menu, _("Auto"), i); break; } } @@ -646,10 +650,10 @@ static Bool update_dithering_info(gpointer user_data) if (val == NV_CTRL_CURRENT_DITHERING_ENABLED) { gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_config_txt), - "Enabled"); + _("Enabled")); } else { gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_config_txt), - "Disabled"); + _("Disabled")); } /* current dithering mode */ @@ -662,20 +666,20 @@ static Bool update_dithering_info(gpointer user_data) switch (val) { case NV_CTRL_CURRENT_DITHERING_MODE_DYNAMIC_2X2: gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_mode_txt), - "Dynamic 2x2"); + _("Dynamic 2x2")); break; case NV_CTRL_CURRENT_DITHERING_MODE_STATIC_2X2: gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_mode_txt), - "Static 2x2"); + _("Static 2x2")); break; case NV_CTRL_CURRENT_DITHERING_MODE_TEMPORAL: gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_mode_txt), - "Temporal"); + _("Temporal")); break; default: case NV_CTRL_CURRENT_DITHERING_MODE_NONE: gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_mode_txt), - "None"); + _("None")); break; } /* current dithering depth */ @@ -688,16 +692,16 @@ static Bool update_dithering_info(gpointer user_data) switch (val) { case NV_CTRL_CURRENT_DITHERING_DEPTH_6_BITS: gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_depth_txt), - "6 bpc"); + _("6 bpc")); break; case NV_CTRL_CURRENT_DITHERING_DEPTH_8_BITS: gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_depth_txt), - "8 bpc"); + _("8 bpc")); break; default: case NV_CTRL_CURRENT_DITHERING_DEPTH_NONE: gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_depth_txt), - "None"); + _("None")); break; } @@ -710,9 +714,9 @@ void post_dithering_config_update(CtkDitheringControls *ctk_dithering_controls, gint dithering_config) { static const char *dither_config_table[] = { - "Auto", /* NV_CTRL_DITHERING_AUTO */ - "Enabled", /* NV_CTRL_DITHERING_ENABLED */ - "Disabled" /* NV_CTRL_DITHERING_DISABLED */ + N_("Auto"), /* NV_CTRL_DITHERING_AUTO */ + N_("Enabled"), /* NV_CTRL_DITHERING_ENABLED */ + N_("Disabled") /* NV_CTRL_DITHERING_DISABLED */ }; if (dithering_config < NV_CTRL_DITHERING_AUTO || @@ -722,8 +726,8 @@ void post_dithering_config_update(CtkDitheringControls *ctk_dithering_controls, gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE); ctk_config_statusbar_message(ctk_dithering_controls->ctk_config, - "Dithering set to %s for %s.", - dither_config_table[dithering_config], + _("Dithering set to %s for %s."), + _(dither_config_table[dithering_config]), ctk_dithering_controls->name); } @@ -732,10 +736,10 @@ void post_dithering_mode_update(CtkDitheringControls *ctk_dithering_controls, gint dithering_mode) { static const char *dither_mode_table[] = { - "Auto", /* NV_CTRL_DITHERING_MODE_AUTO */ - "Dynamic 2x2", /* NV_CTRL_DITHERING_MODE_DYNAMIC_2X2 */ - "Static 2x2", /* NV_CTRL_DITHERING_MODE_STATIC_2X2 */ - "Temporal", /* NV_CTRL_DITHERING_MODE_TEMPORAL */ + N_("Auto"), /* NV_CTRL_DITHERING_MODE_AUTO */ + N_("Dynamic 2x2"), /* NV_CTRL_DITHERING_MODE_DYNAMIC_2X2 */ + N_("Static 2x2"), /* NV_CTRL_DITHERING_MODE_STATIC_2X2 */ + N_("Temporal"), /* NV_CTRL_DITHERING_MODE_TEMPORAL */ }; if (dithering_mode < NV_CTRL_DITHERING_MODE_AUTO || @@ -745,8 +749,8 @@ void post_dithering_mode_update(CtkDitheringControls *ctk_dithering_controls, gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE); ctk_config_statusbar_message(ctk_dithering_controls->ctk_config, - "Dithering mode set to %s for %s.", - dither_mode_table[dithering_mode], + _("Dithering mode set to %s for %s."), + _(dither_mode_table[dithering_mode]), ctk_dithering_controls->name); } @@ -755,9 +759,9 @@ void post_dithering_depth_update(CtkDitheringControls *ctk_dithering_controls, gint dithering_depth) { static const char *dither_depth_table[] = { - "Auto", /* NV_CTRL_DITHERING_DEPTH_AUTO */ - "6 bpc", /* NV_CTRL_DITHERING_DEPTH_6_BITS */ - "8 bpc" /* NV_CTRL_DITHERING_DEPTH_8_BITS */ + N_("Auto"), /* NV_CTRL_DITHERING_DEPTH_AUTO */ + N_("6 bpc"), /* NV_CTRL_DITHERING_DEPTH_6_BITS */ + N_("8 bpc") /* NV_CTRL_DITHERING_DEPTH_8_BITS */ }; if (dithering_depth < NV_CTRL_DITHERING_DEPTH_AUTO || @@ -767,8 +771,8 @@ void post_dithering_depth_update(CtkDitheringControls *ctk_dithering_controls, gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE); ctk_config_statusbar_message(ctk_dithering_controls->ctk_config, - "Dithering depth set to %s for %s.", - dither_depth_table[dithering_depth], + _("Dithering depth set to %s for %s."), + _(dither_depth_table[dithering_depth]), ctk_dithering_controls->name); } @@ -881,17 +885,17 @@ void add_dithering_controls_help(CtkDitheringControls *ctk_dithering_controls, return; } - ctk_help_heading(b, i, "Dithering Controls"); - ctk_help_para(b, i, "%s", __dithering_help); + ctk_help_heading(b, i, _("Dithering Controls")); + ctk_help_para(b, i, "%s", _(__dithering_help)); - ctk_help_term(b, i, "Dithering"); - ctk_help_para(b, i, "%s", __dithering_config_help); + ctk_help_term(b, i, _("Dithering")); + ctk_help_para(b, i, "%s", _(__dithering_config_help)); - ctk_help_term(b, i, "Mode"); - ctk_help_para(b, i, "%s", __dithering_mode_help); + ctk_help_term(b, i, _("Mode")); + ctk_help_para(b, i, "%s", _(__dithering_mode_help)); - ctk_help_term(b, i, "Depth"); - ctk_help_para(b, i, "%s", __dithering_depth_help); + ctk_help_term(b, i, _("Depth")); + ctk_help_para(b, i, "%s", _(__dithering_depth_help)); } /* add_dithering_controls_help() */ diff --git a/src/gtk+-2.x/ctkecc.c b/src/gtk+-2.x/ctkecc.c index 591d2aa1..b5487d5c 100644 --- a/src/gtk+-2.x/ctkecc.c +++ b/src/gtk+-2.x/ctkecc.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,45 +33,48 @@ #include "ctkgpu.h" #include "ctkbanner.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + #define DEFAULT_UPDATE_ECC_STATUS_INFO_TIME_INTERVAL 1000 static const char *__ecc_settings_help = -"This page allows you to change the Error Correction Code (ECC) " -"setting for this GPU."; +N_("This page allows you to change the Error Correction Code (ECC) " +"setting for this GPU."); static const char *__ecc_status_help = -"Returns the current hardware ECC setting " -"for the targeted GPU."; +N_("Returns the current hardware ECC setting " +"for the targeted GPU."); static const char *__sbit_error_help = -"Returns the number of single-bit ECC errors detected by " -"the targeted GPU since the last system reboot."; +N_("Returns the number of single-bit ECC errors detected by " +"the targeted GPU since the last system reboot."); static const char *__dbit_error_help = -"Returns the number of double-bit ECC errors detected by " -"the targeted GPU since the last system reboot."; +N_("Returns the number of double-bit ECC errors detected by " +"the targeted GPU since the last system reboot."); static const char *__aggregate_sbit_error_help = -"Returns the number of single-bit ECC errors detected by the " -"targeted GPU since the last counter reset."; +N_("Returns the number of single-bit ECC errors detected by the " +"targeted GPU since the last counter reset."); static const char *__aggregate_dbit_error_help = -"Returns the number of double-bit ECC errors detected by the " -"targeted GPU since the last counter reset."; +N_("Returns the number of double-bit ECC errors detected by the " +"targeted GPU since the last counter reset."); static const char *__configuration_status_help = -"Returns the current ECC configuration setting or specifies new " +N_("Returns the current ECC configuration setting or specifies new " "settings. Changes to these settings do not take effect until the next " -"system reboot."; +"system reboot."); static const char *__clear_button_help = -"This button is used to clear the ECC errors detected since the last system reboot."; +N_("This button is used to clear the ECC errors detected since the last system reboot."); static const char *__clear_aggregate_button_help = -"This button is used to reset the aggregate ECC errors counter."; +N_("This button is used to reset the aggregate ECC errors counter."); static const char *__reset_default_config_button_help = -"The button is used to restore the GPU's default ECC configuration setting."; +N_("The button is used to restore the GPU's default ECC configuration setting."); static void ecc_config_button_toggled(GtkWidget *, gpointer); static void show_ecc_toggle_warning_dlg(CtkEcc *); @@ -255,11 +259,11 @@ static void post_ecc_configuration_update(CtkEcc *ctk_ecc) gboolean configured = ctk_ecc->ecc_configured; gboolean enabled = ctk_ecc->ecc_enabled; - const char *conf_string = configured ? "enabled" : "disabled"; + const char *conf_string = configured ? _("enabled") : _("disabled"); char message[128]; if (configured != enabled) { - snprintf(message, sizeof(message), "ECC will be %s after reboot.", + snprintf(message, sizeof(message), _("ECC will be %s after reboot."), conf_string); } else { snprintf(message, sizeof(message), "ECC %s.", conf_string); @@ -349,7 +353,7 @@ static void reset_default_config_button_clicked(GtkWidget *widget, ctk_ecc->ecc_default_status); if (ret != NvCtrlSuccess) { ctk_config_statusbar_message(ctk_ecc->ctk_config, - "Failed to set default configuration!"); + _("Failed to set default configuration!")); return; } @@ -364,7 +368,7 @@ static void reset_default_config_button_clicked(GtkWidget *widget, gtk_widget_set_sensitive(ctk_ecc->reset_default_config_button, FALSE); ctk_config_statusbar_message(ctk_ecc->ctk_config, - "Set to default configuration."); + _("Set to default configuration.")); } /* reset_default_config_button_clicked() */ @@ -385,7 +389,7 @@ static void clear_ecc_errors_button_clicked(GtkWidget *widget, NV_CTRL_GPU_ECC_RESET_ERROR_STATUS_VOLATILE); ctk_config_statusbar_message(ctk_ecc->ctk_config, - "ECC errors cleared."); + _("ECC errors cleared.")); } /* clear_ecc_errors_button_clicked() */ @@ -406,7 +410,7 @@ static void clear_aggregate_ecc_errors_button_clicked(GtkWidget *widget, NV_CTRL_GPU_ECC_RESET_ERROR_STATUS_AGGREGATE); ctk_config_statusbar_message(ctk_ecc->ctk_config, - "ECC aggregate errors cleared."); + _("ECC aggregate errors cleared.")); } /* clear_aggregate_ecc_errors_button_clicked() */ @@ -429,9 +433,9 @@ static void show_ecc_toggle_warning_dlg(CtkEcc *ctk_ecc) GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Changes to the ECC setting " + _("Changes to the ECC setting " "require a system reboot before " - "taking effect."); + "taking effect.")); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy (dlg); @@ -464,7 +468,7 @@ static void ecc_config_button_toggled(GtkWidget *widget, enabled); if (ret != NvCtrlSuccess) { ctk_config_statusbar_message(ctk_ecc->ctk_config, - "Failed to set ECC configuration!"); + _("Failed to set ECC configuration!")); return; } @@ -544,10 +548,10 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, &val); if (ret != NvCtrlSuccess || val == NV_CTRL_GPU_ECC_STATUS_DISABLED) { ecc_enabled = FALSE; - ecc_enabled_string = "Disabled"; + ecc_enabled_string = _("Disabled"); } else { ecc_enabled = TRUE; - ecc_enabled_string = "Enabled"; + ecc_enabled_string = _("Enabled"); } ctk_ecc->ecc_enabled = ecc_enabled; @@ -629,7 +633,7 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("ECC Status"); + label = gtk_label_new(_("ECC Status")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -646,7 +650,7 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("ECC:"); + label = gtk_label_new(_("ECC:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); @@ -657,7 +661,7 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, label = gtk_label_new(ecc_enabled_string); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_config, eventbox, __ecc_status_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__ecc_status_help)); ctk_ecc->status = label; row += 3; @@ -666,28 +670,28 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, if (sbit_error_available && dbit_error_available) { ctk_ecc->sbit_error = - add_table_int_row(ctk_config, table, __sbit_error_help, - "Single-bit ECC Errors:", sbit_error, + add_table_int_row(ctk_config, table, _(__sbit_error_help), + _("Single-bit ECC Errors:"), sbit_error, row, ecc_enabled); row += 1; // add vertical padding between rows ctk_ecc->dbit_error = - add_table_int_row(ctk_config, table, __dbit_error_help, - "Double-bit ECC Errors:", dbit_error, + add_table_int_row(ctk_config, table, _(__dbit_error_help), + _("Double-bit ECC Errors:"), dbit_error, row, ecc_enabled); row += 3; // add vertical padding between rows } if (aggregate_sbit_error_available && aggregate_dbit_error_available) { ctk_ecc->aggregate_sbit_error = - add_table_int_row(ctk_config, table, __aggregate_sbit_error_help, - "Aggregate Single-bit ECC Errors:", + add_table_int_row(ctk_config, table, _(__aggregate_sbit_error_help), + _("Aggregate Single-bit ECC Errors:"), aggregate_sbit_error, row, ecc_enabled); row += 1; // add vertical padding between rows ctk_ecc->aggregate_dbit_error = - add_table_int_row(ctk_config, table, __aggregate_dbit_error_help, - "Aggregate Double-bit ECC Errors:", + add_table_int_row(ctk_config, table, _(__aggregate_dbit_error_help), + _("Aggregate Double-bit ECC Errors:"), aggregate_dbit_error, row, ecc_enabled); } @@ -696,7 +700,7 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("ECC Configuration"); + label = gtk_label_new(_("ECC Configuration")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -704,7 +708,7 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, hbox2 = gtk_hbox_new(FALSE, 0); ctk_ecc->configuration_status = - gtk_check_button_new_with_label("Enable ECC"); + gtk_check_button_new_with_label(_("Enable ECC")); gtk_box_pack_start(GTK_BOX(hbox2), ctk_ecc->configuration_status, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox2), 5); @@ -712,7 +716,7 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctk_ecc->configuration_status), ctk_ecc->ecc_configured); ctk_config_set_tooltip(ctk_config, ctk_ecc->configuration_status, - __configuration_status_help); + _(__configuration_status_help)); g_signal_connect(G_OBJECT(ctk_ecc->configuration_status), "clicked", G_CALLBACK(ecc_config_button_toggled), (gpointer) ctk_ecc); @@ -728,10 +732,10 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, /* Add buttons */ if (sbit_error_available && dbit_error_available) { - ctk_ecc->clear_button = gtk_button_new_with_label("Clear ECC Errors"); + ctk_ecc->clear_button = gtk_button_new_with_label(_("Clear ECC Errors")); gtk_box_pack_end(GTK_BOX(hbox), ctk_ecc->clear_button, FALSE, FALSE, 0); ctk_config_set_tooltip(ctk_config, ctk_ecc->clear_button, - __clear_button_help); + _(__clear_button_help)); gtk_widget_set_sensitive(ctk_ecc->clear_button, ecc_enabled); g_signal_connect(G_OBJECT(ctk_ecc->clear_button), "clicked", G_CALLBACK(clear_ecc_errors_button_clicked), @@ -740,11 +744,11 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, if (aggregate_sbit_error_available && aggregate_dbit_error_available) { ctk_ecc->clear_aggregate_button = - gtk_button_new_with_label("Clear Aggregate ECC Errors"); + gtk_button_new_with_label(_("Clear Aggregate ECC Errors")); gtk_box_pack_end(GTK_BOX(hbox), ctk_ecc->clear_aggregate_button, FALSE, FALSE, 0); ctk_config_set_tooltip(ctk_config, ctk_ecc->clear_button, - __clear_aggregate_button_help); + _(__clear_aggregate_button_help)); gtk_widget_set_sensitive(ctk_ecc->clear_aggregate_button, ecc_enabled); g_signal_connect(G_OBJECT(ctk_ecc->clear_aggregate_button), "clicked", @@ -753,13 +757,13 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, } ctk_ecc->reset_default_config_button = - gtk_button_new_with_label("Reset Default Configuration"); + gtk_button_new_with_label(_("Reset Default Configuration")); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), ctk_ecc->reset_default_config_button); gtk_box_pack_end(GTK_BOX(hbox), eventbox, FALSE, FALSE, 5); ctk_config_set_tooltip(ctk_config, ctk_ecc->reset_default_config_button, - __reset_default_config_button_help); + _(__reset_default_config_button_help)); gtk_widget_set_sensitive(ctk_ecc->reset_default_config_button, ecc_config_supported && (ecc_enabled != ctk_ecc->ecc_default_status)); @@ -769,7 +773,7 @@ GtkWidget* ctk_ecc_new(CtrlTarget *ctrl_target, (gpointer) ctk_ecc); /* Register a timer callback to update Ecc status info */ - str = g_strdup_printf("ECC Settings (GPU %d)", + str = g_strdup_printf(_("ECC Settings (GPU %d)"), NvCtrlGetTargetId(ctrl_target)); ctk_config_add_timer(ctk_ecc->ctk_config, @@ -797,43 +801,43 @@ GtkTextBuffer *ctk_ecc_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_heading(b, &i, "ECC Settings Help"); - ctk_help_para(b, &i, "%s", __ecc_settings_help); + ctk_help_heading(b, &i, _("ECC Settings Help")); + ctk_help_para(b, &i, "%s", _(__ecc_settings_help)); - ctk_help_heading(b, &i, "ECC"); - ctk_help_para(b, &i, "%s", __ecc_status_help); + ctk_help_heading(b, &i, _("ECC")); + ctk_help_para(b, &i, "%s", _(__ecc_status_help)); if (ctk_ecc->sbit_error_available && ctk_ecc->dbit_error_available) { - ctk_help_heading(b, &i, "Single-bit ECC Errors"); - ctk_help_para(b, &i, "%s", __sbit_error_help); - ctk_help_heading(b, &i, "Double-bit ECC Errors"); - ctk_help_para(b, &i, "%s", __dbit_error_help); + ctk_help_heading(b, &i, _("Single-bit ECC Errors")); + ctk_help_para(b, &i, "%s", _(__sbit_error_help)); + ctk_help_heading(b, &i, _("Double-bit ECC Errors")); + ctk_help_para(b, &i, "%s", _(__dbit_error_help)); } if (ctk_ecc->aggregate_sbit_error_available && ctk_ecc->aggregate_dbit_error_available) { - ctk_help_heading(b, &i, "Aggregate Single-bit ECC Errors"); - ctk_help_para(b, &i, "%s", __aggregate_sbit_error_help); - ctk_help_heading(b, &i, "Aggregate Double-bit ECC Errors"); - ctk_help_para(b, &i, "%s", __aggregate_dbit_error_help); + ctk_help_heading(b, &i, _("Aggregate Single-bit ECC Errors")); + ctk_help_para(b, &i, "%s", _(__aggregate_sbit_error_help)); + ctk_help_heading(b, &i, _("Aggregate Double-bit ECC Errors")); + ctk_help_para(b, &i, "%s", _(__aggregate_dbit_error_help)); } - ctk_help_heading(b, &i, "ECC Configuration"); - ctk_help_para(b, &i, "%s", __configuration_status_help); + ctk_help_heading(b, &i, _("ECC Configuration")); + ctk_help_para(b, &i, "%s", _(__configuration_status_help)); - ctk_help_heading(b, &i, "Enable ECC"); - ctk_help_para(b, &i, "%s", __ecc_status_help); + ctk_help_heading(b, &i, _("Enable ECC")); + ctk_help_para(b, &i, "%s", _(__ecc_status_help)); if (ctk_ecc->sbit_error_available && ctk_ecc->dbit_error_available) { - ctk_help_heading(b, &i, "Clear ECC Errors"); - ctk_help_para(b, &i, "%s", __clear_button_help); + ctk_help_heading(b, &i, _("Clear ECC Errors")); + ctk_help_para(b, &i, "%s", _(__clear_button_help)); } if (ctk_ecc->aggregate_sbit_error_available && ctk_ecc->aggregate_dbit_error_available) { - ctk_help_heading(b, &i, "Clear Aggregate ECC Errors"); - ctk_help_para(b, &i, "%s", __clear_aggregate_button_help); + ctk_help_heading(b, &i, _("Clear Aggregate ECC Errors")); + ctk_help_para(b, &i, "%s", _(__clear_aggregate_button_help)); } - ctk_help_heading(b, &i, "Reset Default Configuration"); - ctk_help_para(b, &i, "%s", __reset_default_config_button_help); + ctk_help_heading(b, &i, _("Reset Default Configuration")); + ctk_help_para(b, &i, "%s", _(__reset_default_config_button_help)); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkedid.c b/src/gtk+-2.x/ctkedid.c index a681fcbc..e24f51da 100644 --- a/src/gtk+-2.x/ctkedid.c +++ b/src/gtk+-2.x/ctkedid.c @@ -34,7 +34,10 @@ #include #include #include +#include +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING #define FRAME_PADDING 5 @@ -47,10 +50,10 @@ #define DEFAULT_EDID_FILENAME_ASCII "edid.txt" static const char *__acquire_edid_help = -"The Acquire EDID button allows you to save the display device's EDID " +N_("The Acquire EDID button allows you to save the display device's EDID " "(Extended Display Identification Data) information to a file. By " "default it saves information in binary format but one can also choose " -"to save in ASCII format."; +"to save in ASCII format."); static void file_format_changed(GtkWidget *widget, gpointer user_data); static void normalize_filename(CtkEdid *ctk_edid); @@ -132,7 +135,7 @@ GtkWidget* ctk_edid_new(CtrlTarget *ctrl_target, /* create the button and label */ - label = gtk_label_new("Acquire EDID..."); + label = gtk_label_new(_("Acquire EDID...")); hbox = gtk_hbox_new(FALSE, 0); ctk_edid->button = gtk_button_new(); @@ -145,7 +148,7 @@ GtkWidget* ctk_edid_new(CtrlTarget *ctrl_target, gtk_box_pack_end(GTK_BOX(vbox), alignment, TRUE, TRUE, 0); ctk_config_set_tooltip(ctk_config, ctk_edid->button, - __acquire_edid_help); + _(__acquire_edid_help)); g_signal_connect(G_OBJECT(ctk_edid->button), "clicked", @@ -266,15 +269,15 @@ static void button_clicked(GtkButton *button, gpointer user_data) &data, &len); if (ret != NvCtrlSuccess) { ctk_config_statusbar_message(ctk_edid->ctk_config, - "No EDID available for %s.", + _("No EDID available for %s."), ctk_edid->name); } else { /* Create a dialog and ask user for filename */ ctk_edid->file_selector = - ctk_file_chooser_dialog_new("Please select file where " - "EDID data will be saved.", + ctk_file_chooser_dialog_new(_("Please select file where " + "EDID data will be saved."), NULL, GTK_FILE_CHOOSER_ACTION_SAVE); ctk_file_chooser_set_filename(ctk_edid->file_selector, @@ -288,11 +291,11 @@ static void button_clicked(GtkButton *button, gpointer user_data) gtk_container_set_border_width(GTK_CONTAINER(hbox), FRAME_PADDING); gtk_container_add(GTK_CONTAINER(file_format_frame), hbox); - label = gtk_label_new("EDID File Format: "); + label = gtk_label_new(_("EDID File Format: ")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); ctk_edid->file_format_binary_radio_button = - gtk_radio_button_new_with_label(NULL, "Binary"); + gtk_radio_button_new_with_label(NULL, _("Binary")); gtk_box_pack_start(GTK_BOX(hbox), ctk_edid->file_format_binary_radio_button, FALSE, FALSE, 0); @@ -371,7 +374,7 @@ static gboolean write_edid_to_file(CtkConfig *ctk_config, const gchar *filename, if (format == FILE_FORMAT_ASCII) { fp = fopen(filename, "wt"); if (!fp) { - msg = "ASCII Mode: Unable to open file for writing"; + msg = _("ASCII Mode: Unable to open file for writing"); goto fail; } /* @@ -381,14 +384,14 @@ static gboolean write_edid_to_file(CtkConfig *ctk_config, const gchar *filename, */ tmpbuf = calloc(1, 1 + (len * 3)); if (!tmpbuf) { - msg = "ASCII Mode: Could not allocate enough memory"; + msg = _("ASCII Mode: Could not allocate enough memory"); goto fail; } pbuf = tmpbuf; for (i = 0; i < len; i++) { if (sprintf(pbuf, "%02x ", data[i]) < 0) { - msg = "ASCII Mode: Unable to write to buffer"; + msg = _("ASCII Mode: Unable to write to buffer"); goto fail; } pbuf = pbuf + 3; @@ -397,7 +400,7 @@ static gboolean write_edid_to_file(CtkConfig *ctk_config, const gchar *filename, sprintf(pbuf, "%c", '\0'); if (fprintf(fp, "%s", tmpbuf) < 0) { - msg = "ASCII Mode: Unable to write to file"; + msg = _("ASCII Mode: Unable to write to file"); goto fail; } @@ -407,12 +410,12 @@ static gboolean write_edid_to_file(CtkConfig *ctk_config, const gchar *filename, } else { fp = fopen(filename, "wb"); if (!fp) { - msg = "Binary Mode: Unable to open file for writing"; + msg = _("Binary Mode: Unable to open file for writing"); goto fail; } if (fwrite(data, 1, len, fp) != len) { - msg = "Binary Mode: Unable to write to file"; + msg = _("Binary Mode: Unable to write to file"); goto fail; } } @@ -420,7 +423,7 @@ static gboolean write_edid_to_file(CtkConfig *ctk_config, const gchar *filename, fclose(fp); ctk_config_statusbar_message(ctk_config, - "EDID written to %s.", filename); + _("EDID written to %s."), filename); return TRUE; fail: @@ -433,7 +436,7 @@ static gboolean write_edid_to_file(CtkConfig *ctk_config, const gchar *filename, } ctk_config_statusbar_message(ctk_config, - "Unable to write EDID to file '%s': %s (%s).", + _("Unable to write EDID to file '%s': %s (%s)."), filename, msg, strerror(errno)); return FALSE; @@ -442,7 +445,7 @@ static gboolean write_edid_to_file(CtkConfig *ctk_config, const gchar *filename, void add_acquire_edid_help(GtkTextBuffer *b, GtkTextIter *i) { - ctk_help_heading(b, i, "Acquire EDID"); - ctk_help_para(b, i, "%s", __acquire_edid_help); + ctk_help_heading(b, i, _("Acquire EDID")); + ctk_help_para(b, i, "%s", _(__acquire_edid_help)); } /* add_acquire_edid_help() */ diff --git a/src/gtk+-2.x/ctkframelock.c b/src/gtk+-2.x/ctkframelock.c index 1679cb43..b5bfe17e 100644 --- a/src/gtk+-2.x/ctkframelock.c +++ b/src/gtk+-2.x/ctkframelock.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "ctkutils.h" #include "ctkbanner.h" @@ -47,6 +48,8 @@ #include "msg.h" #include "common-utils.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING #define DEFAULT_UPDATE_STATUS_TIME_INTERVAL 1000 #define DEFAULT_TEST_LINK_TIME_INTERVAL 2000 @@ -251,18 +254,18 @@ struct _nvFrameLockDataRec { static gchar *houseFormatStrings[] = { - "Composite, Auto", /* VIDEO_MODE_COMPOSITE_AUTO */ - "TTL", /* VIDEO_MODE_TTL */ - "Composite, Bi-Level", /* VIDEO_MODE_COMPOSITE_BI_LEVEL */ - "Composite, Tri-Level", /* VIDEO_MODE_COMPOSITE_TRI_LEVEL */ + N_("Composite, Auto"), /* VIDEO_MODE_COMPOSITE_AUTO */ + N_("TTL"), /* VIDEO_MODE_TTL */ + N_("Composite, Bi-Level"), /* VIDEO_MODE_COMPOSITE_BI_LEVEL */ + N_("Composite, Tri-Level"), /* VIDEO_MODE_COMPOSITE_TRI_LEVEL */ NULL }; static gchar *syncEdgeStrings[] = { "", /* None */ - "Rising", /* NV_CTRL_FRAMELOCK_POLARITY_RISING_EDGE */ - "Falling", /* NV_CTRL_FRAMELOCK_POLARITY_FALLING_EDGE */ - "Both", /* NV_CTRL_FRAMELOCK_POLARITY_BOTH_EDGES */ + N_("Rising"), /* NV_CTRL_FRAMELOCK_POLARITY_RISING_EDGE */ + N_("Falling"), /* NV_CTRL_FRAMELOCK_POLARITY_FALLING_EDGE */ + N_("Both"), /* NV_CTRL_FRAMELOCK_POLARITY_BOTH_EDGES */ NULL }; @@ -270,24 +273,24 @@ static gchar *syncEdgeStrings[] = { /* Tooltips */ static const char * __add_devices_button_help = -"The Add Devices button adds to the frame lock group all Quadro Sync devices " -"found on the specified X Server."; +N_("The Add Devices button adds to the frame lock group all Quadro Sync devices " +"found on the specified X Server."); static const char * __remove_devices_button_help = -"The Remove Devices button allows you to remove Quadro Sync, GPU or display " +N_("The Remove Devices button allows you to remove Quadro Sync, GPU or display " "devices from the frame lock group. Any device removed from the frame lock " -"group will no longer be controlled."; +"group will no longer be controlled."); static const char * __show_extra_info_button_help = -"The Show Extra Info button displays extra information and settings " -"for various devices."; +N_("The Show Extra Info button displays extra information and settings " +"for various devices."); static const char * __expand_all_button_help = -"This button expands or collapses all the entries in the framelock device " -"list."; +N_("This button expands or collapses all the entries in the framelock device " +"list."); static const char * __house_sync_mode_combo_help = -"The House Sync Mode drop-down allows you to configure the Quadro Sync device " +N_("The House Sync Mode drop-down allows you to configure the Quadro Sync device " "to use the BNC connector in either input or output mode. When set to Input, " "the server Quadro Sync device will generate the master frame lock signal " "from the incoming house sync signal (if a house sync signal is detected) " @@ -296,49 +299,49 @@ static const char * __house_sync_mode_combo_help = "internal timing and output this signal over the BNC connector on the Quadro " "Sync device. Output mode is only available on a Quadro Sync II device. If " "an incoming house sync signal is present on the BNC connector, requesting " -"Output mode will have no effect."; +"Output mode will have no effect."); static const char * __sync_interval_scale_help = -"The Sync Interval allows you to set the number of incoming house sync " +N_("The Sync Interval allows you to set the number of incoming house sync " "pulses the master frame lock board receives before generating an outgoing " "frame lock sync pulse. A value of 0 means a frame lock sync pulse is sent " -"for every house sync pulse."; +"for every house sync pulse."); static const char * __sync_edge_combo_help = -"The Sync Edge drop-down allows you to select which edge the master " -"frame lock device will use to decode the incoming house sync signal."; +N_("The Sync Edge drop-down allows you to select which edge the master " +"frame lock device will use to decode the incoming house sync signal."); static const char * __video_mode_help = -"The Video Mode drop-down allows you to select which video mode the server " +N_("The Video Mode drop-down allows you to select which video mode the server " "Quadro Sync device will use to decode the incoming house sync signal. On " "some Quadro Sync devices, this will be auto-detected and will be reported " -"as read-only information."; +"as read-only information."); static const char * __detect_video_mode_button_help = -"The Detect Video Mode button will attempt to automatically detect the format " -"of the house sync signal by iterating through the list of known video modes."; +N_("The Detect Video Mode button will attempt to automatically detect the format " +"of the house sync signal by iterating through the list of known video modes."); static const char * __test_link_button_help = -"The Test Link button will cause the master frame lock device to output a " +N_("The Test Link button will cause the master frame lock device to output a " "test signal for a short amount of time. During this time, the Sync Signal " "coming from the master frame lock device will be held high causing the rj45 " -"ports throughout the frame lock group to stop blinking."; +"ports throughout the frame lock group to stop blinking."); static const char * __sync_enable_button_help = -"The Enable/Disable Frame Lock button will enable/disable frame lock on all " +N_("The Enable/Disable Frame Lock button will enable/disable frame lock on all " "devices listed in the Quadro Sync group. Enabling frame lock will lock the " -"refresh rates of all members in the frame lock group."; +"refresh rates of all members in the frame lock group."); static const char * __server_checkbox_help = -"The Server checkbox sets which display device the underlying frame lock " +N_("The Server checkbox sets which display device the underlying frame lock " "device should use to generate the frame lock sync signal. Only one display " "device can be selected as server for a frame lock group. To select another " "display device, the display device currently set as server should be " -"unselected."; +"unselected."); static const char * __client_checkbox_help = -"The Client checkbox allows you to set whether or not this display device " -"will be synchronized to the incoming frame lock sync signal."; +N_("The Client checkbox allows you to set whether or not this display device " +"will be synchronized to the incoming frame lock sync signal."); @@ -423,7 +426,7 @@ static GtkWidget *create_error_msg_dialog(CtkFramelock *ctk_framelock) GdkPixbuf *pixbuf; - dialog = gtk_dialog_new_with_buttons("Error", + dialog = gtk_dialog_new_with_buttons(_("Error"), ctk_framelock->parent_window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -493,7 +496,7 @@ static GtkWidget *create_sync_state_button(CtkFramelock *ctk_framelock) GTK_ICON_SIZE_BUTTON, "enable frame lock"); if (pixbuf) image = gtk_image_new_from_pixbuf(pixbuf); - label = gtk_label_new("Enable Frame Lock"); + label = gtk_label_new(_("Enable Frame Lock")); hbox = gtk_hbox_new(FALSE, 2); @@ -522,7 +525,7 @@ static GtkWidget *create_sync_state_button(CtkFramelock *ctk_framelock) GTK_ICON_SIZE_BUTTON, "disable frame lock"); if (pixbuf) image = gtk_image_new_from_pixbuf(pixbuf); - label = gtk_label_new("Disable Frame Lock"); + label = gtk_label_new(_("Disable Frame Lock")); hbox = gtk_hbox_new(FALSE, 2); @@ -573,7 +576,7 @@ static GtkWidget *create_add_devices_dialog(CtkFramelock *ctk_framelock) GdkPixbuf *pixbuf; GtkWidget *alignment; - dialog = gtk_dialog_new_with_buttons("Add X Screen", + dialog = gtk_dialog_new_with_buttons(_("Add X Screen"), ctk_framelock->parent_window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -605,9 +608,9 @@ static GtkWidget *create_add_devices_dialog(CtkFramelock *ctk_framelock) image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); - label = gtk_label_new("X Server:"); - descr = gtk_label_new("Please specify the X server to be added to the " - "frame lock group."); + label = gtk_label_new(_("X Server:")); + descr = gtk_label_new(_("Please specify the X server to be added to the " + "frame lock group.")); ctk_framelock->add_devices_entry = gtk_entry_new(); @@ -660,7 +663,7 @@ static GtkWidget *create_remove_devices_dialog(CtkFramelock *ctk_framelock) GtkWidget *alignment; - dialog = gtk_dialog_new_with_buttons("Remove Device(s)", + dialog = gtk_dialog_new_with_buttons(_("Remove Device(s)"), ctk_framelock->parent_window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -721,7 +724,7 @@ static GtkWidget *create_enable_confirm_dialog(CtkFramelock *ctk_framelock) /* Display ModeSwitch confirmation dialog */ dialog = gtk_dialog_new_with_buttons - ("Confirm ModeSwitch", + (_("Confirm ModeSwitch"), GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(ctk_framelock))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_YES, @@ -868,11 +871,11 @@ static gchar *get_display_name(nvDisplayDataPtr data, gboolean simple) } if (display_type) { - name = g_strconcat((display_name ? display_name : "Unknown Display"), + name = g_strconcat((display_name ? display_name : _("Unknown Display")), " (", display_type, ")", NULL); free(display_type); } else { - name = g_strconcat((display_name ? display_name : "Unknown Display"), + name = g_strconcat((display_name ? display_name : _("Unknown Display")), NULL); } @@ -906,13 +909,13 @@ static gchar *get_gpu_name(nvGPUDataPtr data, gboolean simple) product_name = NULL; } - snprintf(tmp, 32, " (GPU %d)", NvCtrlGetTargetId(ctrl_target)); + snprintf(tmp, 32, _(" (GPU %d)"), NvCtrlGetTargetId(ctrl_target)); if (simple) { - name = g_strconcat(product_name?product_name:"Unknown GPU", + name = g_strconcat(product_name?product_name:_("Unknown GPU"), NULL); } else { - name = g_strconcat(product_name?product_name:"Unknown GPU", + name = g_strconcat(product_name?product_name:_("Unknown GPU"), tmp, NULL); } @@ -945,7 +948,7 @@ static char *get_framelock_name(nvFrameLockDataPtr data, gboolean simple) data->board_name, NvCtrlGetTargetId(ctrl_target)); - name = g_strconcat(server_name?server_name:"Unknown X Server", tmp, NULL); + name = g_strconcat(server_name?server_name:_("Unknown X Server"), tmp, NULL); return name; } @@ -993,17 +996,17 @@ static void update_entry_label(CtkFramelock *ctk_framelock, case ENTRY_DATA_FRAMELOCK: gtk_label_set_text(GTK_LABEL (((nvFrameLockDataPtr)(entry->data))->label), - str?str:"Unknown Quadro Sync"); + str?str:_("Unknown Quadro Sync")); break; case ENTRY_DATA_GPU: gtk_label_set_text(GTK_LABEL (((nvGPUDataPtr)(entry->data))->label), - str?str:"Unknown GPU"); + str?str:_("Unknown GPU")); break; case ENTRY_DATA_DISPLAY: gtk_label_set_text(GTK_LABEL (((nvDisplayDataPtr)(entry->data))->label), - str?str:"Unknown Display"); + str?str:_("Unknown Display")); break; } @@ -1054,23 +1057,22 @@ static void show_remove_devices_dialog(GtkWidget *button, name = list_entry_get_name(entry, 0); if (!name) { - str = g_strconcat("Would you like to remove the selected entry " - "from the group?" - "\n\nNOTE: This will also remove any entries " - "under this one.", - NULL); + str = g_strdup(_("Would you like to remove the selected entry " + "from the group?" + "\n\nNOTE: This will also remove any entries " + "under this one.")); } else if (entry->nchildren) { - str = g_strconcat("Would you like to remove the following entry " - "from the group?\n\n", name, "", - "\n\nNOTE: This will also remove any entries " - "under this one.", - NULL); + str = g_strdup_printf(_("Would you like to remove the following entry " + "from the group?\n\n%s" + "\n\nNOTE: This will also remove any entries " + "under this one."), + name); } else { - str = g_strconcat("Would you like to remove the following entry " - "from the group?\n\n", name, "", - NULL); + str = g_strdup_printf(_("Would you like to remove the following entry " + "from the group?\n\n%s"), + name); } if (name) { g_free(name); @@ -1283,9 +1285,9 @@ static void list_entry_update_display_controls(CtkFramelock *ctk_framelock, ctk_config_set_tooltip(ctk_framelock->ctk_config, entry->ebox, - sensitive ? NULL : "This display device cannot be " + sensitive ? NULL : _("This display device cannot be " "included in the frame lock group since it has a " - "different refresh rate than that of the server."); + "different refresh rate than that of the server.")); /* If display cannot be a client, make sure it is not set as such */ if (!sensitive && gtk_toggle_button_get_active @@ -2579,11 +2581,11 @@ static void changed_house_sync_mode(GtkComboBox *combo_box, gpointer user_data) CtrlTarget *ctrl_target; const gchar *houseSyncStrings[] = { [NV_CTRL_USE_HOUSE_SYNC_DISABLED] = - "Disabled use of house sync signal.", + _("Disabled use of house sync signal."), [NV_CTRL_USE_HOUSE_SYNC_INPUT] = - "Enabled use of house sync input signal.", + _("Enabled use of house sync input signal."), [NV_CTRL_USE_HOUSE_SYNC_OUTPUT] = - "Enabled use of house sync output signal." + _("Enabled use of house sync output signal.") }; entry = get_framelock_server_entry(tree); @@ -2624,15 +2626,14 @@ static void toggle_extra_info(GtkWidget *widget, gpointer data) gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); gtk_button_set_label(GTK_BUTTON(widget), - enabled?"Hide Extra Info":"Show Extra Info"); + enabled?_("Hide Extra Info"):_("Show Extra Info")); update_framelock_controls(ctk_framelock); update_framelock_status(ctk_framelock); ctk_config_statusbar_message(ctk_framelock->ctk_config, - "%s extra information.", - (enabled ? "Showing" : "Hiding")); + enabled ? _("Showing extra information.") : _("Hiding extra information.")); } /** update_expand_all_button_status() ************************ @@ -2688,10 +2689,10 @@ static void update_expand_all_button_status(CtkFramelock *ctk_framelock) if (ctk_framelock->is_expanded) { gtk_button_set_label(GTK_BUTTON(ctk_framelock->expand_all_button), - "Collapse All"); + _("Collapse All")); } else { gtk_button_set_label(GTK_BUTTON(ctk_framelock->expand_all_button), - "Expand All"); + _("Expand All")); } } @@ -2833,8 +2834,7 @@ static void toggle_server(GtkWidget *widget, gpointer data) update_framelock_controls(ctk_framelock); ctk_config_statusbar_message(ctk_framelock->ctk_config, - "%s frame lock server device.", - (server_checked ? "Selected" : "Unselected")); + server_checked ? _("Selected frame lock server device.") : _("Unselected frame lock server device.")); } @@ -2894,8 +2894,7 @@ static void toggle_client(GtkWidget *widget, gpointer data) update_framelock_controls(ctk_framelock); ctk_config_statusbar_message(ctk_framelock->ctk_config, - "%s frame lock client device.", - (client_checked ? "Selected" : "Unselected")); + client_checked ? "Selected frame lock client device." : "Unselected frame lock client device."); } @@ -3006,11 +3005,13 @@ static gboolean set_enable_sync_clients(nvListEntryPtr entry_list, static void update_enable_confirm_text(CtkFramelock *ctk_framelock) { gchar *str; - str = g_strdup_printf("Frame Lock has been enabled but no server\n" - "device was selected. Would you like to keep\n" - "Frame Lock enabled on the selected devices?\n" - "\n" - "Disabling Frame Lock in %d seconds...", + str = g_strdup_printf(g_strconcat(_("Frame Lock has been enabled but no server\n" + "device was selected. Would you like to keep\n" + "Frame Lock enabled on the selected devices?\n" + "\n"), + ngettext("Disabling Frame Lock in %d second...", + "Disabling Frame Lock in %d seconds...", + ctk_framelock->enable_confirm_countdown), NULL), ctk_framelock->enable_confirm_countdown); gtk_label_set_text(GTK_LABEL(ctk_framelock->enable_confirm_text), str); g_free(str); @@ -3164,8 +3165,7 @@ static void toggle_sync_enable(GtkWidget *button, gpointer data) update_framelock_status(ctk_framelock); ctk_config_statusbar_message(ctk_framelock->ctk_config, - "Frame Lock %s.", - (enabled ? "enabled" : "disabled")); + enabled ? _("Frame Lock enabled.") : _("Frame Lock disabled.")); } @@ -3221,7 +3221,7 @@ static gint test_link_done(gpointer data) (gpointer) ctk_framelock); ctk_config_statusbar_message(ctk_framelock->ctk_config, - "Test link complete."); + _("Test link complete.")); return FALSE; } @@ -3278,7 +3278,7 @@ static void toggle_test_link(GtkWidget *button, gpointer data) NV_CTRL_FRAMELOCK_TEST_SIGNAL_ENABLE); ctk_config_statusbar_message(ctk_framelock->ctk_config, - "Test link started."); + _("Test link started.")); /* register the "done" function */ @@ -3434,8 +3434,8 @@ static gboolean detect_video_mode_timer(gpointer user_data) ctk_config_statusbar_message (ctk_framelock->ctk_config, - "House sync format detected as %s.", - houseFormatStrings[ctk_framelock->current_detect_format]); + _("House sync format detected as %s."), + _(houseFormatStrings[ctk_framelock->current_detect_format])); goto done; } @@ -3465,7 +3465,7 @@ static gboolean detect_video_mode_timer(gpointer user_data) ctk_framelock->current_detect_format = NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_AUTO; ctk_config_statusbar_message(ctk_framelock->ctk_config, - "Unable to detect house sync format."); + _("Unable to detect house sync format.")); goto done; break; } @@ -3532,7 +3532,7 @@ static void toggle_detect_video_mode(GtkToggleButton *button, ctk_framelock->video_mode_detect_timer = 0; ctk_config_statusbar_message(ctk_framelock->ctk_config, - "Aborted house sync detection."); + _("Aborted house sync detection.")); return; } @@ -3550,7 +3550,7 @@ static void toggle_detect_video_mode(GtkToggleButton *button, g_timeout_add(500, detect_video_mode_timer, user_data); ctk_config_statusbar_message(ctk_framelock->ctk_config, - "Attempting to detect house sync..."); + _("Attempting to detect house sync...")); } @@ -3638,7 +3638,7 @@ static void list_entry_update_framelock_status(CtkFramelock *ctk_framelock, if (ret == NvCtrlSuccess) { snprintf(str, 32, "%d.%.4d Hz", (rate / 10000), (rate % 10000)); } else { - snprintf(str, 32, "Unknown"); + snprintf(str, 32, _("Unknown")); } gtk_label_set_text(GTK_LABEL(data->house_sync_rate_text), str); @@ -3909,13 +3909,13 @@ static gboolean check_for_ethernet(gpointer user_data) if (error_data) { if (first_error) { - error_msg(ctk_framelock, "Frame Lock RJ45 error\n\n" "Either an Ethernet LAN cable is connected to the " "frame lock board on X Server '%s' or the linked " "PC is not turned on. Either disconnect the LAN " "cable or turn on the linked PC for proper " - "operation.", + "operation."), NvCtrlGetDisplayName(error_data->ctrl_target)); } first_error = FALSE; @@ -3942,8 +3942,8 @@ static void show_house_sync_output_warning_dlg(CtkFramelock *ctk_framelock, gint GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "An incoming house sync signal of %d.%.4d Hz is present; setting House " - "Sync Mode to Output will have no effect.", + _("An incoming house sync signal of %d.%.4d Hz is present; setting House " + "Sync Mode to Output will have no effect."), (rate / 10000), (rate % 10000)); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy (dlg); @@ -4102,7 +4102,7 @@ static void update_house_sync_controls(CtkFramelock *ctk_framelock) GTK_COMBO_BOX(ctk_framelock->video_mode_widget), house_format); } else { gtk_label_set_text(GTK_LABEL(ctk_framelock->video_mode_widget), - houseFormatStrings[house_format]); + _(houseFormatStrings[house_format])); } } @@ -4131,7 +4131,7 @@ static void update_display_rate_txt(nvDisplayDataPtr data, } snprintf(str, 32, "%.*f Hz%s", precision, fvalue, - data->hdmi3D ? " (Doubled for HDMI 3D)" : ""); + data->hdmi3D ? _(" (Doubled for HDMI 3D)") : ""); gtk_label_set_text(GTK_LABEL(data->rate_text), str); } @@ -4459,8 +4459,8 @@ static void gpu_state_received(GObject *object, ctk_config_statusbar_message(ctk_framelock->ctk_config, (ctk_framelock->test_link_enabled ? - "Test link started." : - "Test link complete.")); + _("Test link started.") : + _("Test link complete."))); break; default: @@ -4587,7 +4587,7 @@ static void framelock_state_received(GObject *object, (gpointer) ctk_framelock); } else { gtk_label_set_text(GTK_LABEL(ctk_framelock->video_mode_widget), - houseFormatStrings[house_format]); + _(houseFormatStrings[house_format])); } break; @@ -4734,11 +4734,11 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, banner = ctk_banner_image_new(BANNER_ARTWORK_FRAMELOCK); gtk_box_pack_start(GTK_BOX(ctk_framelock), banner, FALSE, FALSE, 0); - string = "The firmware on this Quadro Sync " + string = _("The firmware on this Quadro Sync " "card \n is not compatible with the GPUs connected to it.\n\n" "Please visit " "\n " - "for instructions on installing the correct firmware."; + "for instructions on installing the correct firmware."); ctk_framelock->warn_dialog = gtk_message_dialog_new (GTK_WINDOW(parent_window), @@ -4793,60 +4793,60 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, /* create buttons */ - button = my_button_new_with_label("Add Devices...", 15, 0); + button = my_button_new_with_label(_("Add Devices..."), 15, 0); g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_show_all), (gpointer) ctk_framelock->add_devices_dialog); - ctk_config_set_tooltip(ctk_config, button, __add_devices_button_help); + ctk_config_set_tooltip(ctk_config, button, _(__add_devices_button_help)); ctk_framelock->add_devices_button = button; - button = my_button_new_with_label("Remove Devices...", 15, 0); + button = my_button_new_with_label(_("Remove Devices..."), 15, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(show_remove_devices_dialog), G_OBJECT(ctk_framelock)); ctk_config_set_tooltip(ctk_config, button, - __remove_devices_button_help); + _(__remove_devices_button_help)); ctk_framelock->remove_devices_button = button; - button = my_toggle_button_new_with_label("Short Names", 15, 0); + button = my_toggle_button_new_with_label(_("Short Names"), 15, 0); // g_signal_connect(G_OBJECT(button), // "toggled", G_CALLBACK(toggle_short_names), // G_OBJECT(ctk_framelock)); ctk_framelock->short_labels_button = button; - button = my_toggle_button_new_with_label("Show Extra Info", 15, 0); + button = my_toggle_button_new_with_label(_("Show Extra Info"), 15, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggle_extra_info), (gpointer) ctk_framelock); ctk_config_set_tooltip(ctk_config, button, - __show_extra_info_button_help); + _(__show_extra_info_button_help)); ctk_framelock->extra_info_button = button; - button = my_button_new_with_label("Expand All", 15, 0); + button = my_button_new_with_label(_("Expand All"), 15, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(expand_all_clicked), (gpointer) ctk_framelock); ctk_config_set_tooltip(ctk_config, button, - __expand_all_button_help); + _(__expand_all_button_help)); ctk_framelock->expand_all_button = button; - button = my_toggle_button_new_with_label("Detect", 15, 0); + button = my_toggle_button_new_with_label(_("Detect"), 15, 0); g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggle_detect_video_mode), G_OBJECT(ctk_framelock)); ctk_config_set_tooltip(ctk_config, button, - __detect_video_mode_button_help); + _(__detect_video_mode_button_help)); ctk_framelock->video_mode_detect = button; - button = my_toggle_button_new_with_label("Test Link", 15, 0); + button = my_toggle_button_new_with_label(_("Test Link"), 15, 0); gtk_widget_set_sensitive(button, FALSE); g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggle_test_link), G_OBJECT(ctk_framelock)); ctk_config_set_tooltip(ctk_config, button, - __test_link_button_help); + _(__test_link_button_help)); ctk_framelock->test_link_button = button; @@ -4855,7 +4855,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggle_sync_enable), G_OBJECT(ctk_framelock)); - ctk_config_set_tooltip(ctk_config, button, __sync_enable_button_help); + ctk_config_set_tooltip(ctk_config, button, _(__sync_enable_button_help)); ctk_framelock->sync_state_button = button; /* Create combo boxes */ @@ -4873,13 +4873,13 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, if (!ctk_framelock->video_mode_read_only) { combo_box = ctk_combo_box_text_new(); ctk_combo_box_text_append_text(combo_box, - houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_AUTO]); + _(houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_AUTO])); ctk_combo_box_text_append_text(combo_box, - houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_TTL]); + _(houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_TTL])); ctk_combo_box_text_append_text(combo_box, - houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_BI_LEVEL]); + _(houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_BI_LEVEL])); ctk_combo_box_text_append_text(combo_box, - houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_TRI_LEVEL]); + _(houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_TRI_LEVEL])); gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0); @@ -4888,10 +4888,10 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, (gpointer) ctk_framelock); ctk_framelock->video_mode_widget = combo_box; } else { - ctk_framelock->video_mode_widget = gtk_label_new("None"); + ctk_framelock->video_mode_widget = gtk_label_new(_("None")); } ctk_config_set_tooltip(ctk_config, ctk_framelock->video_mode_widget, - __video_mode_help); + _(__video_mode_help)); ret = NvCtrlGetValidAttributeValues(ctrl_target, NV_CTRL_USE_HOUSE_SYNC, @@ -4904,10 +4904,10 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, } combo_box = ctk_combo_box_text_new(); - ctk_combo_box_text_append_text(combo_box, "Disabled"); - ctk_combo_box_text_append_text(combo_box, "Input"); + ctk_combo_box_text_append_text(combo_box, _("Disabled")); + ctk_combo_box_text_append_text(combo_box, _("Input")); if (ctk_framelock->house_sync_output_supported) { - ctk_combo_box_text_append_text(combo_box, "Output"); + ctk_combo_box_text_append_text(combo_box, _("Output")); } gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), @@ -4917,16 +4917,16 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, "changed", G_CALLBACK(changed_house_sync_mode), (gpointer) ctk_framelock); ctk_config_set_tooltip(ctk_config, combo_box, - __house_sync_mode_combo_help); + _(__house_sync_mode_combo_help)); ctk_framelock->house_sync_mode_combo = combo_box; combo_box = ctk_combo_box_text_new(); ctk_combo_box_text_append_text(combo_box, - syncEdgeStrings[NV_CTRL_FRAMELOCK_POLARITY_RISING_EDGE]); + _(syncEdgeStrings[NV_CTRL_FRAMELOCK_POLARITY_RISING_EDGE])); ctk_combo_box_text_append_text(combo_box, - syncEdgeStrings[NV_CTRL_FRAMELOCK_POLARITY_FALLING_EDGE]); + _(syncEdgeStrings[NV_CTRL_FRAMELOCK_POLARITY_FALLING_EDGE])); ctk_combo_box_text_append_text(combo_box, - syncEdgeStrings[NV_CTRL_FRAMELOCK_POLARITY_BOTH_EDGES]); + _(syncEdgeStrings[NV_CTRL_FRAMELOCK_POLARITY_BOTH_EDGES])); gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0); @@ -4934,7 +4934,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, "changed", G_CALLBACK(changed_sync_edge), (gpointer) ctk_framelock); ctk_config_set_tooltip(ctk_config, combo_box, - __sync_edge_combo_help); + _(__sync_edge_combo_help)); ctk_framelock->sync_edge_combo = combo_box; @@ -4973,7 +4973,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, /* Quadro Sync Frame */ frame = gtk_frame_new(NULL); - gtk_frame_set_label(GTK_FRAME(frame), "Quadro Sync Devices"); + gtk_frame_set_label(GTK_FRAME(frame), _("Quadro Sync Devices")); gtk_box_pack_start(GTK_BOX(ctk_framelock), frame, TRUE, TRUE, 0); /* scrollable window */ @@ -5020,7 +5020,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, frame = gtk_frame_new(NULL); ctk_framelock->house_sync_frame = frame; - gtk_frame_set_label(GTK_FRAME(frame), "House Sync"); + gtk_frame_set_label(GTK_FRAME(frame), _("House Sync")); gtk_box_pack_start(GTK_BOX(ctk_framelock), frame, FALSE, FALSE, 0); padding = gtk_hbox_new(FALSE, 5); @@ -5040,7 +5040,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, { GtkWidget *frame2 = gtk_frame_new(NULL); hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("House Sync Mode:"); + label = gtk_label_new(_("House Sync Mode:")); ctk_framelock->house_sync_mode_frame = frame2; @@ -5083,7 +5083,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, } hbox = gtk_hbox_new(FALSE, 5); - label = gtk_label_new("Sync Interval:"); + label = gtk_label_new(_("Sync Interval:")); adjustment = GTK_ADJUSTMENT(gtk_adjustment_new(val, valid.range.min, valid.range.max, @@ -5100,7 +5100,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, g_signal_connect(G_OBJECT(scale), "value-changed", G_CALLBACK(sync_interval_changed), (gpointer) ctk_framelock); - ctk_config_set_tooltip(ctk_config, scale, __sync_interval_scale_help); + ctk_config_set_tooltip(ctk_config, scale, _(__sync_interval_scale_help)); ctk_framelock->sync_interval_frame = frame2; ctk_framelock->sync_interval_scale = scale; @@ -5115,7 +5115,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, { GtkWidget *frame2 = gtk_frame_new(NULL); hbox = gtk_hbox_new(FALSE, 5); - label = gtk_label_new("Sync Edge:"); + label = gtk_label_new(_("Sync Edge:")); ctk_framelock->sync_edge_frame = frame2; @@ -5131,7 +5131,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, { GtkWidget *frame2 = gtk_frame_new(NULL); hbox = gtk_hbox_new(FALSE, 5); - label = gtk_label_new("Video Mode:"); + label = gtk_label_new(_("Video Mode:")); ctk_framelock->video_mode_frame = frame2; @@ -5170,7 +5170,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, /* register a timer callback to update the status of the page */ - string = g_strdup_printf("Frame Lock Connection Status (Screen %u)", + string = g_strdup_printf(_("Frame Lock Connection Status (Screen %u)"), NvCtrlGetTargetId(ctrl_target)); ctk_config_add_timer(ctk_config, DEFAULT_UPDATE_STATUS_TIME_INTERVAL, @@ -5182,7 +5182,7 @@ GtkWidget* ctk_framelock_new(CtrlTarget *ctrl_target, /* register a timer callback to check the rj45 ports */ - string = g_strdup_printf("Frame Lock RJ45 Check (Screen %u)", + string = g_strdup_printf(_("Frame Lock RJ45 Check (Screen %u)"), NvCtrlGetTargetId(ctrl_target)); ctk_config_add_timer(ctk_config, DEFAULT_CHECK_FOR_ETHERNET_TIME_INTERVAL, @@ -5268,7 +5268,7 @@ static void add_devices_response(GtkWidget *button, gint response, /* Update status bar */ ctk_config_statusbar_message(ctk_framelock->ctk_config, - "Added X server '%s'.", display_name); + _("Added X server '%s'."), display_name); } @@ -5318,7 +5318,7 @@ static void remove_devices_response(GtkWidget *button, gint response, /* Update status bar */ ctk_config_statusbar_message(ctk_framelock->ctk_config, - "Removed '%s' from the frame lock group.", + _("Removed '%s' from the frame lock group."), name); g_free(name); } @@ -5361,22 +5361,22 @@ static void add_display_device(CtkFramelock *ctk_framelock, display_data->label = gtk_label_new(""); - display_data->server_label = gtk_label_new("Server"); + display_data->server_label = gtk_label_new(_("Server")); display_data->server_checkbox = gtk_check_button_new(); ctk_config_set_tooltip(ctk_framelock->ctk_config, display_data->server_checkbox, - __server_checkbox_help); + _(__server_checkbox_help)); - display_data->client_label = gtk_label_new("Client"); + display_data->client_label = gtk_label_new(_("Client")); display_data->client_checkbox = gtk_check_button_new(); ctk_config_set_tooltip(ctk_framelock->ctk_config, display_data->client_checkbox, - __client_checkbox_help); + _(__client_checkbox_help)); - display_data->rate_label = gtk_label_new("Refresh:"); + display_data->rate_label = gtk_label_new(_("Refresh:")); display_data->rate_text = gtk_label_new(""); - display_data->stereo_label = gtk_label_new("Stereo"); + display_data->stereo_label = gtk_label_new(_("Stereo")); display_data->stereo_hbox = gtk_hbox_new(FALSE, 0); entry = list_entry_new_with_display(display_data, tree); @@ -5538,7 +5538,7 @@ static void add_gpu_devices(CtkFramelock *ctk_framelock, gpu_data->ctrl_target = ctrl_target; gpu_data->label = gtk_label_new(""); - gpu_data->timing_label = gtk_label_new("Timing"); + gpu_data->timing_label = gtk_label_new(_("Timing")); gpu_data->timing_hbox = gtk_hbox_new(FALSE, 0); /* Create the GPU list entry */ @@ -5674,30 +5674,30 @@ static void add_framelock_devices(CtkFramelock *ctk_framelock, /* Create the frame lock widgets */ framelock_data->label = gtk_label_new(""); - framelock_data->receiving_label = gtk_label_new("Receiving"); + framelock_data->receiving_label = gtk_label_new(_("Receiving")); framelock_data->receiving_hbox = gtk_hbox_new(FALSE, 0); - framelock_data->rate_label = gtk_label_new("Rate:"); + framelock_data->rate_label = gtk_label_new(_("Rate:")); framelock_data->rate_text = gtk_label_new(""); - framelock_data->delay_label = gtk_label_new("Delay:"); + framelock_data->delay_label = gtk_label_new(_("Delay:")); framelock_data->delay_text = gtk_label_new(""); - framelock_data->house_label = gtk_label_new("House"); + framelock_data->house_label = gtk_label_new(_("House")); framelock_data->house_hbox = gtk_hbox_new(FALSE, 0); framelock_data->house_sync_rate_label = - gtk_label_new("House Sync Rate:"); + gtk_label_new(_("House Sync Rate:")); framelock_data->house_sync_rate_text = gtk_label_new(""); - framelock_data->port0_label = gtk_label_new("Port 0"); + framelock_data->port0_label = gtk_label_new(_("Port 0")); framelock_data->port0_hbox = gtk_hbox_new(FALSE, 0); - framelock_data->port1_label = gtk_label_new("Port 1"); + framelock_data->port1_label = gtk_label_new(_("Port 1")); framelock_data->port1_hbox = gtk_hbox_new(FALSE, 0); framelock_data->firmware_version_label = - gtk_label_new("Firmware Version:"); + gtk_label_new(_("Firmware Version:")); framelock_data->firmware_version_text = gtk_label_new(firmware_version_str); g_free(firmware_version_str); @@ -5764,9 +5764,9 @@ static void add_devices(CtkFramelock *ctk_framelock, if (!display_name || (display_name[0] == '\0')) { if (error_dialog) { - error_msg(ctk_framelock, "" + error_msg(ctk_framelock, _("" "Unable to add X Server to frame lock group.\n\n" - "No X Server specified."); + "No X Server specified.")); } else { nv_error_msg("Unable to add X Server to frame lock group; " "no X Server specified."); @@ -5803,10 +5803,10 @@ static void add_devices(CtkFramelock *ctk_framelock, if (!system || !system->dpy) { if (error_dialog) { - error_msg(ctk_framelock, "Unable " "to add devices to frame lock group\n\nUnable to " - "connect to X Display '%s'.", server_name); + "connect to X Display '%s'."), server_name); } else { nv_error_msg("Unable to add devices to frame lock group; unable " "to connect to X Display '%s'.", server_name); @@ -5819,10 +5819,10 @@ static void add_devices(CtkFramelock *ctk_framelock, ctrl_target = NvCtrlGetDefaultTarget(system); if (ctrl_target == NULL) { if (error_dialog) { - error_msg(ctk_framelock, "Unable " "to add devices to frame lock group\n\nUnable to " - "create control target."); + "create control target.")); } else { nv_error_msg("Unable to add devices to frame lock group; unable " "create control target."); @@ -5836,11 +5836,11 @@ static void add_devices(CtkFramelock *ctk_framelock, server_id != -1 && find_server_by_id(ctk_framelock->tree, server_id)) { if (error_dialog) { - error_msg(ctk_framelock, "Unable to add X server " "to frame lock Group\n\n" "The X server %s already belongs to the frame lock " - "Group.", server_name); + "Group."), server_name); } else { nv_error_msg("Unable to add X server to frame lock group; " "the X server %s already belongs to the " @@ -5855,11 +5855,11 @@ static void add_devices(CtkFramelock *ctk_framelock, if (!ctk_framelock->tree || !((nvListTreePtr)(ctk_framelock->tree))->nentries) { if (error_dialog) { - error_msg(ctk_framelock, "No frame lock devices " "found on server.\n\n" "This X Server does not support frame lock or " - "no frame lock devices were available."); + "no frame lock devices were available.")); } else { nv_error_msg("No frame lock devices found on server; " "This X Server does not support frame lock or " @@ -6105,136 +6105,136 @@ GtkTextBuffer *ctk_framelock_create_help(GtkTextTagTable *table) gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "Frame Lock Help"); + ctk_help_title(b, &i, _("Frame Lock Help")); - ctk_help_para(b, &i, "The frame lock control page provides a way to " + ctk_help_para(b, &i, _("The frame lock control page provides a way to " "manage an entire cluster of workstations in a frame lock " - "group."); + "group.")); /* Quadro Sync Frame Help */ - ctk_help_heading(b, &i, "Quadro Sync Section"); - ctk_help_para(b, &i, "The Quadro Sync section allows you to configure the " - "individual devices that make up the frame lock group."); + ctk_help_heading(b, &i, _("Quadro Sync Section")); + ctk_help_para(b, &i, _("The Quadro Sync section allows you to configure the " + "individual devices that make up the frame lock group.")); - ctk_help_heading(b, &i, "Quadro Sync Device Entry Information"); - ctk_help_para(b, &i, "Quadro Sync (frame lock board) device entries " - "display the following information:"); - ctk_help_para(b, &i, "The X server name and Quadro Sync board ID."); - ctk_help_para(b, &i, "Receiving LED: This indicates whether the frame " + ctk_help_heading(b, &i, _("Quadro Sync Device Entry Information")); + ctk_help_para(b, &i, _("Quadro Sync (frame lock board) device entries " + "display the following information:")); + ctk_help_para(b, &i, _("The X server name and Quadro Sync board ID.")); + ctk_help_para(b, &i, _("Receiving LED: This indicates whether the frame " "lock board is receiving a sync pulse. Green means a " "signal is detected; red means a signal is not detected. " "The sync pulse can come from one of the following sources: " "The House Sync signal, an external signal from another " "frame lock device coming into Port0/Port1, or the internal " - "timing from the primary GPU's display device"); - ctk_help_para(b, &i, "Rate Information: This is the sync rate that the " - "frame lock board is receiving."); - ctk_help_para(b, &i, "House LED: This indicates whether the frame lock " + "timing from the primary GPU's display device")); + ctk_help_para(b, &i, _("Rate Information: This is the sync rate that the " + "frame lock board is receiving.")); + ctk_help_para(b, &i, _("House LED: This indicates whether the frame lock " "board is receiving synchronization from the house (BNC) " "connector. This LED mirrors the status of the BNC LED on " - "the backplane of the frame lock board."); - ctk_help_para(b, &i, "Port0, Port1 Images: These indicate the status of " + "the backplane of the frame lock board.")); + ctk_help_para(b, &i, _("Port0, Port1 Images: These indicate the status of " "the RJ45 ports on the backplane of the frame lock board. " "Green LEDs indicate that the port is configured for " "input, while yellow LEDs indicate that the port is " - "configured for output."); - ctk_help_para(b, &i, "Delay Information: The sync delay (in microseconds) " - "between the frame lock pulse and the GPU pulse."); + "configured for output.")); + ctk_help_para(b, &i, _("Delay Information: The sync delay (in microseconds) " + "between the frame lock pulse and the GPU pulse.")); - ctk_help_heading(b, &i, "GPU Device Entry Information"); - ctk_help_para(b, &i, "GPU Device entries display the GPU name and number " + ctk_help_heading(b, &i, _("GPU Device Entry Information")); + ctk_help_para(b, &i, _("GPU Device entries display the GPU name and number " "of a GPU connected to a Quadro Sync device. Display " - "devices driven by the GPU will be listed under this entry."); - ctk_help_para(b, &i, "Timing LED: This indicates that the GPU " + "devices driven by the GPU will be listed under this entry.")); + ctk_help_para(b, &i, _("Timing LED: This indicates that the GPU " "is synchronized with the incoming timing signal from the " - "Quadro Sync device"); + "Quadro Sync device")); - ctk_help_heading(b, &i, "Display Device Entry Information"); - ctk_help_para(b, &i, "Display Device entries display information and " + ctk_help_heading(b, &i, _("Display Device Entry Information")); + ctk_help_para(b, &i, _("Display Device entries display information and " "configuration options for configuring how the display " "device should behave in the frame lock group. Setting of " "options is only available while frame lock is disabled. " - "The following options are available:"); - ctk_help_para(b, &i, "%s", __server_checkbox_help); - ctk_help_para(b, &i, "%s", __client_checkbox_help); - ctk_help_para(b, &i, "Stereo LED: This indicates whether or not the " + "The following options are available:")); + ctk_help_para(b, &i, "%s", _(__server_checkbox_help)); + ctk_help_para(b, &i, "%s", _(__client_checkbox_help)); + ctk_help_para(b, &i, _("Stereo LED: This indicates whether or not the " "display device is synced to the stereo signal coming from " "the Quadro Sync device. This LED is only available to " "display devices set as clients when frame lock is enabled. " "The Stereo LED is dependent on the parent GPU being in sync " - "with the input timing signal."); + "with the input timing signal.")); - ctk_help_heading(b, &i, "Adding Devices"); - ctk_help_para(b, &i, "%s", __add_devices_button_help); - ctk_help_para(b, &i, "If the X Server is remote, be sure you have " + ctk_help_heading(b, &i, _("Adding Devices")); + ctk_help_para(b, &i, "%s", _(__add_devices_button_help)); + ctk_help_para(b, &i, _("If the X Server is remote, be sure you have " "configured remote access (via `xhost`, for example) " - "such that you are allowed to establish a connection."); + "such that you are allowed to establish a connection.")); - ctk_help_heading(b, &i, "Removing Devices"); - ctk_help_para(b, &i, "%s", __remove_devices_button_help); + ctk_help_heading(b, &i, _("Removing Devices")); + ctk_help_para(b, &i, "%s", _(__remove_devices_button_help)); /* House Sync Frame Help */ - ctk_help_heading(b, &i, "House Sync Section"); - ctk_help_para(b, &i, "The House Sync section allows you to configure " + ctk_help_heading(b, &i, _("House Sync Section")); + ctk_help_para(b, &i, _("The House Sync section allows you to configure " "the selected server Quadro Sync board for using an incoming " "house sync signal instead of internal GPU timings. On " "Quadro Sync II boards, you can configure the board to " "generate an outgoing house sync signal from the internal " "GPU timings. This section is only accessible by selecting " "a server display device (See Display Device Information " - "above."); + "above.")); - ctk_help_heading(b, &i, "Use House Sync on Server"); - ctk_help_para(b, &i, "%s", __house_sync_mode_combo_help); - ctk_help_para(b, &i, "If this option is set to Input and no house signal " + ctk_help_heading(b, &i, _("Use House Sync on Server")); + ctk_help_para(b, &i, "%s", _(__house_sync_mode_combo_help)); + ctk_help_para(b, &i, _("If this option is set to Input and no house signal " "is detected (House LED is red), the Quadro Sync device " "will fall back to using internal timings from the primary " - "GPU."); + "GPU.")); - ctk_help_heading(b, &i, "Sync Interval"); - ctk_help_para(b, &i, "%s", __sync_interval_scale_help); + ctk_help_heading(b, &i, _("Sync Interval")); + ctk_help_para(b, &i, "%s", _(__sync_interval_scale_help)); - ctk_help_heading(b, &i, "Sync Edge"); - ctk_help_para(b, &i, "%s", __sync_edge_combo_help); - ctk_help_para(b, &i, "Syncing to the rising (leading) edge should be " + ctk_help_heading(b, &i, _("Sync Edge")); + ctk_help_para(b, &i, "%s", _(__sync_edge_combo_help)); + ctk_help_para(b, &i, _("Syncing to the rising (leading) edge should be " "suitable for bi-level and TTL signals. Syncing to the " "falling edge should be used for tri-level signals. " "Syncing to both edges should only be needed for TTL " "signals that have problems syncing to the rising edge " - "only."); + "only.")); - ctk_help_heading(b, &i, "Video Mode"); - ctk_help_para(b, &i, "%s", __video_mode_help); + ctk_help_heading(b, &i, _("Video Mode")); + ctk_help_para(b, &i, "%s", _(__video_mode_help)); - ctk_help_heading(b, &i, "Video Mode Detect"); - ctk_help_para(b, &i, "%s", __detect_video_mode_button_help); + ctk_help_heading(b, &i, _("Video Mode Detect")); + ctk_help_para(b, &i, "%s", _(__detect_video_mode_button_help)); /* Button Help */ - ctk_help_heading(b, &i, "Test Link"); - ctk_help_para(b, &i, "Use this toggle button to enable testing of " + ctk_help_heading(b, &i, _("Test Link")); + ctk_help_para(b, &i, _("Use this toggle button to enable testing of " "the cabling between all members of the frame lock group. " "This will cause all frame lock boards to receive a sync " "pulse, but the GPUs will not lock to the frame lock " "pulse. When Test Link is enabled, no other settings may " - "be changed until you disable Test Link."); + "be changed until you disable Test Link.")); - ctk_help_heading(b, &i, "Enable Frame Lock"); - ctk_help_para(b, &i, "%s", __sync_enable_button_help); - ctk_help_para(b, &i, "Only devices selected as clients or server will be " - "enabled."); + ctk_help_heading(b, &i, _("Enable Frame Lock")); + ctk_help_para(b, &i, "%s", _(__sync_enable_button_help)); + ctk_help_para(b, &i, _("Only devices selected as clients or server will be " + "enabled.")); /* Misc Help */ - ctk_help_heading(b, &i, "Miscellaneous"); - ctk_help_para(b, &i, "The frame lock control page registers several " + ctk_help_heading(b, &i, _("Miscellaneous")); + ctk_help_para(b, &i, _("The frame lock control page registers several " "timers that are executed periodically; these are listed " "in the 'Active Timers' section of the 'nvidia-settings " "Configuration' page. Most notably is the 'Frame Lock " "Connection Status' timer: this will poll all members of " - "the frame lock group for status information."); + "the frame lock group for status information.")); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkglx.c b/src/gtk+-2.x/ctkglx.c index 7f1e4de2..e7fbaa91 100644 --- a/src/gtk+-2.x/ctkglx.c +++ b/src/gtk+-2.x/ctkglx.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -34,6 +35,8 @@ #include /* GLX #defines */ +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING /* Number of FBConfigs attributes reported in gui */ #define NUM_FBCONFIG_ATTRIBS 32 @@ -42,179 +45,179 @@ /* FBConfig tooltips */ static const char * __show_fbc_help = - "Show the GLX Frame Buffer Configurations table in a new window."; + N_("Show the GLX Frame Buffer Configurations table in a new window."); static const char * __show_egl_fbc_help = - "Show the EGL Frame Buffer Configurations table in a new window."; + N_("Show the EGL Frame Buffer Configurations table in a new window."); static const char * __fid_help = - "fid (Frame buffer ID) - Frame Buffer Configuration ID."; + N_("fid (Frame buffer ID) - Frame Buffer Configuration ID."); static const char * __vid_help = - "vid (XVisual ID) - ID of the associated X Visual."; + N_("vid (XVisual ID) - ID of the associated X Visual."); static const char * __vt_help = - "vt (XVisual Type) - Type of the associated X Visual. " + N_("vt (XVisual Type) - Type of the associated X Visual. " "Possible X visual types are 'tc', 'dc', 'pc', 'sc', 'gs', 'sg' and '.' " "which mean TrueColor, DirectColor, PseudoColor, StaticColor, GrayScale, " - "StaticGray and None, respectively."; + "StaticGray and None, respectively."); static const char * __bfs_help = - "bfs (buffer size) - Number of bits per color in the color buffer."; + N_("bfs (buffer size) - Number of bits per color in the color buffer."); static const char * __lvl_help = - "lvl (level) - Frame buffer level. Level zero is the default frame " + N_("lvl (level) - Frame buffer level. Level zero is the default frame " "buffer. Positive levels are the overlay frame buffers (on top of the " "default frame buffer). Negative levels are the underlay frame buffers " - "(under the default frame buffer)."; + "(under the default frame buffer)."); static const char * __bf_help = - "bf (Buffer format) - Color buffer format. 'rgb' means each element of the " + N_("bf (Buffer format) - Color buffer format. 'rgb' means each element of the " "pixel buffer holds red, green, blue, and alpha values. 'ci' means each " "element of the pixel buffer holds a color index value, where the actual " - "color is defined by a color map."; + "color is defined by a color map."); static const char * __db_help = - "db (Double buffer) - 'y' if the configuration has front and back color " - "buffers that are swappable. '-' if this is not supported."; + N_("db (Double buffer) - 'y' if the configuration has front and back color " + "buffers that are swappable. '-' if this is not supported."); static const char * __st_help = - "st (Stereo buffer) - 'y' if the configuration has left and right color " - "buffers that are rendered to in stereo. '-' if this is not supported."; + N_("st (Stereo buffer) - 'y' if the configuration has left and right color " + "buffers that are rendered to in stereo. '-' if this is not supported."); static const char * __rs_help = - "rs (Red size) - Number of bits per color used for red. " - "Undefined for configurations that use color indexing."; + N_("rs (Red size) - Number of bits per color used for red. " + "Undefined for configurations that use color indexing."); static const char * __gs_help = - "gs (Green size) - Number of bits per color used for green. " - "Undefined for configurations that use color indexing."; + N_("gs (Green size) - Number of bits per color used for green. " + "Undefined for configurations that use color indexing."); static const char * __bs_help = - "bs (Blue size) - Number of bits per color used for blue. " - "Undefined for configurations that use color indexing."; + N_("bs (Blue size) - Number of bits per color used for blue. " + "Undefined for configurations that use color indexing."); static const char * __as_help = - "as (Alpha size) - Number of bits per color used for alpha. " - "Undefined for configurations that use color indexing."; + N_("as (Alpha size) - Number of bits per color used for alpha. " + "Undefined for configurations that use color indexing."); static const char * __aux_help = - "aux (Auxiliary buffers) - Number of available auxiliary color buffers."; + N_("aux (Auxiliary buffers) - Number of available auxiliary color buffers."); static const char * __dpt_help = - "dpt (Depth buffer size) - Number of bits per color in the depth buffer."; + N_("dpt (Depth buffer size) - Number of bits per color in the depth buffer."); static const char * __stn_help = - "stn (Stencil size) - Number of bits per element in the stencil buffer."; + N_("stn (Stencil size) - Number of bits per element in the stencil buffer."); static const char * __acr_help = - "acr (Accumulator red size) - Number of bits per color used for red " - "in the accumulator buffer."; + N_("acr (Accumulator red size) - Number of bits per color used for red " + "in the accumulator buffer."); static const char * __acg_help = - "acg (Accumulator green size) - Number of bits per color used for green " - "in the accumulator buffer."; + N_("acg (Accumulator green size) - Number of bits per color used for green " + "in the accumulator buffer."); static const char * __acb_help = - "acb (Accumulator blue size) - Number of bits per color used for blue " - "in the accumulator buffer."; + N_("acb (Accumulator blue size) - Number of bits per color used for blue " + "in the accumulator buffer."); static const char * __aca_help = - "aca (Accumulator alpha size) - Number of bits per color used for alpha " - "in the accumulator buffer."; + N_("aca (Accumulator alpha size) - Number of bits per color used for alpha " + "in the accumulator buffer."); static const char * __mvs_help = - "mvs (Multisample coverage samples) - Number of coverage samples per multisample."; + N_("mvs (Multisample coverage samples) - Number of coverage samples per multisample."); static const char * __mcs_help = - "mcs (Multisample color samples) - Number of color samples per multisample."; + N_("mcs (Multisample color samples) - Number of color samples per multisample."); static const char * __mb_help = - "mb (Multisample buffer count) - Number of multisample buffers."; + N_("mb (Multisample buffer count) - Number of multisample buffers."); static const char * __cav_help = - "cav (Caveats) - Caveats for this configuration. A frame buffer " + N_("cav (Caveats) - Caveats for this configuration. A frame buffer " "configuration may have the following caveats: 'NonC' if it supports " "any non-conformant visual extension. 'Slow' if it has reduced " - "performance. '-' if it has no caveats."; + "performance. '-' if it has no caveats."); static const char * __pbw_help = - "pbw (Pbuffer width) - Width of pbuffer (in hexadecimal)."; + N_("pbw (Pbuffer width) - Width of pbuffer (in hexadecimal)."); static const char * __pbh_help = - "pbh (Pbuffer height) - Height of pbuffer (in hexadecimal)."; + N_("pbh (Pbuffer height) - Height of pbuffer (in hexadecimal)."); static const char * __pbp_help = - "pbp (Pbuffer max pixels) - Max number of pixels in pbuffer (in " - "hexadecimal)."; + N_("pbp (Pbuffer max pixels) - Max number of pixels in pbuffer (in " + "hexadecimal)."); static const char * __trt_help = - "trt (Transparency type) - Type of transparency (RGBA or Index)."; + N_("trt (Transparency type) - Type of transparency (RGBA or Index)."); static const char * __trr_help = - "trr (Transparency red value) - Red value considered transparent."; + N_("trr (Transparency red value) - Red value considered transparent."); static const char * __trg_help = - "trg (Transparency green value) - Green value considered transparent."; + N_("trg (Transparency green value) - Green value considered transparent."); static const char * __trb_help = - "trb (Transparency blue value) - Blue value considered transparent."; + N_("trb (Transparency blue value) - Blue value considered transparent."); static const char * __tra_help = - "tra (Transparency alpha value) - Alpha value considered transparent."; + N_("tra (Transparency alpha value) - Alpha value considered transparent."); static const char * __tri_help = - "tri (Transparency index value) - Color index value considered transparent."; + N_("tri (Transparency index value) - Color index value considered transparent."); static const char * __egl_as_help = - "as (Alpha size) - Number of bits of alpha stored in the color buffer."; + N_("as (Alpha size) - Number of bits of alpha stored in the color buffer."); static const char * __egl_ams_help = - "ams (Alpha mask size) - Number of bits in the alpha mask buffer."; + N_("ams (Alpha mask size) - Number of bits in the alpha mask buffer."); static const char * __egl_bt_help = - "bt (Bind to Texture RGB) - 'y' if color buffers can be bound " - "to an RGB texture, '.' otherwise."; + N_("bt (Bind to Texture RGB) - 'y' if color buffers can be bound " + "to an RGB texture, '.' otherwise."); static const char * __egl_bta_help = - "bta (Bind to Texture RGBA) - 'y' if color buffers can be bound " - "to an RGBA texture, '.' otherwise."; + N_("bta (Bind to Texture RGBA) - 'y' if color buffers can be bound " + "to an RGBA texture, '.' otherwise."); static const char * __egl_bs_help = - "bs (Blue size) - Number of bits of blue stored in the color buffer."; + N_("bs (Blue size) - Number of bits of blue stored in the color buffer."); static const char * __egl_bfs_help = - "bfs (Buffer size) - Depth of the color buffer. It is the sum of 'rs', 'gs', " - "'bs', and 'as'."; + N_("bfs (Buffer size) - Depth of the color buffer. It is the sum of 'rs', 'gs', " + "'bs', and 'as'."); static const char * __egl_cbt_help = - "cbt (Color buffer type) - Type of the color buffer. Possible types are " - "'rgb' for RGB color buffer and 'lum' for Luminance."; + N_("cbt (Color buffer type) - Type of the color buffer. Possible types are " + "'rgb' for RGB color buffer and 'lum' for Luminance."); static const char * __egl_cav_help = - "cav (Config caveat) - Caveats for the frame buffer configuration. Possible " + N_("cav (Config caveat) - Caveats for the frame buffer configuration. Possible " "caveat values are 'slo' for Slow Config, 'NoC' for a non-conformant " - "config, and '.' otherwise."; + "config, and '.' otherwise."); static const char * __egl_id_help = - "id (Config ID) - ID of the frame buffer configuration."; + N_("id (Config ID) - ID of the frame buffer configuration."); static const char * __egl_cfm_help = - "cfm (Conformant) - Bitmask indicating which client API contexts created " - "with respect to this config are conformant."; + N_("cfm (Conformant) - Bitmask indicating which client API contexts created " + "with respect to this config are conformant."); static const char * __egl_dpt_help = - "dpt (Depth size) - Number of bits in the depth buffer."; + N_("dpt (Depth size) - Number of bits in the depth buffer."); static const char * __egl_gs_help = - "gs (Green size) - Number of bits of green stored in the color buffer."; + N_("gs (Green size) - Number of bits of green stored in the color buffer."); static const char * __egl_lvl_help = - "lvl (Frame buffer level) - Level zero is the default frame buffer. Positive " + N_("lvl (Frame buffer level) - Level zero is the default frame buffer. Positive " "levels correspond to frame buffers that overlay the default buffer and " "negative levels correspond to frame buffers that underlay the default " - "buffer."; + "buffer."); static const char * __egl_lum_help = - "lum (Luminance size) - Number of bits of luminance stored in the luminance " - "buffer."; + N_("lum (Luminance size) - Number of bits of luminance stored in the luminance " + "buffer."); static const char * __egl_pbw_help = - "pbw (Pbuffer max width) - Maximum width of a pixel buffer surface in " - "pixels."; + N_("pbw (Pbuffer max width) - Maximum width of a pixel buffer surface in " + "pixels."); static const char * __egl_pbh_help = - "pdh (Pbuffer max height) - Maximum height of a pixel buffer surface in " - "pixels."; + N_("pdh (Pbuffer max height) - Maximum height of a pixel buffer surface in " + "pixels."); static const char * __egl_pbp_help = - "pbp (Pbuffer max pixels) - Maximum size of a pixel buffer surface in " - "pixels."; + N_("pbp (Pbuffer max pixels) - Maximum size of a pixel buffer surface in " + "pixels."); static const char * __egl_six_help = - "six (Swap interval max) - Maximum value that can be passed to " - "eglSwapInterval."; + N_("six (Swap interval max) - Maximum value that can be passed to " + "eglSwapInterval."); static const char * __egl_sin_help = - "sin (Swap interval min) - Minimum value that can be passed to " - "eglSwapInterval."; + N_("sin (Swap interval min) - Minimum value that can be passed to " + "eglSwapInterval."); static const char * __egl_nrd_help = - "nrd (Native renderable) - 'y' if native rendering APIs can " - "render into the surface, '.' otherwise."; + N_("nrd (Native renderable) - 'y' if native rendering APIs can " + "render into the surface, '.' otherwise."); static const char * __egl_vid_help = - "vid (Native visual ID) - ID of the associated native visual."; + N_("vid (Native visual ID) - ID of the associated native visual."); static const char * __egl_nvt_help = - "nvt (Native visual type) - Type of the associated native visual."; + N_("nvt (Native visual type) - Type of the associated native visual."); static const char * __egl_rs_help = - "rs (Red size) - Number of bits of red stored in the color buffer."; + N_("rs (Red size) - Number of bits of red stored in the color buffer."); static const char * __egl_rdt_help = - "rdt (Renderable type) - Bitmask indicating the types of supported client " - "API contexts."; + N_("rdt (Renderable type) - Bitmask indicating the types of supported client " + "API contexts."); static const char * __egl_spb_help = - "spb (Sample buffers) - Number of multisample buffers."; + N_("spb (Sample buffers) - Number of multisample buffers."); static const char * __egl_smp_help = - "smp (Samples) - Number of samples per pixel."; + N_("smp (Samples) - Number of samples per pixel."); static const char * __egl_stn_help = - "stn (Stencil size) - Number of bits in the stencil buffer."; + N_("stn (Stencil size) - Number of bits in the stencil buffer."); static const char * __egl_sur_help = - "sur (Surface type) - Bitmask indicating the types of supported EGL " - "surfaces."; + N_("sur (Surface type) - Bitmask indicating the types of supported EGL " + "surfaces."); static const char * __egl_tpt_help = - "tpt (Transparent type) - Type of supported transparency. Possible " - "transparency values are: 'rgb' for Transparent RGB and '.' otherwise."; -static const char * __egl_trv_help = "trv (Transparent red value)"; -static const char * __egl_tgv_help = "tgv (Transparent green value)"; -static const char * __egl_tbv_help = "tbv (Transparent blue value)"; + N_("tpt (Transparent type) - Type of supported transparency. Possible " + "transparency values are: 'rgb' for Transparent RGB and '.' otherwise."); +static const char * __egl_trv_help = N_("trv (Transparent red value)"); +static const char * __egl_tgv_help = N_("tgv (Transparent green value)"); +static const char * __egl_tbv_help = N_("tbv (Transparent blue value)"); GType ctk_glx_get_type(void) @@ -265,9 +268,7 @@ static void show_fbc_toggled(GtkWidget *widget, gpointer user_data) } ctk_config_statusbar_message(ctk_glx->ctk_config, - "Show GLX Frame Buffer Configurations " - "button %s.", - enabled ? "enabled" : "disabled"); + enabled ? _("Show GLX Frame Buffer Configurations button enabled.") : _("Show GLX Frame Buffer Configurations button disabled.")); } /* show_fbc_toggled() */ @@ -293,9 +294,7 @@ static void show_egl_fbc_toggled(GtkWidget *widget, gpointer user_data) } ctk_config_statusbar_message(ctk_glx->ctk_config, - "Show EGL Frame Buffer Configurations " - "button %s.", - enabled ? "enabled" : "disabled"); + enabled ? _("Show EGL Frame Buffer Configurations button enabled.") : _("Show EGL Frame Buffer Configurations button disabled.")); } /* show_egl_fbc_toggled() */ @@ -739,16 +738,16 @@ GtkWidget* ctk_glx_new(CtrlTarget *ctrl_target, if (glx_fbconfigs_available) { show_fbc_button = gtk_toggle_button_new_with_label( - "Show GLX Frame Buffer Configurations"); + _("Show GLX Frame Buffer Configurations")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_fbc_button), FALSE); - ctk_config_set_tooltip(ctk_config, show_fbc_button, __show_fbc_help); + ctk_config_set_tooltip(ctk_config, show_fbc_button, _(__show_fbc_help)); g_signal_connect(G_OBJECT(show_fbc_button), "clicked", G_CALLBACK(show_fbc_toggled), (gpointer) ctk_glx); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(window), "GLX Frame Buffer " - "Configurations"); + gtk_window_set_title(GTK_WINDOW(window), _("GLX Frame Buffer " + "Configurations")); gtk_container_set_border_width(GTK_CONTAINER(window), CTK_WINDOW_PAD); gtk_window_set_default_size(GTK_WINDOW(window), 400, 200); g_signal_connect(G_OBJECT(window), "destroy-event", @@ -836,18 +835,18 @@ GtkWidget* ctk_glx_new(CtrlTarget *ctrl_target, if (egl_fbconfigs_available) { show_egl_fbc_button = gtk_toggle_button_new_with_label( - "Show EGL Frame Buffer Configurations"); + _("Show EGL Frame Buffer Configurations")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_egl_fbc_button), FALSE); ctk_config_set_tooltip(ctk_config, show_egl_fbc_button, - __show_egl_fbc_help); + _(__show_egl_fbc_help)); g_signal_connect(G_OBJECT(show_egl_fbc_button), "clicked", G_CALLBACK(show_egl_fbc_toggled), (gpointer) ctk_glx); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), - "EGL Frame Buffer Configurations"); + _("EGL Frame Buffer Configurations")); gtk_container_set_border_width(GTK_CONTAINER(window), CTK_WINDOW_PAD); gtk_window_set_default_size(GTK_WINDOW(window), 400, 200); g_signal_connect(G_OBJECT(window), "destroy-event", @@ -1060,7 +1059,7 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); /* Add (Shared) GLX information to widget */ - notebook_label = gtk_label_new("GLX"); + notebook_label = gtk_label_new(_("GLX")); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox2), notebook_padding); scroll_win = gtk_scrolled_window_new(NULL, NULL); @@ -1071,10 +1070,10 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_table_set_row_spacings(GTK_TABLE(table), 3); gtk_table_set_col_spacings(GTK_TABLE(table), 15); add_table_row(table, 0, - 0, 0, "Direct Rendering:", + 0, 0, _("Direct Rendering:"), 0, 0, direct_rendering); add_table_row(table, 1, - 0, 0, "GLX Extensions:", + 0, 0, _("GLX Extensions:"), 0, 0, glx_extensions); if (ctk_glx->show_fbc_button) { @@ -1093,7 +1092,7 @@ void ctk_glx_probe_info(GtkWidget *widget) /* Add server GLX information to widget */ - notebook_label = gtk_label_new("Server GLX"); + notebook_label = gtk_label_new(_("Server GLX")); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox2), notebook_padding); scroll_win = gtk_scrolled_window_new(NULL, NULL); @@ -1104,13 +1103,13 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_table_set_row_spacings(GTK_TABLE(table), 3); gtk_table_set_col_spacings(GTK_TABLE(table), 15); add_table_row(table, 0, - 0, 0, "Vendor:", + 0, 0, _("Vendor:"), 0, 0, server_vendor); add_table_row(table, 1, - 0, 0, "Version:", + 0, 0, _("Version:"), 0, 0, server_version); add_table_row(table, 2, - 0, 0, "Extensions:", + 0, 0, _("Extensions:"), 0, 0, server_extensions); gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0); @@ -1121,7 +1120,7 @@ void ctk_glx_probe_info(GtkWidget *widget) /* Add client GLX information to widget */ - notebook_label = gtk_label_new("Client GLX"); + notebook_label = gtk_label_new(_("Client GLX")); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox2), notebook_padding); scroll_win = gtk_scrolled_window_new(NULL, NULL); @@ -1132,13 +1131,13 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_table_set_row_spacings(GTK_TABLE(table), 3); gtk_table_set_col_spacings(GTK_TABLE(table), 15); add_table_row(table, 0, - 0, 0, "Vendor:", + 0, 0, _("Vendor:"), 0, 0, client_vendor); add_table_row(table, 1, - 0, 0, "Version:", + 0, 0, _("Version:"), 0, 0, client_version); add_table_row(table, 2, - 0, 0, "Extensions:", + 0, 0, _("Extensions:"), 0, 0, client_extensions); gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0); @@ -1149,7 +1148,7 @@ void ctk_glx_probe_info(GtkWidget *widget) /* Add OpenGL information to widget */ - notebook_label = gtk_label_new("OpenGL"); + notebook_label = gtk_label_new(_("OpenGL")); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox2), notebook_padding); scroll_win = gtk_scrolled_window_new(NULL, NULL); @@ -1160,16 +1159,16 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_table_set_row_spacings(GTK_TABLE(table), 3); gtk_table_set_col_spacings(GTK_TABLE(table), 15); add_table_row(table, 0, - 0, 0, "Vendor:", + 0, 0, _("Vendor:"), 0, 0, opengl_vendor); add_table_row(table, 1, - 0, 0, "Renderer:", + 0, 0, _("Renderer:"), 0, 0, opengl_renderer); add_table_row(table, 2, - 0, 0, "Version:", + 0, 0, _("Version:"), 0, 0, opengl_version); add_table_row(table, 3, - 0, 0, "Extensions:", + 0, 0, _("Extensions:"), 0, 0, opengl_extensions); gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0); @@ -1181,7 +1180,7 @@ void ctk_glx_probe_info(GtkWidget *widget) /* Add EGL information to widget */ if (use_egl) { - notebook_label = gtk_label_new("EGL"); + notebook_label = gtk_label_new(_("EGL")); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox2), notebook_padding); scroll_win = gtk_scrolled_window_new(NULL, NULL); @@ -1192,13 +1191,13 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_table_set_row_spacings(GTK_TABLE(table), 3); gtk_table_set_col_spacings(GTK_TABLE(table), 15); add_table_row(table, 0, - 0, 0, "Vendor:", + 0, 0, _("Vendor:"), 0, 0, egl_vendor); add_table_row(table, 1, - 0, 0, "Version:", + 0, 0, _("Version:"), 0, 0, egl_version); add_table_row(table, 2, - 0, 0, "Extensions:", + 0, 0, _("Extensions:"), 0, 0, egl_extensions); if (ctk_glx->show_egl_fbc_button) { @@ -1255,90 +1254,90 @@ GtkTextBuffer *ctk_glx_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "Graphics Information Help"); + ctk_help_title(b, &i, _("Graphics Information Help")); ctk_help_para(b, &i, - "This page in the NVIDIA X Server Control Panel describes " + _("This page in the NVIDIA X Server Control Panel describes " "information about graphics libraries available on this X " - "screen." + "screen.") ); - ctk_help_heading(b, &i, "Show GLX Frame Buffer Configurations"); - ctk_help_para(b, &i, "%s", __show_fbc_help); + ctk_help_heading(b, &i, _("Show GLX Frame Buffer Configurations")); + ctk_help_para(b, &i, "%s", _(__show_fbc_help)); - ctk_help_heading(b, &i, "Direct Rendering"); + ctk_help_heading(b, &i, _("Direct Rendering")); ctk_help_para(b, &i, - "This will tell you if direct rendering is available. If " + _("This will tell you if direct rendering is available. If " "direct rendering is available, then a program running on " "the same computer that the control panel is running on " "will be able to bypass the X Server and take advantage of " "faster rendering. If direct rendering is not available, " "then indirect rendering will be used and all rendering " - "will happen through the X Server." + "will happen through the X Server.") ); - ctk_help_heading(b, &i, "GLX Extensions"); + ctk_help_heading(b, &i, _("GLX Extensions")); ctk_help_para(b, &i, - "This is the list of GLX extensions that are supported by " + _("This is the list of GLX extensions that are supported by " "both the client (libraries) and server (GLX extension to " - "the X Server)." + "the X Server).") ); - ctk_help_heading(b, &i, "Server GLX Vendor String"); + ctk_help_heading(b, &i, _("Server GLX Vendor String")); ctk_help_para(b, &i, - "This is the vendor supplying the GLX extension running on " - "the X Server." + _("This is the vendor supplying the GLX extension running on " + "the X Server.") ); - ctk_help_heading(b, &i, "Server GLX Version String"); + ctk_help_heading(b, &i, _("Server GLX Version String")); ctk_help_para(b, &i, - "This is the version of the GLX extension running on the X " - "Server." + _("This is the version of the GLX extension running on the X " + "Server.") ); - ctk_help_heading(b, &i, "Server GLX Extensions"); + ctk_help_heading(b, &i, _("Server GLX Extensions")); ctk_help_para(b, &i, - "This is the list of extensions supported by the GLX " - "extension running on the X Server." + _("This is the list of extensions supported by the GLX " + "extension running on the X Server.") ); - ctk_help_heading(b, &i, "Client GLX Vendor String"); + ctk_help_heading(b, &i, _("Client GLX Vendor String")); ctk_help_para(b, &i, - "This is the vendor supplying the GLX libraries." + _("This is the vendor supplying the GLX libraries.") ); - ctk_help_heading(b, &i, "Client GLX Version String"); + ctk_help_heading(b, &i, _("Client GLX Version String")); ctk_help_para(b, &i, - "This is the version of the GLX libraries." + _("This is the version of the GLX libraries.") ); - ctk_help_heading(b, &i, "Client GLX Extensions"); + ctk_help_heading(b, &i, _("Client GLX Extensions")); ctk_help_para(b, &i, - "This is the list of extensions supported by the GLX " - "libraries." + _("This is the list of extensions supported by the GLX " + "libraries.") ); - ctk_help_heading(b, &i, "OpenGL Vendor String"); + ctk_help_heading(b, &i, _("OpenGL Vendor String")); ctk_help_para(b, &i, - "This is the name of the vendor providing the OpenGL " - "implementation." + _("This is the name of the vendor providing the OpenGL " + "implementation.") ); - ctk_help_heading(b, &i, "OpenGL Renderer String"); + ctk_help_heading(b, &i, _("OpenGL Renderer String")); ctk_help_para(b, &i, - "This shows the details of the graphics card on which " - "OpenGL is running." + _("This shows the details of the graphics card on which " + "OpenGL is running.") ); - ctk_help_heading(b, &i, "OpenGL Version String"); + ctk_help_heading(b, &i, _("OpenGL Version String")); ctk_help_para(b, &i, - "This is the version of the OpenGL implementation." + _("This is the version of the OpenGL implementation.") ); - ctk_help_heading(b, &i, "OpenGL Extensions"); + ctk_help_heading(b, &i, _("OpenGL Extensions")); ctk_help_para(b, &i, - "This is the list of OpenGL extensions that are supported " - "by this driver." + _("This is the list of OpenGL extensions that are supported " + "by this driver.") ); - ctk_help_heading(b, &i, "Show EGL Frame Buffer Configurations"); - ctk_help_para(b, &i, "%s", __show_egl_fbc_help); + ctk_help_heading(b, &i, _("Show EGL Frame Buffer Configurations")); + ctk_help_para(b, &i, "%s", _(__show_egl_fbc_help)); - ctk_help_heading(b, &i, "GLX Frame Buffer Configurations"); - ctk_help_para(b, &i, "This table lists the supported GLX frame buffer " - "configurations for the display."); + ctk_help_heading(b, &i, _("GLX Frame Buffer Configurations")); + ctk_help_para(b, &i, _("This table lists the supported GLX frame buffer " + "configurations for the display.")); ctk_help_para(b, &i, "\t%s\n\n" "\t%s\n\n" @@ -1375,44 +1374,44 @@ GtkTextBuffer *ctk_glx_create_help(GtkTextTagTable *table, "\t%s\n\n" "\t%s\n\n", - __fid_help, - __vid_help, - __vt_help, - __bfs_help, - __lvl_help, - __bf_help, - __db_help, - __st_help, - __rs_help, - __gs_help, - __bs_help, - - __as_help, - __aux_help, - __dpt_help, - __stn_help, - __acr_help, - __acg_help, - __acb_help, - __aca_help, - __mvs_help, - __mcs_help, - __mb_help, - - __cav_help, - __pbw_help, - __pbh_help, - __pbp_help, - __trt_help, - __trr_help, - __trg_help, - __trb_help, - __tra_help, - __tri_help + _(__fid_help), + _(__vid_help), + _(__vt_help), + _(__bfs_help), + _(__lvl_help), + _(__bf_help), + _(__db_help), + _(__st_help), + _(__rs_help), + _(__gs_help), + _(__bs_help), + + _(__as_help), + _(__aux_help), + _(__dpt_help), + _(__stn_help), + _(__acr_help), + _(__acg_help), + _(__acb_help), + _(__aca_help), + _(__mvs_help), + _(__mcs_help), + _(__mb_help), + + _(__cav_help), + _(__pbw_help), + _(__pbh_help), + _(__pbp_help), + _(__trt_help), + _(__trr_help), + _(__trg_help), + _(__trb_help), + _(__tra_help), + _(__tri_help) ); - ctk_help_heading(b, &i, "EGL Frame Buffer Configurations"); - ctk_help_para(b, &i, "This table lists the supported EGL frame buffer " - "configurations for the display."); + ctk_help_heading(b, &i, _("EGL Frame Buffer Configurations")); + ctk_help_para(b, &i, _("This table lists the supported EGL frame buffer " + "configurations for the display.")); ctk_help_para(b, &i, "\t%s\n\n" "\t%s\n\n" @@ -1450,41 +1449,41 @@ GtkTextBuffer *ctk_glx_create_help(GtkTextTagTable *table, "\t%s\n\n" "\t%s\n\n", - __egl_id_help, - __egl_vid_help, - __egl_nvt_help, - __egl_bfs_help, - __egl_lvl_help, - __egl_cbt_help, - __egl_rs_help, - __egl_gs_help, - - __egl_bs_help, - __egl_as_help, - __egl_ams_help, - __egl_lum_help, - __egl_dpt_help, - __egl_stn_help, - __egl_bt_help, - __egl_bta_help, - - __egl_cfm_help, - __egl_spb_help, - __egl_smp_help, - __egl_cav_help, - __egl_pbw_help, - __egl_pbh_help, - __egl_pbp_help, - __egl_six_help, - - __egl_sin_help, - __egl_nrd_help, - __egl_rdt_help, - __egl_sur_help, - __egl_tpt_help, - __egl_trv_help, - __egl_tgv_help, - __egl_tbv_help + _(__egl_id_help), + _(__egl_vid_help), + _(__egl_nvt_help), + _(__egl_bfs_help), + _(__egl_lvl_help), + _(__egl_cbt_help), + _(__egl_rs_help), + _(__egl_gs_help), + + _(__egl_bs_help), + _(__egl_as_help), + _(__egl_ams_help), + _(__egl_lum_help), + _(__egl_dpt_help), + _(__egl_stn_help), + _(__egl_bt_help), + _(__egl_bta_help), + + _(__egl_cfm_help), + _(__egl_spb_help), + _(__egl_smp_help), + _(__egl_cav_help), + _(__egl_pbw_help), + _(__egl_pbh_help), + _(__egl_pbp_help), + _(__egl_six_help), + + _(__egl_sin_help), + _(__egl_nrd_help), + _(__egl_rdt_help), + _(__egl_sur_help), + _(__egl_tpt_help), + _(__egl_trv_help), + _(__egl_tgv_help), + _(__egl_tbv_help) ); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkgpu.c b/src/gtk+-2.x/ctkgpu.c index 02c5d864..eda69f16 100644 --- a/src/gtk+-2.x/ctkgpu.c +++ b/src/gtk+-2.x/ctkgpu.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "msg.h" #include "parse.h" @@ -35,6 +36,8 @@ #include "XF86Config-parser/xf86Parser.h" +#define _(STRING) gettext(STRING) + static void probe_displays_received(GObject *object, CtrlEvent *event, gpointer user_data); static gboolean update_gpu_usage(gpointer); @@ -303,7 +306,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, if (ret != NvCtrlSuccess) { video_ram = NULL; } else { - video_ram = g_strdup_printf("%d MB", tmp >> 10); + video_ram = g_strdup_printf(_("%d MB"), tmp >> 10); } /* NV_CTRL_TOTAL_DEDICATED_GPU_MEMORY */ @@ -313,7 +316,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, if (ret != NvCtrlSuccess) { gpu_memory_text = NULL; } else { - gpu_memory_text = g_strdup_printf("%d MB", gpu_memory); + gpu_memory_text = g_strdup_printf(_("%d MB"), gpu_memory); } /* NV_CTRL_GPU_CORES */ @@ -331,7 +334,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, if (ret != NvCtrlSuccess) { memory_interface = NULL; } else { - memory_interface = g_strdup_printf("%d-bit", tmp); + memory_interface = g_strdup_printf(_("%d-bit"), tmp); } /* NV_CTRL_IRQ */ @@ -366,12 +369,12 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, &len); if (ret == NvCtrlSuccess) { if (pData[0] == 0) { - screens = g_strdup("None"); + screens = g_strdup(_("None")); } else { CtrlTarget *screen_target; if (xinerama_enabled) { - screens = g_strdup("Screen 0 (Xinerama)"); + screens = g_strdup(_("Screen 0 (Xinerama)")); /* XXX Use the only screen handle we have. * This is currently OK since we only * query xinerama attributes with this @@ -386,10 +389,10 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, } else { for (i = 1; i <= pData[0]; i++) { if (screens) { - tmp_str = g_strdup_printf("%s,\nScreen %d", + tmp_str = g_strdup_printf(_("%s,\nScreen %d"), screens, pData[i]); } else { - tmp_str = g_strdup_printf("Screen %d", pData[i]); + tmp_str = g_strdup_printf(_("Screen %d"), pData[i]); } g_free(screens); screens = tmp_str; @@ -402,7 +405,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, NV_CTRL_SHOW_SLI_VISUAL_INDICATOR, &tmp); if (ret == NvCtrlSuccess) { - tmp_str = g_strdup_printf("%s (SLI)", screens); + tmp_str = g_strdup_printf(_("%s (SLI)"), screens); g_free(screens); screens = tmp_str; } @@ -410,7 +413,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, free(pData); } if (!screens) { - screens = g_strdup("Unknown"); + screens = g_strdup(_("Unknown")); } /* now, create the object */ @@ -465,7 +468,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Graphics Card Information"); + label = gtk_label_new(_("Graphics Card Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -478,38 +481,38 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, gtk_container_set_border_width(GTK_CONTAINER(table), 5); add_table_row(table, row++, - 0, 0.5, "Graphics Processor:", + 0, 0.5, _("Graphics Processor:"), 0, 0.5, product_name); if ( ctk_gpu->gpu_uuid ) { add_table_row(table, row++, - 0, 0.5, "GPU UUID:", + 0, 0.5, _("GPU UUID:"), 0, 0.5, gpu_uuid); } if ( ctk_gpu->gpu_cores ) { gtk_table_resize(GTK_TABLE(table), ++total_rows, 2); add_table_row(table, row++, - 0, 0.5, "CUDA Cores:", + 0, 0.5, _("CUDA Cores:"), 0, 0.5, gpu_cores); } if ( vbios_version ) { add_table_row(table, row++, - 0, 0.5, "VBIOS Version:", + 0, 0.5, _("VBIOS Version:"), 0, 0.5, vbios_version); } add_table_row(table, row++, - 0, 0.5, "Total Memory:", + 0, 0.5, _("Total Memory:"), 0, 0.5, video_ram); add_table_row(table, row++, - 0, 0.5, "Total Dedicated Memory:", + 0, 0.5, _("Total Dedicated Memory:"), 0, 0.5, gpu_memory_text); ctk_gpu->gpu_memory_used_label = add_table_row(table, row++, - 0, 0.5, "Used Dedicated Memory:", + 0, 0.5, _("Used Dedicated Memory:"), 0, 0.5, NULL); if ( ctk_gpu->memory_interface ) { gtk_table_resize(GTK_TABLE(table), ++total_rows, 2); add_table_row(table, row++, - 0, 0.5, "Memory Interface:", + 0, 0.5, _("Memory Interface:"), 0, 0.5, memory_interface); } @@ -518,56 +521,56 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, if (entry.graphics_specified) { ctk_gpu->gpu_utilization_label = add_table_row(table, row++, - 0, 0.5, "GPU Utilization:", + 0, 0.5, _("GPU Utilization:"), 0, 0.5, NULL); } if (entry.video_specified) { ctk_gpu->video_utilization_label = add_table_row(table, row++, - 0, 0.5, "Video Engine Utilization:", + 0, 0.5, _("Video Engine Utilization:"), 0, 0.5, NULL); } /* spacing */ row += 3; add_table_row(table, row++, - 0, 0.5, "Bus Type:", + 0, 0.5, _("Bus Type:"), 0, 0.5, bus); if ( pci_bus_id ) { add_table_row(table, row++, - 0, 0.5, "Bus ID:", + 0, 0.5, _("Bus ID:"), 0, 0.5, pci_bus_id); } if ( pci_device_id[0] ) { add_table_row(table, row++, - 0, 0.5, "PCI Device ID:", + 0, 0.5, _("PCI Device ID:"), 0, 0.5, pci_device_id); } if (pci_vendor_id[0] ) { add_table_row(table, row++, - 0, 0.5, "PCI Vendor ID:", + 0, 0.5, _("PCI Vendor ID:"), 0, 0.5, pci_vendor_id); } if ( irq ) { add_table_row(table, row++, - 0, 0.5, "IRQ:", + 0, 0.5, _("IRQ:"), 0, 0.5, irq); } if (ctk_gpu->pcie_gen_queriable) { /* spacing */ row += 3; add_table_row(table, row++, - 0, 0.5, "PCIe Generation:", + 0, 0.5, _("PCIe Generation:"), 0, 0.5, pcie_gen_str); add_table_row(table, row++, - 0, 0.5, "Maximum PCIe Link Width:", + 0, 0.5, _("Maximum PCIe Link Width:"), 0, 0.5, link_width_str); add_table_row(table, row++, - 0, 0.5, "Maximum PCIe Link Speed:", + 0, 0.5, _("Maximum PCIe Link Speed:"), 0, 0.5, link_speed_str); ctk_gpu->pcie_utilization_label = add_table_row(table, row++, - 0, 0.5, "PCIe Bandwidth Utilization:", + 0, 0.5, _("PCIe Bandwidth Utilization:"), 0, 0.5, NULL); g_free(link_speed_str); @@ -580,7 +583,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, /* spacing */ row += 3; add_table_row(table, row++, - 0, 0, "X Screens:", + 0, 0, _("X Screens:"), 0, 0, screens); /* spacing */ displays = make_display_device_list(ctrl_target); @@ -588,7 +591,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, row += 3; ctk_gpu->displays = add_table_row(table, row, - 0, 0, "Display Devices:", + 0, 0, _("Display Devices:"), 0, 0, displays); free(product_name); @@ -612,7 +615,7 @@ GtkWidget* ctk_gpu_new(CtrlTarget *ctrl_target, G_CALLBACK(probe_displays_received), (gpointer) ctk_gpu); - tmp_str = g_strdup_printf("Memory Used (GPU %d)", + tmp_str = g_strdup_printf(_("Memory Used (GPU %d)"), NvCtrlGetTargetId(ctrl_target)); ctk_config_add_timer(ctk_gpu->ctk_config, @@ -636,117 +639,117 @@ GtkTextBuffer *ctk_gpu_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "Graphics Card Information Help"); + ctk_help_title(b, &i, _("Graphics Card Information Help")); - ctk_help_para(b, &i, "This page in the NVIDIA " + ctk_help_para(b, &i, _("This page in the NVIDIA " "X Server Control Panel describes basic " "information about the Graphics Processing Unit " - "(GPU)."); + "(GPU).")); - ctk_help_heading(b, &i, "Graphics Processor"); - ctk_help_para(b, &i, "This is the product name of the GPU."); + ctk_help_heading(b, &i, _("Graphics Processor")); + ctk_help_para(b, &i, _("This is the product name of the GPU.")); if (ctk_gpu->gpu_uuid) { - ctk_help_heading(b, &i, "GPU UUID"); - ctk_help_para(b, &i, "This is the global unique identifier " - "of the GPU."); + ctk_help_heading(b, &i, _("GPU UUID")); + ctk_help_para(b, &i, _("This is the global unique identifier " + "of the GPU.")); } if (ctk_gpu->gpu_cores) { - ctk_help_heading(b, &i, "CUDA Cores"); - ctk_help_para(b, &i, "This is the number of CUDA cores supported by " - "the graphics pipeline."); + ctk_help_heading(b, &i, _("CUDA Cores")); + ctk_help_para(b, &i, _("This is the number of CUDA cores supported by " + "the graphics pipeline.")); } - ctk_help_heading(b, &i, "VBIOS Version"); - ctk_help_para(b, &i, "This is the Video BIOS version."); + ctk_help_heading(b, &i, _("VBIOS Version")); + ctk_help_para(b, &i, _("This is the Video BIOS version.")); - ctk_help_heading(b, &i, "Total Memory"); - ctk_help_para(b, &i, "This is the overall amount of memory " + ctk_help_heading(b, &i, _("Total Memory")); + ctk_help_para(b, &i, _("This is the overall amount of memory " "available to your GPU. With TurboCache(TM) GPUs, " "this value may exceed the amount of video " "memory installed on the graphics card. With " "integrated GPUs, the value may exceed the amount of " "dedicated system memory set aside by the system " - "BIOS for use by the integrated GPU."); + "BIOS for use by the integrated GPU.")); - ctk_help_heading(b, &i, "Total Dedicated Memory"); - ctk_help_para(b, &i, "This is the amount of memory dedicated " - "exclusively to your GPU."); + ctk_help_heading(b, &i, _("Total Dedicated Memory")); + ctk_help_para(b, &i, _("This is the amount of memory dedicated " + "exclusively to your GPU.")); - ctk_help_heading(b, &i, "Used Dedicated Memory"); - ctk_help_para(b, &i, "This is the amount of dedicated memory used " - "by your GPU."); + ctk_help_heading(b, &i, _("Used Dedicated Memory")); + ctk_help_para(b, &i, _("This is the amount of dedicated memory used " + "by your GPU.")); if (ctk_gpu->memory_interface) { - ctk_help_heading(b, &i, "Memory Interface"); - ctk_help_para(b, &i, "This is the bus bandwidth of the GPU's " - "memory interface."); + ctk_help_heading(b, &i, _("Memory Interface")); + ctk_help_para(b, &i, _("This is the bus bandwidth of the GPU's " + "memory interface.")); } - ctk_help_heading(b, &i, "GPU Utilization"); - ctk_help_para(b, &i, "This is the percentage usage of graphics engine."); + ctk_help_heading(b, &i, _("GPU Utilization")); + ctk_help_para(b, &i, _("This is the percentage usage of graphics engine.")); - ctk_help_heading(b, &i, "Video Engine Utilization"); - ctk_help_para(b, &i, "This is the percentage usage of video engine"); + ctk_help_heading(b, &i, _("Video Engine Utilization")); + ctk_help_para(b, &i, _("This is the percentage usage of video engine")); - ctk_help_heading(b, &i, "Bus Type"); - ctk_help_para(b, &i, "This is the bus type which is " + ctk_help_heading(b, &i, _("Bus Type")); + ctk_help_para(b, &i, _("This is the bus type which is " "used to connect the NVIDIA GPU to the rest of " "your computer; possible values are AGP, PCI, " - "PCI Express and Integrated."); + "PCI Express and Integrated.")); - ctk_help_heading(b, &i, "Bus ID"); - ctk_help_para(b, &i, "This is the GPU's PCI identification string, " + ctk_help_heading(b, &i, _("Bus ID")); + ctk_help_para(b, &i, _("This is the GPU's PCI identification string, " "in X configuration file 'BusID' format: " "\"bus:device:function\", or, if the PCI domain of the GPU " "is non-zero, \"bus@domain:device:function\". Note " "that all values are in decimal (as opposed to hexadecimal, " - "which is how `lspci` formats its BusID values)."); + "which is how `lspci` formats its BusID values).")); - ctk_help_heading(b, &i, "PCI Device ID"); - ctk_help_para(b, &i, "This is the PCI Device ID of the GPU."); + ctk_help_heading(b, &i, _("PCI Device ID")); + ctk_help_para(b, &i, _("This is the PCI Device ID of the GPU.")); - ctk_help_heading(b, &i, "PCI Vendor ID"); - ctk_help_para(b, &i, "This is the PCI Vendor ID of the GPU."); + ctk_help_heading(b, &i, _("PCI Vendor ID")); + ctk_help_para(b, &i, _("This is the PCI Vendor ID of the GPU.")); - ctk_help_heading(b, &i, "IRQ"); - ctk_help_para(b, &i, "This is the interrupt request line assigned to " - "this GPU."); + ctk_help_heading(b, &i, _("IRQ")); + ctk_help_para(b, &i, _("This is the interrupt request line assigned to " + "this GPU.")); if (ctk_gpu->pcie_gen_queriable) { - ctk_help_heading(b, &i, "PCIe Generation"); - ctk_help_para(b, &i, "This is the PCIe generation that this GPU, in " - "this system, is compliant with."); + ctk_help_heading(b, &i, _("PCIe Generation")); + ctk_help_para(b, &i, _("This is the PCIe generation that this GPU, in " + "this system, is compliant with.")); - ctk_help_heading(b, &i, "Maximum PCIe Link Width"); - ctk_help_para(b, &i, "This is the maximum width that the PCIe link " + ctk_help_heading(b, &i, _("Maximum PCIe Link Width")); + ctk_help_para(b, &i, _("This is the maximum width that the PCIe link " "between the GPU and the system may be trained to. This " "is expressed in number of lanes. The trained link " "width may vary dynamically and possibly be narrower " "based on the GPU's utilization and performance " - "settings."); + "settings.")); - ctk_help_heading(b, &i, "Maximum PCIe Link Speed"); - ctk_help_para(b, &i, "This is the maximum speed that the PCIe link " + ctk_help_heading(b, &i, _("Maximum PCIe Link Speed")); + ctk_help_para(b, &i, _("This is the maximum speed that the PCIe link " "between the GPU and the system may be trained to. " "This is expressed in gigatransfers per second " "(GT/s). The link may be dynamically trained to a " "slower speed, based on the GPU's utilization and " - "performance settings."); + "performance settings.")); - ctk_help_heading(b, &i, "PCIe Bandwidth Utilization"); - ctk_help_para(b, &i, "This is the percentage usage of " - "PCIe bandwidth."); + ctk_help_heading(b, &i, _("PCIe Bandwidth Utilization")); + ctk_help_para(b, &i, _("This is the percentage usage of " + "PCIe bandwidth.")); } - ctk_help_heading(b, &i, "X Screens"); - ctk_help_para(b, &i, "This is the list of X Screens driven by this GPU."); + ctk_help_heading(b, &i, _("X Screens")); + ctk_help_para(b, &i, _("This is the list of X Screens driven by this GPU.")); - ctk_help_heading(b, &i, "Display Devices"); - ctk_help_para(b, &i, "This is the list of Display Devices (CRTs, TVs etc) " - "enabled on this GPU."); + ctk_help_heading(b, &i, _("Display Devices")); + ctk_help_para(b, &i, _("This is the list of Display Devices (CRTs, TVs etc) " + "enabled on this GPU.")); ctk_help_finish(b); @@ -788,16 +791,16 @@ static gboolean update_gpu_usage(gpointer user_data) ret = NvCtrlGetAttribute(ctrl_target, NV_CTRL_USED_DEDICATED_GPU_MEMORY, &value); if (ret != NvCtrlSuccess || value > ctk_gpu->gpu_memory || value < 0) { - gtk_label_set_text(GTK_LABEL(ctk_gpu->gpu_memory_used_label), "Unknown"); + gtk_label_set_text(GTK_LABEL(ctk_gpu->gpu_memory_used_label), _("Unknown")); return FALSE; } else { if (ctk_gpu->gpu_memory > 0) { - memory_text = g_strdup_printf("%d MB (%.0f%%)", + memory_text = g_strdup_printf(_("%d MB (%.0f%%)"), value, 100.0 * (double) value / (double) ctk_gpu->gpu_memory); } else { - memory_text = g_strdup_printf("%d MB", value); + memory_text = g_strdup_printf(_("%d MB"), value); } gtk_label_set_text(GTK_LABEL(ctk_gpu->gpu_memory_used_label), memory_text); @@ -811,15 +814,15 @@ static gboolean update_gpu_usage(gpointer user_data) if (ret != NvCtrlSuccess) { if (ctk_gpu->gpu_utilization_label) { gtk_label_set_text(GTK_LABEL(ctk_gpu->gpu_utilization_label), - "Unknown"); + _("Unknown")); } if (ctk_gpu->video_utilization_label) { gtk_label_set_text(GTK_LABEL(ctk_gpu->video_utilization_label), - "Unknown"); + _("Unknown")); } if (ctk_gpu->pcie_utilization_label) { gtk_label_set_text(GTK_LABEL(ctk_gpu->pcie_utilization_label), - "Unknown"); + _("Unknown")); } return FALSE; } diff --git a/src/gtk+-2.x/ctkgridlicense.c b/src/gtk+-2.x/ctkgridlicense.c index 6940ee28..15e9eccf 100644 --- a/src/gtk+-2.x/ctkgridlicense.c +++ b/src/gtk+-2.x/ctkgridlicense.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -43,41 +44,44 @@ #include #include +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + #define DEFAULT_UPDATE_GRID_LICENSE_STATUS_INFO_TIME_INTERVAL 1000 #define GRID_CONFIG_FILE "/etc/nvidia/gridd.conf" #define GRID_CONFIG_FILE_TEMPLATE "/etc/nvidia/gridd.conf.template" static const char * __manage_grid_licenses_help = -"Use the Manage GRID License page to obtain licenses " -"for GRID vGPU or Quadro Virtual Datacenter Workstation on supported Tesla products."; +N_("Use the Manage GRID License page to obtain licenses " +"for GRID vGPU or Quadro Virtual Datacenter Workstation on supported Tesla products."); static const char * __grid_virtual_workstation_help = -"Select this option to enable Quadro Virtual Datacenter Workstation license."; +N_("Select this option to enable Quadro Virtual Datacenter Workstation license."); static const char * __grid_vapp_help = -"Select this option to disable the Quadro Virtual Datacenter Workstation license."; +N_("Select this option to disable the Quadro Virtual Datacenter Workstation license."); static const char * __license_edition_help = -"This section indicates the status of GRID licensing for the system."; +N_("This section indicates the status of GRID licensing for the system."); static const char * __license_server_help = -"Shows the configured GRID license server details."; +N_("Shows the configured GRID license server details."); static const char * __primary_server_address_help = -"Enter the address of your local GRID license server. " +N_("Enter the address of your local GRID license server. " "The address can be a fully-qualified domain name such as gridlicense.example.com, " -"or an IP address such as 10.31.20.45."; +"or an IP address such as 10.31.20.45."); static const char * __primary_server_port_help = -"This field can be left empty, and will default to 7070, " -"which is the default port number used by the NVIDIA GRID license server."; +N_("This field can be left empty, and will default to 7070, " +"which is the default port number used by the NVIDIA GRID license server."); static const char * __secondary_server_help = -"This field is optional. Enter the address of your backup GRID license server. " +N_("This field is optional. Enter the address of your backup GRID license server. " "The address can be a fully-qualified domain name such as backuplicense.example.com, " -"or an IP address such as 10.31.20.46."; +"or an IP address such as 10.31.20.46."); static const char * __secondary_server_port_help = -"This field can be left empty, and will default to 7070, " -"which is the default port number used by the NVIDIA GRID license server."; +N_("This field can be left empty, and will default to 7070, " +"which is the default port number used by the NVIDIA GRID license server."); static const char * __apply_button_help = -"Clicking the Apply button updates license settings in the gridd.conf file and " -"sends update license request to the NVIDIA GRID licensing daemon."; +N_("Clicking the Apply button updates license settings in the gridd.conf file and " +"sends update license request to the NVIDIA GRID licensing daemon."); static const char * __cancel_button_help = -"Clicking the Cancel button sets the text in all textboxes from the gridd.conf file. " -"Any changes you have done will be lost."; +N_("Clicking the Cancel button sets the text in all textboxes from the gridd.conf file. " +"Any changes you have done will be lost."); typedef struct { @@ -759,11 +763,11 @@ static gboolean update_manage_grid_license_state_info(gpointer user_data) &licenseState))) || (!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_FEATURE_TYPE_REQUEST, &griddFeatureType)))) { - licenseStatusMessage = "Unable to query license state information " + licenseStatusMessage = _("Unable to query license state information " "from the NVIDIA GRID " "licensing daemon.\n" "Please make sure nvidia-gridd and " - "dbus-daemon are running.\n"; + "dbus-daemon are running.\n"); gtk_label_set_text(GTK_LABEL(ctk_manage_grid_license->label_license_state), licenseStatusMessage); /* Disable text controls on UI. */ @@ -925,63 +929,63 @@ static gboolean update_manage_grid_license_state_info(gpointer user_data) switch (licenseStatus) { case NV_GRID_UNLICENSED_VGPU: - licenseStatusMessage = "Your system does not have a valid GRID vGPU license.\n" - "Enter license server details and apply."; + licenseStatusMessage = _("Your system does not have a valid GRID vGPU license.\n" + "Enter license server details and apply."); break; case NV_GRID_UNLICENSED_VAPP: - licenseStatusMessage = "Your system is currently configured for " - "GRID Virtual Apps."; + licenseStatusMessage = _("Your system is currently configured for " + "GRID Virtual Apps."); break; case NV_GRID_UNLICENSED_QDWS_SELECTED: - licenseStatusMessage = "Your system is currently configured for GRID Virtual Apps.\n" - "Enter license server details and apply."; + licenseStatusMessage = _("Your system is currently configured for GRID Virtual Apps.\n" + "Enter license server details and apply."); break; case NV_GRID_LICENSE_ACQUIRED_VGPU: - licenseStatusMessage = "Your system is licensed for GRID vGPU."; + licenseStatusMessage = _("Your system is licensed for GRID vGPU."); break; case NV_GRID_LICENSE_ACQUIRED_QDWS: - licenseStatusMessage = "Your system is licensed for Quadro Virtual Datacenter " - "Workstation."; + licenseStatusMessage = _("Your system is licensed for Quadro Virtual Datacenter " + "Workstation."); break; case NV_GRID_LICENSE_REQUESTING_VGPU: - licenseStatusMessage = "Acquiring license for GRID vGPU.\n" - "Your system does not have a valid GRID vGPU license."; + licenseStatusMessage = _("Acquiring license for GRID vGPU.\n" + "Your system does not have a valid GRID vGPU license."); break; case NV_GRID_LICENSE_REQUESTING_QDWS: - licenseStatusMessage = "Acquiring license for Quadro Virtual Datacenter " + licenseStatusMessage = _("Acquiring license for Quadro Virtual Datacenter " "Workstation.\n" - " Your system is currently configured for GRID Virtual Apps."; + " Your system is currently configured for GRID Virtual Apps."); break; case NV_GRID_LICENSE_FAILED_VGPU: - licenseStatusMessage = "Failed to acquire GRID vGPU license."; + licenseStatusMessage = _("Failed to acquire GRID vGPU license."); break; case NV_GRID_LICENSE_FAILED_QDWS: - licenseStatusMessage = "Failed to acquire Quadro Virtual Datacenter " + licenseStatusMessage = _("Failed to acquire Quadro Virtual Datacenter " "Worstation license.\n" - " Your system is currently configured for GRID Virtual Apps."; + " Your system is currently configured for GRID Virtual Apps."); break; case NV_GRID_LICENSE_EXPIRED_VGPU: - licenseStatusMessage = "GRID vGPU license has expired.\n" - "Your system does not have a valid GRID vGPU license."; + licenseStatusMessage = _("GRID vGPU license has expired.\n" + "Your system does not have a valid GRID vGPU license."); break; case NV_GRID_LICENSE_EXPIRED_QDWS: - licenseStatusMessage = "License for Quadro Virtual Datacenter Workstation " + licenseStatusMessage = _("License for Quadro Virtual Datacenter Workstation " "has expired.\n" "Your system does not have a valid Quadro Virtual Datacenter " - "Workstation license."; + "Workstation license."); break; case NV_GRID_LICENSE_RESTART_REQUIRED: - licenseStatusMessage = "Restart your system for GRID Virtual Apps.\n" + licenseStatusMessage = _("Restart your system for GRID Virtual Apps.\n" "Your system is currently licensed for Quadro Virtual Datacenter " - "Workstation."; + "Workstation."); break; case NV_GRID_LICENSE_RESTART_REQUIRED_VAPP: - licenseStatusMessage = "Restart your system for GRID Virtual Apps."; + licenseStatusMessage = _("Restart your system for GRID Virtual Apps."); break; case NV_GRID_UNLICENSED_REQUEST_DETAILS: default: - licenseStatusMessage = "Your system does not have a valid GRID license.\n" - "Enter license server details and apply."; + licenseStatusMessage = _("Your system does not have a valid GRID license.\n" + "Enter license server details and apply."); break; } @@ -1039,12 +1043,12 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to send license information " + _("Unable to send license information " "update request to the NVIDIA GRID " "licensing daemon.\n" "Please make sure nvidia-gridd and " "dbus-daemon are running and retry applying the " - "license settings.\n"); + "license settings.\n")); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } @@ -1056,8 +1060,8 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Unable to update GRID license configuration " - "file (%s): %s", GRID_CONFIG_FILE, strerror(err)); + _("Unable to update GRID license configuration " + "file (%s): %s"), GRID_CONFIG_FILE, strerror(err)); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } @@ -1069,8 +1073,8 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "You do not have enough " - "permissions to edit '%s' file.", GRID_CONFIG_FILE); + _("You do not have enough " + "permissions to edit '%s' file."), GRID_CONFIG_FILE); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } else { @@ -1081,8 +1085,8 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "'%s' file does not exist.\n You do not have " - "permissions to create this file.", GRID_CONFIG_FILE); + _("'%s' file does not exist.\n You do not have " + "permissions to create this file."), GRID_CONFIG_FILE); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } @@ -1237,7 +1241,7 @@ static void license_edition_toggled(GtkWidget *widget, gpointer user_data) if (GPOINTER_TO_INT(user_data) == NV_GRID_LICENSE_FEATURE_TYPE_QDWS) { gtk_widget_set_sensitive(ctk_manage_grid_license->box_server_info, TRUE); - statusBarMsg = "You selected Quadro Virtual Datacenter Workstation Edition."; + statusBarMsg = _("You selected Quadro Virtual Datacenter Workstation Edition."); ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_QDWS; /* Enable Apply/Cancel button if the feature type selection has changed*/ @@ -1268,7 +1272,7 @@ static void license_edition_toggled(GtkWidget *widget, gpointer user_data) gtk_widget_set_sensitive(ctk_manage_grid_license->box_server_info, FALSE); ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_VAPP; - statusBarMsg = "You selected GRID Virtual Apps Edition."; + statusBarMsg = _("You selected GRID Virtual Apps Edition."); /* Enable Apply/Cancel button if the feature type selection has changed*/ if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "0") != 0) { gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, TRUE); @@ -1581,11 +1585,11 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, gtk_container_add(GTK_CONTAINER(frame), vbox1); if (mode == NV_CTRL_ATTR_NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH) { - label = gtk_label_new("License Edition:"); + label = gtk_label_new(_("License Edition:")); hbox = gtk_hbox_new(FALSE, 0); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_config, eventbox, __license_edition_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__license_edition_help)); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 5); @@ -1594,7 +1598,7 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, gtk_container_set_border_width(GTK_CONTAINER(vbox3), 5); ctk_manage_grid_license->radio_btn_qdws = gtk_radio_button_new_with_label(NULL, - "Quadro Virtual Datacenter Workstation"); + _("Quadro Virtual Datacenter Workstation")); slist = gtk_radio_button_get_group(GTK_RADIO_BUTTON(ctk_manage_grid_license->radio_btn_qdws)); gtk_box_pack_start(GTK_BOX(vbox3), ctk_manage_grid_license->radio_btn_qdws, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(ctk_manage_grid_license->radio_btn_qdws), "button_id", @@ -1603,7 +1607,7 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, G_CALLBACK(license_edition_toggled), (gpointer) ctk_manage_grid_license); - ctk_manage_grid_license->radio_btn_vapp = gtk_radio_button_new_with_label(slist, "GRID Virtual Apps"); + ctk_manage_grid_license->radio_btn_vapp = gtk_radio_button_new_with_label(slist, _("GRID Virtual Apps")); gtk_box_pack_start(GTK_BOX(vbox3), ctk_manage_grid_license->radio_btn_vapp, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(ctk_manage_grid_license->radio_btn_vapp), "button_id", GINT_TO_POINTER(NV_GRID_LICENSE_FEATURE_TYPE_VAPP)); @@ -1615,12 +1619,12 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, } /* Show current license status message */ - ctk_manage_grid_license->label_license_state = gtk_label_new("Unknown"); + ctk_manage_grid_license->label_license_state = gtk_label_new(_("Unknown")); hbox = gtk_hbox_new(FALSE, 0); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), ctk_manage_grid_license->label_license_state); - ctk_config_set_tooltip(ctk_config, eventbox, __license_edition_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__license_edition_help)); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 5); @@ -1629,11 +1633,11 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, gtk_container_add(GTK_CONTAINER(frame), vbox2); /* License Server */ - label = gtk_label_new("License Server:"); + label = gtk_label_new(_("License Server:")); hbox = gtk_hbox_new(FALSE, 0); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_config, eventbox, __license_server_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__license_server_help)); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, TRUE, 5); @@ -1650,12 +1654,12 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, /* Primary License Server Address */ - label = gtk_label_new("Primary Server:"); + label = gtk_label_new(_("Primary Server:")); ctk_manage_grid_license->txt_server_address = gtk_entry_new(); hbox = gtk_hbox_new(FALSE, 0); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_config, eventbox, __primary_server_address_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__primary_server_address_help)); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, TRUE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0); @@ -1675,12 +1679,12 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); /* Port Number */ - label = gtk_label_new("Port Number:"); + label = gtk_label_new(_("Port Number:")); hbox = gtk_hbox_new(FALSE, 5); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_config, eventbox, __primary_server_port_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__primary_server_port_help)); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, TRUE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0); @@ -1701,14 +1705,14 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, (gpointer) ctk_manage_grid_license); /* Backup Server Address */ - label = gtk_label_new("Secondary Server:"); + label = gtk_label_new(_("Secondary Server:")); ctk_manage_grid_license->txt_secondary_server_address = gtk_entry_new(); hbox = gtk_hbox_new(FALSE, 0); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), label); ctk_config_set_tooltip(ctk_config, eventbox, - __secondary_server_help); + _(__secondary_server_help)); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, TRUE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 5, 6, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0); @@ -1728,12 +1732,12 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); /* Port Number */ - label = gtk_label_new("Port Number:"); + label = gtk_label_new(_("Port Number:")); hbox = gtk_hbox_new(FALSE, 5); eventbox = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_config, eventbox, __secondary_server_port_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__secondary_server_port_help)); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, TRUE, 0); gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 6, 7, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0); @@ -1761,7 +1765,7 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE); gtk_widget_set_size_request(ctk_manage_grid_license->btn_apply, 100, -1); ctk_config_set_tooltip(ctk_config, ctk_manage_grid_license->btn_apply, - __apply_button_help); + _(__apply_button_help)); hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(hbox), ctk_manage_grid_license->btn_apply, FALSE, FALSE, 5); @@ -1772,10 +1776,10 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, /* Cancel button */ ctk_manage_grid_license->btn_cancel = gtk_button_new_with_label - (" Cancel "); + (_(" Cancel ")); gtk_widget_set_size_request(ctk_manage_grid_license->btn_cancel, 100, -1); ctk_config_set_tooltip(ctk_config, ctk_manage_grid_license->btn_cancel, - __cancel_button_help); + _(__cancel_button_help)); gtk_box_pack_end(GTK_BOX(hbox), ctk_manage_grid_license->btn_cancel, FALSE, FALSE, 5); g_signal_connect(G_OBJECT(ctk_manage_grid_license->btn_cancel), "clicked", @@ -1791,7 +1795,7 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, ctk_manage_grid_license->gridd_feature_type = ctk_manage_grid_license->feature_type; /* Register a timer callback to update license status info */ - str = g_strdup_printf("Manage GRID License"); + str = g_strdup_printf(_("Manage GRID License")); ctk_config_add_timer(ctk_manage_grid_license->ctk_config, DEFAULT_UPDATE_GRID_LICENSE_STATUS_INFO_TIME_INTERVAL, @@ -1830,38 +1834,38 @@ GtkTextBuffer *ctk_manage_grid_license_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_heading(b, &i, "Manage GRID Licenses Help"); - ctk_help_para(b, &i, "%s", __manage_grid_licenses_help); + ctk_help_heading(b, &i, _("Manage GRID Licenses Help")); + ctk_help_para(b, &i, "%s", _(__manage_grid_licenses_help)); if (ctk_manage_grid_license->license_edition_state == NV_CTRL_ATTR_NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH) { - ctk_help_heading(b, &i, "Quadro Virtual Datacenter Workstation"); - ctk_help_para(b, &i, "%s", __grid_virtual_workstation_help); + ctk_help_heading(b, &i, _("Quadro Virtual Datacenter Workstation")); + ctk_help_para(b, &i, "%s", _(__grid_virtual_workstation_help)); - ctk_help_heading(b, &i, "GRID Virtual Apps"); - ctk_help_para(b, &i, "%s", __grid_vapp_help); + ctk_help_heading(b, &i, _("GRID Virtual Apps")); + ctk_help_para(b, &i, "%s", _(__grid_vapp_help)); } - ctk_help_heading(b, &i, "License Server"); - ctk_help_para(b, &i, "%s", __license_server_help); + ctk_help_heading(b, &i, _("License Server")); + ctk_help_para(b, &i, "%s", _(__license_server_help)); - ctk_help_heading(b, &i, "Primary Server"); - ctk_help_para(b, &i, "%s", __primary_server_address_help); + ctk_help_heading(b, &i, _("Primary Server")); + ctk_help_para(b, &i, "%s", _(__primary_server_address_help)); - ctk_help_heading(b, &i, "Port Number"); - ctk_help_para(b, &i, "%s", __primary_server_port_help); + ctk_help_heading(b, &i, _("Port Number")); + ctk_help_para(b, &i, "%s", _(__primary_server_port_help)); - ctk_help_heading(b, &i, "Secondary Server"); - ctk_help_para(b, &i, "%s", __secondary_server_help); + ctk_help_heading(b, &i, _("Secondary Server")); + ctk_help_para(b, &i, "%s", _(__secondary_server_help)); - ctk_help_heading(b, &i, "Port Number"); - ctk_help_para(b, &i, "%s", __secondary_server_port_help); + ctk_help_heading(b, &i, _("Port Number")); + ctk_help_para(b, &i, "%s", _(__secondary_server_port_help)); - ctk_help_heading(b, &i, "Apply"); - ctk_help_para(b, &i, "%s", __apply_button_help); + ctk_help_heading(b, &i, _("Apply")); + ctk_help_para(b, &i, "%s", _(__apply_button_help)); - ctk_help_heading(b, &i, "Cancel"); - ctk_help_para(b, &i, "%s", __cancel_button_help); + ctk_help_heading(b, &i, _("Cancel")); + ctk_help_para(b, &i, "%s", _(__cancel_button_help)); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkgvi.c b/src/gtk+-2.x/ctkgvi.c index d30167b1..a31ccc20 100644 --- a/src/gtk+-2.x/ctkgvi.c +++ b/src/gtk+-2.x/ctkgvi.c @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -33,6 +34,8 @@ #include "ctkbanner.h" #include "ctkdropdownmenu.h" +#define _(STRING) gettext(STRING) + #define DEFAULT_UPDATE_VIDEO_FORMAT_INFO_TIME_INTERVAL 1000 static gboolean update_sdi_input_info(gpointer); @@ -107,7 +110,7 @@ static const char *ctk_gvio_get_format_name(const GvioFormatName *formatTable, return formatTable[i].name; } } - return "Unknown"; + return _("Unknown"); } @@ -226,7 +229,7 @@ static void update_sdi_input_info_simple(CtkGvi *ctk_gvi) box = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(vbox, box, FALSE, FALSE, 0); - label_str = g_strdup_printf("Jack %d:", jack+1); + label_str = g_strdup_printf(_("Jack %d:"), jack+1); label = gtk_label_new(label_str); g_free(label_str); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -242,14 +245,14 @@ static void update_sdi_input_info_simple(CtkGvi *ctk_gvi) if (num_active_channels <= 1) { if (channel != show_channel) continue; - label_str = g_strdup_printf("Jack %d: %s", jack+1, vidfmt_str); + label_str = g_strdup_printf(_("Jack %d: %s"), jack+1, vidfmt_str); label = gtk_label_new(label_str); g_free(label_str); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(vbox, label, FALSE, FALSE, 0); } else { - label_str = g_strdup_printf("Channel %d: %s", + label_str = g_strdup_printf(_("Channel %d: %s"), channel+1, vidfmt_str); label = gtk_label_new(label_str); g_free(label_str); @@ -304,7 +307,7 @@ static GtkWidget *create_jack_channel_menu(CtkGvi *ctk_gvi) jack_channel |= (jack & 0xFFFF); - label_str = g_strdup_printf("Jack %d, Channel %d", + label_str = g_strdup_printf(_("Jack %d, Channel %d"), jack+1, channel+1); ctk_drop_down_menu_append_item(menu, label_str, idx); g_free(label_str); @@ -358,7 +361,7 @@ static void update_sdi_input_info_all(CtkGvi *ctk_gvi) /* Show channel's information in table format */ - label = gtk_label_new("Video Format:"); + label = gtk_label_new(_("Video Format:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); @@ -371,7 +374,7 @@ static void update_sdi_input_info_all(CtkGvi *ctk_gvi) g_free(label_str); - label = gtk_label_new("Component Sampling:"); + label = gtk_label_new(_("Component Sampling:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); @@ -384,7 +387,7 @@ static void update_sdi_input_info_all(CtkGvi *ctk_gvi) g_free(label_str); - label = gtk_label_new("Color Space:"); + label = gtk_label_new(_("Color Space:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); @@ -397,7 +400,7 @@ static void update_sdi_input_info_all(CtkGvi *ctk_gvi) g_free(label_str); - label = gtk_label_new("Bits Per Component:"); + label = gtk_label_new(_("Bits Per Component:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); @@ -410,12 +413,12 @@ static void update_sdi_input_info_all(CtkGvi *ctk_gvi) g_free(label_str); - label = gtk_label_new("Link ID:"); + label = gtk_label_new(_("Link ID:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 4, 5); if (channel_info.link_id == NV_CTRL_GVI_LINK_ID_UNKNOWN) { - label_str = g_strdup_printf("Unknown"); + label_str = g_strdup_printf(_("Unknown")); } else { label_str = g_strdup_printf("%d", channel_info.link_id); } @@ -424,7 +427,7 @@ static void update_sdi_input_info_all(CtkGvi *ctk_gvi) gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 4, 5); g_free(label_str); - label = gtk_label_new("SMPTE 352 Payload Identifier:"); + label = gtk_label_new(_("SMPTE 352 Payload Identifier:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 5, 6); @@ -472,9 +475,9 @@ static void show_detailed_info_button_toggled(GtkWidget *button, active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); if (active) { - gtk_button_set_label(GTK_BUTTON(button), "Show Condensed Input Info"); + gtk_button_set_label(GTK_BUTTON(button), _("Show Condensed Input Info")); } else { - gtk_button_set_label(GTK_BUTTON(button), "Show Detailed Input Info"); + gtk_button_set_label(GTK_BUTTON(button), _("Show Detailed Input Info")); } update_sdi_input_info(ctk_gvi); @@ -488,7 +491,7 @@ static gchar* gpu_name_string(gint gpu_id, CtrlSystem *system) ctrl_target = NvCtrlGetTarget(system, GPU_TARGET, gpu_id); if (ctrl_target == NULL) { - gpu_name = g_strdup_printf("None"); + gpu_name = g_strdup_printf(_("None")); } else { gpu_name = create_gpu_name_string(ctrl_target); } @@ -542,7 +545,7 @@ GtkWidget* ctk_gvi_new(CtrlTarget *ctrl_target, NV_CTRL_STRING_GVIO_FIRMWARE_VERSION, &firmware_version); if (ret != NvCtrlSuccess) { - firmware_version = g_strdup("Unable to determine"); + firmware_version = g_strdup(_("Unable to determine")); } /* Get Bus related information */ @@ -605,7 +608,7 @@ GtkWidget* ctk_gvi_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("GVI Device Information"); + label = gtk_label_new(_("GVI Device Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -618,21 +621,21 @@ GtkWidget* ctk_gvi_new(CtrlTarget *ctrl_target, gtk_container_set_border_width(GTK_CONTAINER(table), 5); add_table_row(table, 0, - 0, 0.5, "Firmware Version:", + 0, 0.5, _("Firmware Version:"), 0, 0.5, firmware_version); /* spacing */ add_table_row(table, 2, - 0, 0.5, "Bus Type:", + 0, 0.5, _("Bus Type:"), 0, 0.5, bus); add_table_row(table, 3, - 0, 0.5, "Bus ID:", + 0, 0.5, _("Bus ID:"), 0, 0.5, pci_bus_id); /* spacing */ add_table_row(table, 5, - 0, 0.5, "IRQ:", + 0, 0.5, _("IRQ:"), 0, 0.5, irq); - label = gtk_label_new("Bound GPU:"); + label = gtk_label_new(_("Bound GPU:")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 7, 8, @@ -655,7 +658,7 @@ GtkWidget* ctk_gvi_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Input Information"); + label = gtk_label_new(_("Input Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -683,7 +686,7 @@ GtkWidget* ctk_gvi_new(CtrlTarget *ctrl_target, ctk_gvi->input_info_vbox, FALSE, FALSE, 0); /* Register a timer callback to update the video format info */ - s = g_strdup_printf("Graphics Video In (GVI %d)", + s = g_strdup_printf(_("Graphics Video In (GVI %d)"), NvCtrlGetTargetId(ctrl_target)); ctk_config_add_timer(ctk_gvi->ctk_config, @@ -695,7 +698,7 @@ GtkWidget* ctk_gvi_new(CtrlTarget *ctrl_target, /* Condensed/Detailed view toggle button */ - button = gtk_toggle_button_new_with_label("Show Detailed Input Info"); + button = gtk_toggle_button_new_with_label(_("Show Detailed Input Info")); ctk_gvi->show_detailed_info_btn = button; hbox = gtk_hbox_new(FALSE, 5); @@ -729,54 +732,54 @@ GtkTextBuffer *ctk_gvi_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "GVI Device Information Help"); - ctk_help_para(b, &i, "This page in the NVIDIA " + ctk_help_title(b, &i, _("GVI Device Information Help")); + ctk_help_para(b, &i, _("This page in the NVIDIA " "X Server Control Panel describes basic " "information about the Graphics Video In " - "(GVI) device."); + "(GVI) device.")); - ctk_help_heading(b, &i, "Firmware Version"); - ctk_help_para(b, &i, "The Firmware Version reports the version " - "of the firmware running on the GVI device."); + ctk_help_heading(b, &i, _("Firmware Version")); + ctk_help_para(b, &i, _("The Firmware Version reports the version " + "of the firmware running on the GVI device.")); - ctk_help_heading(b, &i, "Bus Type"); - ctk_help_para(b, &i, "This is the bus type which is " + ctk_help_heading(b, &i, _("Bus Type")); + ctk_help_para(b, &i, _("This is the bus type which is " "used to connect the NVIDIA GVI device to the rest of " "your computer; possible values are AGP, PCI, " - "PCI Express and Integrated."); + "PCI Express and Integrated.")); - ctk_help_heading(b, &i, "Bus ID"); - ctk_help_para(b, &i, "This is the GVI device's PCI identification string, " + ctk_help_heading(b, &i, _("Bus ID")); + ctk_help_para(b, &i, _("This is the GVI device's PCI identification string, " "reported in the form 'bus:device:function'. It uniquely " - "identifies the GVI device's location in the host system."); + "identifies the GVI device's location in the host system.")); - ctk_help_heading(b, &i, "IRQ"); - ctk_help_para(b, &i, "This is the interrupt request line assigned to " - "this GVI device."); + ctk_help_heading(b, &i, _("IRQ")); + ctk_help_para(b, &i, _("This is the interrupt request line assigned to " + "this GVI device.")); - ctk_help_heading(b, &i, "Bound GPU"); - ctk_help_para(b, &i, "An OpenGL application can bind a GVI device to a " + ctk_help_heading(b, &i, _("Bound GPU")); + ctk_help_para(b, &i, _("An OpenGL application can bind a GVI device to a " "GPU using the GL_NV_video_capture OpenGL extension. The " "Bound GPU field reports if an OpenGL application has " - "currently bound this GVI device to a GPU."); + "currently bound this GVI device to a GPU.")); - ctk_help_heading(b, &i, "Input Information"); - ctk_help_para(b, &i, "This section shows the detected video format(s) on " + ctk_help_heading(b, &i, _("Input Information")); + ctk_help_para(b, &i, _("This section shows the detected video format(s) on " "each jack of the GVI device. When condensed mode is " "selected, the detected video format is shown for each " "jack (and channel). When detailed mode is selected, " "information pertaining to the selected jack is reported. " "Note that the GVI device can only detect the following " "information if the incoming signal has a non-zero SMPTE " - "352 payload identifier, which not all SDI devices provide."); - - ctk_help_para(b, &i, "Video Format: The detected SMPTE video format."); - ctk_help_para(b, &i, "Component Sampling: The detected composition of the " - "channel."); - ctk_help_para(b, &i, "Color Space: The detected color space."); - ctk_help_para(b, &i, "Bites Per Component: The detected number of bits " - "per component."); - ctk_help_para(b, &i, "Link ID: The detected link ID of the channel."); + "352 payload identifier, which not all SDI devices provide.")); + + ctk_help_para(b, &i, _("Video Format: The detected SMPTE video format.")); + ctk_help_para(b, &i, _("Component Sampling: The detected composition of the " + "channel.")); + ctk_help_para(b, &i, _("Color Space: The detected color space.")); + ctk_help_para(b, &i, _("Bites Per Component: The detected number of bits " + "per component.")); + ctk_help_para(b, &i, _("Link ID: The detected link ID of the channel.")); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkgvo-banner.c b/src/gtk+-2.x/ctkgvo-banner.c index 4a347678..dbc6dc3e 100644 --- a/src/gtk+-2.x/ctkgvo-banner.c +++ b/src/gtk+-2.x/ctkgvo-banner.c @@ -27,6 +27,7 @@ #include #include +#include #include "NvCtrlAttributes.h" @@ -37,7 +38,7 @@ #include "msg.h" - +#define _(STRING) gettext(STRING) /* values for controlling LED state */ @@ -291,7 +292,7 @@ GtkWidget* ctk_gvo_banner_new(CtrlTarget *ctrl_target, ctk_config_add_timer(ctk_gvo_banner->ctk_config, DEFAULT_GVO_PROBE_TIME_INTERVAL, - "Graphics To Video Probe", + _("Graphics To Video Probe"), (GSourceFunc) ctk_gvo_banner_probe, (gpointer) ctk_gvo_banner); diff --git a/src/gtk+-2.x/ctkgvo-csc.c b/src/gtk+-2.x/ctkgvo-csc.c index 1faf68b3..f6cd619a 100644 --- a/src/gtk+-2.x/ctkgvo-csc.c +++ b/src/gtk+-2.x/ctkgvo-csc.c @@ -21,6 +21,7 @@ #include #include +#include #include "ctkbanner.h" #include "ctkconfig.h" @@ -31,6 +32,9 @@ #include "msg.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + /* * The CtkGvoCsc widget is used to provide a way for configuring * custom Color Space Conversion Matrices, Offsets, and Scale Factors @@ -132,25 +136,25 @@ static GtkWidget *build_opengl_only_msg (void); /* General information help */ static const char * __override_help = -"The Override default Color Space Conversion checkbox will toggle use of " -"custom CSC."; +N_("The Override default Color Space Conversion checkbox will toggle use of " +"custom CSC."); static const char * __initialize_help = -"The Initialize Color Space Conversion drop down menu, when selected, " +N_("The Initialize Color Space Conversion drop down menu, when selected, " "populates the Color Space Conversion Matrix, Offset, and Scale with the " -"values from the selected standard."; +"values from the selected standard."); static const char * __csc_help = -"The color space conversion matrix defines the parameters used for " -"converting the color data."; +N_("The color space conversion matrix defines the parameters used for " +"converting the color data."); static const char * __apply_immediately_help = -"The Apply Changes Immediately checkbox toggles whether or not changes made " -"to the CSC matrix immediately take effect."; +N_("The Apply Changes Immediately checkbox toggles whether or not changes made " +"to the CSC matrix immediately take effect."); static const char * __apply_help = -"The Apply button sends the new values of the color space conversion matrix " -"to the server."; +N_("The Apply button sends the new values of the color space conversion matrix " +"to the server."); @@ -254,10 +258,10 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, /* checkbox to enable override of HW CSC */ ctk_gvo_csc->overrideButton = gtk_check_button_new_with_label - ("Override default Color Space Conversion"); + (_("Override default Color Space Conversion")); ctk_config_set_tooltip(ctk_config, ctk_gvo_csc->overrideButton, - __override_help); + _(__override_help)); g_signal_connect(G_OBJECT(ctk_gvo_csc->overrideButton), "toggled", G_CALLBACK(override_button_toggled), ctk_gvo_csc); @@ -321,7 +325,7 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, FALSE, // fill 0); // padding - label = gtk_label_new("Initialize Color Space Conversion with:"); + label = gtk_label_new(_("Initialize Color Space Conversion with:")); gtk_box_pack_start(GTK_BOX(hbox), label, @@ -336,7 +340,7 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, ctk_drop_down_menu_set_tooltip (ctk_config, CTK_DROP_DOWN_MENU(ctk_gvo_csc->initializeDropDown), - __initialize_help); + _(__initialize_help)); ctk_drop_down_menu_append_item (CTK_DROP_DOWN_MENU(ctk_gvo_csc->initializeDropDown), @@ -440,7 +444,7 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, ctk_config_set_tooltip(ctk_config, ctk_gvo_csc->matrixWidget[row][column], - __csc_help); + _(__csc_help)); } } @@ -462,7 +466,7 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, 1, // columns FALSE); // homogeneous - make_label(ctk_gvo_csc, ctk_gvo_csc->offsetTable, "Offset", 0, 0); + make_label(ctk_gvo_csc, ctk_gvo_csc->offsetTable, _("Offset"), 0, 0); gtk_container_add(GTK_CONTAINER(frame), ctk_gvo_csc->offsetTable); @@ -478,7 +482,7 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, 0); ctk_config_set_tooltip(ctk_config, - ctk_gvo_csc->offsetWidget[row], __csc_help); + ctk_gvo_csc->offsetWidget[row], _(__csc_help)); } @@ -499,7 +503,7 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, 1, // columns FALSE); // homogeneous - make_label(ctk_gvo_csc, ctk_gvo_csc->scaleTable, "Scale" , 0, 0); + make_label(ctk_gvo_csc, ctk_gvo_csc->scaleTable, _("Scale") , 0, 0); gtk_container_add(GTK_CONTAINER(frame), ctk_gvo_csc->scaleTable); @@ -515,7 +519,7 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, 0); ctk_config_set_tooltip(ctk_config, - ctk_gvo_csc->scaleWidget[row], __csc_help); + ctk_gvo_csc->scaleWidget[row], _(__csc_help)); } @@ -527,11 +531,11 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, if (caps & NV_CTRL_GVO_CAPABILITIES_APPLY_CSC_IMMEDIATELY) { ctk_gvo_csc->applyImmediateButton = - gtk_check_button_new_with_label("Apply Changes Immediately"); + gtk_check_button_new_with_label(_("Apply Changes Immediately")); ctk_config_set_tooltip(ctk_config, ctk_gvo_csc->applyImmediateButton, - __apply_immediately_help); + _(__apply_immediately_help)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ctk_gvo_csc->applyImmediateButton), FALSE); @@ -555,7 +559,7 @@ GtkWidget* ctk_gvo_csc_new(CtrlTarget *ctrl_target, ctk_gvo_csc->applyButton = gtk_button_new_from_stock(GTK_STOCK_APPLY); - ctk_config_set_tooltip(ctk_config, ctk_gvo_csc->applyButton, __apply_help); + ctk_config_set_tooltip(ctk_config, ctk_gvo_csc->applyButton, _(__apply_help)); g_signal_connect(G_OBJECT(ctk_gvo_csc->applyButton), "clicked", @@ -1147,9 +1151,9 @@ static GtkWidget *build_opengl_only_msg(void) /* create the label */ - label = gtk_label_new("Note that the overridden Color Space Conversion " + label = gtk_label_new(_("Note that the overridden Color Space Conversion " "will only apply to OpenGL applications " - "using the GLX_NV_video_out extension."); + "using the GLX_NV_video_out extension.")); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); @@ -1158,7 +1162,7 @@ static GtkWidget *build_opengl_only_msg(void) pixbuf = gtk_widget_render_icon(label, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, - "CSC information message"); + _("CSC information message")); /* create a pixmap from the icon */ @@ -1250,53 +1254,53 @@ GtkTextBuffer *ctk_gvo_csc_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "Color Space Conversion Help"); - ctk_help_para(b, &i, "This page gives access to configuration of " - "the SDI (GVO) color space conversion."); + ctk_help_title(b, &i, _("Color Space Conversion Help")); + ctk_help_para(b, &i, _("This page gives access to configuration of " + "the SDI (GVO) color space conversion.")); - ctk_help_heading(b, &i, "Override default Color Space Conversion"); - ctk_help_para(b, &i, "%s", __override_help); + ctk_help_heading(b, &i, _("Override default Color Space Conversion")); + ctk_help_para(b, &i, "%s", _(__override_help)); - ctk_help_heading(b, &i, "Initialize Color Space Conversion"); - ctk_help_para(b, &i, "%s", __initialize_help); + ctk_help_heading(b, &i, _("Initialize Color Space Conversion")); + ctk_help_para(b, &i, "%s", _(__initialize_help)); - ctk_help_heading(b, &i, "Color Space Conversion Matrix, Offset and Scale"); - ctk_help_para(b, &i, "%s RGB color is converted to YCrCb in the " - "following manner:", - __csc_help); + ctk_help_heading(b, &i, _("Color Space Conversion Matrix, Offset and Scale")); + ctk_help_para(b, &i, _("%s RGB color is converted to YCrCb in the " + "following manner:"), + _(__csc_help)); ctk_help_para(b, &i, "Y = Ky + Sy * ( Ry*R + Gy*G + By*B )\n" "Cb = Kcb + Scb * ( Rcb*R + Gcb*G + Bcb*B )\n" "Cr = Kcr + Scr * ( Rcr*R + Gcr*G + Bcr*B )"); ctk_help_para(b, &i, "Where:"); ctk_help_para(b, &i, - "Ky = Y (luma) Offset\n" + _("Ky = Y (luma) Offset\n" "Kcb = Cr (red chroma) Offset\n" - "Kcr = Cb (blue chroma) Offset"); + "Kcr = Cb (blue chroma) Offset")); ctk_help_para(b, &i, - "Sy = Y scaling factor\n" + _("Sy = Y scaling factor\n" "Scb = Cb Scaling factor\n" - "Scr = Cr Scaling factor"); + "Scr = Cr Scaling factor")); ctk_help_para(b, &i, - "Ry = Red coefficient for Y\n" + _("Ry = Red coefficient for Y\n" "Rcb = Red coefficient for Cb\n" - "Rcr = Red coefficient for Cr"); + "Rcr = Red coefficient for Cr")); ctk_help_para(b, &i, - "Gy = Green coefficient for Y\n" + _("Gy = Green coefficient for Y\n" "Gcb = Green coefficient for Cb\n" - "Gcr = Green coefficient for Cr"); + "Gcr = Green coefficient for Cr")); ctk_help_para(b, &i, - "By = Blue coefficient for Y\n" + _("By = Blue coefficient for Y\n" "Bcb = Blue coefficient for Cb\n" - "Bcr = Blue coefficient for Cr"); + "Bcr = Blue coefficient for Cr")); if (ctk_gvo_csc->caps & NV_CTRL_GVO_CAPABILITIES_APPLY_CSC_IMMEDIATELY) { - ctk_help_heading(b, &i, "Apply Changes Immediately"); - ctk_help_para(b, &i, "%s", __apply_immediately_help); + ctk_help_heading(b, &i, _("Apply Changes Immediately")); + ctk_help_para(b, &i, "%s", _(__apply_immediately_help)); } - ctk_help_heading(b, &i, "Apply"); - ctk_help_para(b, &i, "%s", __apply_help); + ctk_help_heading(b, &i, _("Apply")); + ctk_help_para(b, &i, "%s", _(__apply_help)); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkgvo-sync.c b/src/gtk+-2.x/ctkgvo-sync.c index 72e5bfea..6258231f 100644 --- a/src/gtk+-2.x/ctkgvo-sync.c +++ b/src/gtk+-2.x/ctkgvo-sync.c @@ -21,6 +21,7 @@ #include #include +#include #include "ctkbanner.h" @@ -33,6 +34,8 @@ #include "ctkdropdownmenu.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING /* * The CtkGvoSync widget is used to provide a way for configuring @@ -102,44 +105,44 @@ static gint gvo_sync_probe_callback(gpointer data); /* Help tooltips */ static const char * __input_video_format_help = -"The Input Video Format text entry indicates the input video format detected " -"on the input BNC."; +N_("The Input Video Format text entry indicates the input video format detected " +"on the input BNC."); static const char * __input_video_format_detect_help = -"The Input Video Format Detect button will (re)detect the video format on " -"the input BNC."; +N_("The Input Video Format Detect button will (re)detect the video format on " +"the input BNC."); static const char * __composite_termination_help = -"The Enable Composite Termination checkbox enables the 75 ohm termination " -"of the composite input signal"; +N_("The Enable Composite Termination checkbox enables the 75 ohm termination " +"of the composite input signal"); static const char * __sync_mode_help = -"The Sync Mode dropdown allows you to select how the SDI device syncs its " -"output to the input signal."; +N_("The Sync Mode dropdown allows you to select how the SDI device syncs its " +"output to the input signal."); static const char * __sync_format_help = -"The Sync Format dropdown allows you to select the format of the input sync " -"signal."; +N_("The Sync Format dropdown allows you to select the format of the input sync " +"signal."); static const char * __sync_status_help = -"The Sync Status reports on how the SDI device is currently syncing to the " -"input sync signal."; +N_("The Sync Status reports on how the SDI device is currently syncing to the " +"input sync signal."); static const char * __hsync_delay_help = -"The HSync Delay entry allows you to specify the horizontal delay between the " -"input signal and the output signal generated by the SDI device."; +N_("The HSync Delay entry allows you to specify the horizontal delay between the " +"input signal and the output signal generated by the SDI device."); static const char * __hsync_advance_help = -"The HSync Advance entry allows you to specify the horizontal advance between " -"the input signal and the output signal generated by the SDI device."; +N_("The HSync Advance entry allows you to specify the horizontal advance between " +"the input signal and the output signal generated by the SDI device."); static const char * __vsync_delay_help = -"The VSync Delay entry allows you to specify the vertical delay between the " -"input signal and the output signal generated by the SDI device."; +N_("The VSync Delay entry allows you to specify the vertical delay between the " +"input signal and the output signal generated by the SDI device."); static const char * __vsync_advance_help = -"The VSync Advance entry allows you to specify the vertical advance between " -"the input signal and the output signal generated by the SDI device."; +N_("The VSync Advance entry allows you to specify the vertical advance between " +"the input signal and the output signal generated by the SDI device."); @@ -272,7 +275,7 @@ static void set_sync_format_menu(CtkGvoSync *ctk_gvo_sync) static void update_sync_lock_status_text(CtkGvoSync *ctk_gvo_sync) { - gchar *str = "Free Running"; + gchar *str = _("Free Running"); switch (ctk_gvo_sync->sync_mode) { @@ -284,7 +287,7 @@ static void update_sync_lock_status_text(CtkGvoSync *ctk_gvo_sync) gtk_widget_set_sensitive(ctk_gvo_sync->sync_lock_status_text, TRUE); if (ctk_gvo_sync->sync_lock_status == NV_CTRL_GVO_SYNC_LOCK_STATUS_LOCKED) { - str = "GenLocked"; + str = _("GenLocked"); } break; @@ -292,12 +295,12 @@ static void update_sync_lock_status_text(CtkGvoSync *ctk_gvo_sync) gtk_widget_set_sensitive(ctk_gvo_sync->sync_lock_status_text, TRUE); if (ctk_gvo_sync->sync_lock_status == NV_CTRL_GVO_SYNC_LOCK_STATUS_LOCKED) { - str = "FrameLocked"; + str = _("FrameLocked"); } break; default: gtk_widget_set_sensitive(ctk_gvo_sync->sync_lock_status_text, FALSE); - str = "Unknown"; + str = _("Unknown"); break; } @@ -378,7 +381,7 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, * Sync options */ - frame = gtk_frame_new("Sync Options"); + frame = gtk_frame_new(_("Sync Options")); ctk_gvo_sync->frame = frame; gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); @@ -391,7 +394,7 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, /* input video format */ - label = gtk_label_new("Input Video Format: "); + label = gtk_label_new(_("Input Video Format: ")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, @@ -403,7 +406,7 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, ctk_config_set_tooltip(ctk_config, ctk_gvo_sync->input_video_format_text_entry, - __input_video_format_help); + _(__input_video_format_help)); gtk_entry_set_width_chars (GTK_ENTRY(ctk_gvo_sync->input_video_format_text_entry), @@ -420,14 +423,14 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, /* Input video format detect button */ - button = gtk_toggle_button_new_with_label("Detect"); + button = gtk_toggle_button_new_with_label(_("Detect")); alignment = gtk_alignment_new(1, 1, 0, 0); gtk_container_add(GTK_CONTAINER(alignment), button); ctk_gvo_sync->input_video_format_detect_button = button; ctk_config_set_tooltip(ctk_config, button, - __input_video_format_detect_help); + _(__input_video_format_detect_help)); g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(detect_input_toggled), ctk_gvo_sync); @@ -443,10 +446,10 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, if (ctk_gvo_sync->caps & NV_CTRL_GVO_CAPABILITIES_COMPOSITE_TERMINATION) { button = - gtk_check_button_new_with_label("Enable Composite Termination"); + gtk_check_button_new_with_label(_("Enable Composite Termination")); ctk_config_set_tooltip(ctk_config, button, - __composite_termination_help); + _(__composite_termination_help)); alignment = gtk_alignment_new(1, 1, 0, 0); @@ -471,15 +474,15 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, /* Sync Mode */ - menu = start_menu("Sync Mode: ", table, row); + menu = start_menu(_("Sync Mode: "), table, row); - ctk_drop_down_menu_append_item(CTK_DROP_DOWN_MENU(menu), "Free Running", + ctk_drop_down_menu_append_item(CTK_DROP_DOWN_MENU(menu), _("Free Running"), NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING); - ctk_drop_down_menu_append_item(CTK_DROP_DOWN_MENU(menu), "GenLock", + ctk_drop_down_menu_append_item(CTK_DROP_DOWN_MENU(menu), _("GenLock"), NV_CTRL_GVO_SYNC_MODE_GENLOCK); - ctk_drop_down_menu_append_item(CTK_DROP_DOWN_MENU(menu), "FrameLock", + ctk_drop_down_menu_append_item(CTK_DROP_DOWN_MENU(menu), _("FrameLock"), NV_CTRL_GVO_SYNC_MODE_FRAMELOCK); finish_menu(menu, table, row); @@ -488,7 +491,7 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, ctk_gvo_sync->sync_mode_menu = menu; ctk_drop_down_menu_set_tooltip(ctk_config, CTK_DROP_DOWN_MENU(menu), - __sync_mode_help); + _(__sync_mode_help)); ctk_drop_down_menu_set_current_value (CTK_DROP_DOWN_MENU(ctk_gvo_sync->sync_mode_menu), @@ -499,7 +502,7 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, /* Sync Format */ - menu = start_menu("Sync Format: ", table, row); + menu = start_menu(_("Sync Format: "), table, row); for (i = 0; syncFormatNames[i].name; i++) { ctk_drop_down_menu_append_item(CTK_DROP_DOWN_MENU(menu), @@ -513,7 +516,7 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, ctk_gvo_sync->sync_format_menu = menu; ctk_drop_down_menu_set_tooltip(ctk_config, CTK_DROP_DOWN_MENU(menu), - __sync_format_help); + _(__sync_format_help)); init_sync_format_menu(ctk_gvo_sync); @@ -523,7 +526,7 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, /* Sync Status */ - label = gtk_label_new("Sync Status:"); + label = gtk_label_new(_("Sync Status:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row+1, GTK_FILL, GTK_FILL, TABLE_PADDING, TABLE_PADDING); @@ -561,11 +564,11 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, if (ret != NvCtrlSuccess) val = 0; if (ctk_gvo_sync->caps & NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW) { - label = gtk_label_new("HSync Advance:"); - help_text = __hsync_advance_help; + label = gtk_label_new(_("HSync Advance:")); + help_text = _(__hsync_advance_help); } else { - label = gtk_label_new("HSync Delay:"); - help_text = __hsync_delay_help; + label = gtk_label_new(_("HSync Delay:")); + help_text = _(__hsync_delay_help); } gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -618,11 +621,11 @@ GtkWidget* ctk_gvo_sync_new(CtrlTarget *ctrl_target, if (ret != NvCtrlSuccess) val = 0; if (ctk_gvo_sync->caps & NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW) { - label = gtk_label_new("VSync Advance:"); - help_text = __vsync_advance_help; + label = gtk_label_new(_("VSync Advance:")); + help_text = _(__vsync_advance_help); } else { - label = gtk_label_new("VSync Delay:"); - help_text = __vsync_delay_help; + label = gtk_label_new(_("VSync Delay:")); + help_text = _(__vsync_delay_help); } gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -954,9 +957,9 @@ static void update_input_video_format_text_entry(CtkGvoSync *ctk_gvo_sync) const gchar *str; if (ctk_gvo_sync->sync_mode == NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING) { - str = "Free Running"; + str = _("Free Running"); } else { - str = "No incoming signal detected"; + str = _("No incoming signal detected"); for (i = 0; videoFormatNames[i].name; i++) { if (videoFormatNames[i].format == ctk_gvo_sync->input_video_format) { str = videoFormatNames[i].name; @@ -980,8 +983,7 @@ static void post_composite_termination_toggled(CtkGvoSync *ctk_gvo_sync, /* update the statusbar */ ctk_config_statusbar_message(ctk_gvo_sync->ctk_config, - "Composite Termination %s.", - enabled ? "Enabled" : "Disabled"); + enabled ? _("Composite Termination Enabled.") : _("Composite Termination Disabled.")); } /* post_composite_termination_toggled() */ @@ -1003,14 +1005,14 @@ static void post_sync_mode_menu_changed(CtkGvoSync *ctk_gvo_sync, gint value) update_gvo_sync_sensitivity(ctk_gvo_sync); switch (value) { - case NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING: name = "Free Running"; break; - case NV_CTRL_GVO_SYNC_MODE_GENLOCK: name = "GenLock"; break; - case NV_CTRL_GVO_SYNC_MODE_FRAMELOCK: name = "FrameLock"; break; + case NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING: name = _("Free Running"); break; + case NV_CTRL_GVO_SYNC_MODE_GENLOCK: name = _("GenLock"); break; + case NV_CTRL_GVO_SYNC_MODE_FRAMELOCK: name = _("FrameLock"); break; default: return; } ctk_config_statusbar_message(ctk_gvo_sync->ctk_config, - "Sync Mode set to %s.", name); + _("Sync Mode set to %s."), name); } /* post_sync_mode_menu_changed() */ @@ -1023,7 +1025,7 @@ static void post_sync_mode_menu_changed(CtkGvoSync *ctk_gvo_sync, gint value) static void post_sync_format_menu_changed(CtkGvoSync *ctk_gvo_sync) { - const char *name = "Unknown"; + const char *name = _("Unknown"); gint value; gint i; @@ -1040,7 +1042,7 @@ static void post_sync_format_menu_changed(CtkGvoSync *ctk_gvo_sync) } ctk_config_statusbar_message(ctk_gvo_sync->ctk_config, - "Sync Format set to \"%s\".", name); + _("Sync Format set to \"%s\"."), name); } /* post_sync_format_menu_changed() */ @@ -1089,7 +1091,7 @@ static void detect_input_toggled(GtkToggleButton *togglebutton, /* update the statusbar */ ctk_config_statusbar_message(ctk_gvo_sync->ctk_config, - "Detecting incoming signal..."); + _("Detecting incoming signal...")); /* register the "done" function */ @@ -1138,7 +1140,7 @@ static gint detect_input_done(gpointer data) /* update the status bar */ ctk_config_statusbar_message(ctk_gvo_sync->ctk_config, - "Done detecting incoming signal."); + _("Done detecting incoming signal.")); /* restore sensitivity */ @@ -1515,36 +1517,36 @@ GtkTextBuffer* ctk_gvo_sync_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "GVO (Graphics to Video Out) Synchronization " - "options"); - ctk_help_para(b, &i, "This page gives access to configuration of the " - "SDI synchronization options."); - - ctk_help_heading(b, &i, "Input Video Format"); - ctk_help_para(b, &i, "%s", __input_video_format_help); - ctk_help_heading(b, &i, "Input Video Format Detect"); - ctk_help_para(b, &i, "%s", __input_video_format_detect_help); - ctk_help_heading(b, &i, "Composite Termination"); - ctk_help_para(b, &i, "%s. This allows the composite signal to be daisy " - "chained from a server load.", - __composite_termination_help); - ctk_help_heading(b, &i, "Sync Mode"); - ctk_help_para(b, &i, "%s", __sync_mode_help); - ctk_help_heading(b, &i, "Sync Format"); - ctk_help_para(b, &i, "%s", __sync_format_help); - ctk_help_heading(b, &i, "Sync Status"); - ctk_help_para(b, &i, "%s", __sync_status_help); + ctk_help_title(b, &i, _("GVO (Graphics to Video Out) Synchronization " + "options")); + ctk_help_para(b, &i, _("This page gives access to configuration of the " + "SDI synchronization options.")); + + ctk_help_heading(b, &i, _("Input Video Format")); + ctk_help_para(b, &i, "%s", _(__input_video_format_help)); + ctk_help_heading(b, &i, _("Input Video Format Detect")); + ctk_help_para(b, &i, "%s", _(__input_video_format_detect_help)); + ctk_help_heading(b, &i, _("Composite Termination")); + ctk_help_para(b, &i, _("%s. This allows the composite signal to be daisy " + "chained from a server load."), + _(__composite_termination_help)); + ctk_help_heading(b, &i, _("Sync Mode")); + ctk_help_para(b, &i, "%s", _(__sync_mode_help)); + ctk_help_heading(b, &i, _("Sync Format")); + ctk_help_para(b, &i, "%s", _(__sync_format_help)); + ctk_help_heading(b, &i, _("Sync Status")); + ctk_help_para(b, &i, "%s", _(__sync_status_help)); if ( ctk_gvo_sync->caps & NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW ) { - ctk_help_heading(b, &i, "HSync Advance"); - ctk_help_para(b, &i, "%s", __hsync_advance_help); - ctk_help_heading(b, &i, "VSync Advance"); - ctk_help_para(b, &i, "%s", __vsync_advance_help); + ctk_help_heading(b, &i, _("HSync Advance")); + ctk_help_para(b, &i, "%s", _(__hsync_advance_help)); + ctk_help_heading(b, &i, _("VSync Advance")); + ctk_help_para(b, &i, "%s", _(__vsync_advance_help)); } else { - ctk_help_heading(b, &i, "HSync Delay"); - ctk_help_para(b, &i, "%s", __hsync_delay_help); - ctk_help_heading(b, &i, "VSync Delay"); - ctk_help_para(b, &i, "%s", __vsync_delay_help); + ctk_help_heading(b, &i, _("HSync Delay")); + ctk_help_para(b, &i, "%s", _(__hsync_delay_help)); + ctk_help_heading(b, &i, _("VSync Delay")); + ctk_help_para(b, &i, "%s", _(__vsync_delay_help)); } ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkgvo.c b/src/gtk+-2.x/ctkgvo.c index 14d960ba..12e399cd 100644 --- a/src/gtk+-2.x/ctkgvo.c +++ b/src/gtk+-2.x/ctkgvo.c @@ -19,6 +19,7 @@ #include #include +#include #include @@ -38,27 +39,29 @@ #define TABLE_PADDING 5 +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING /* General information help */ static const char *__general_firmware_version_help = -"The Firmware Version reports the version of the firmware running on the " -"SDI device."; +N_("The Firmware Version reports the version of the firmware running on the " +"SDI device."); static const char *__general_current_sdi_resolution_help = -"The Current SDI Resolution reports the current active resolution that the " -"SDI device is driving or 'Inactive' if SDI is currently disabled."; +N_("The Current SDI Resolution reports the current active resolution that the " +"SDI device is driving or 'Inactive' if SDI is currently disabled."); static const char *__general_current_sdi_state_help = -"The Current SDI state reports the current usage of the SDI device."; +N_("The Current SDI state reports the current usage of the SDI device."); static const char *__requested_sdi_video_format_help = -"The Requested SDI Video Format indicates what video format is currently " -"requested through NV-CONTROL."; +N_("The Requested SDI Video Format indicates what video format is currently " +"requested through NV-CONTROL."); static const char *__requested_sdi_data_format_help = -"The Requested SDI Data Format indicates what data format is currently " -"requested through NV-CONTROL."; +N_("The Requested SDI Data Format indicates what data format is currently " +"requested through NV-CONTROL."); /* local prototypes */ @@ -268,7 +271,7 @@ const char *ctk_gvio_get_video_format_name(const gint format) } } - return "Unknown"; + return _("Unknown"); } /* ctk_gvio_get_video_format_name() */ @@ -310,7 +313,7 @@ const char *ctk_gvo_get_data_format_name(const gint format) } } - return "Unknown"; + return _("Unknown"); } /* ctk_gvo_get_data_format_name() */ @@ -413,7 +416,7 @@ GtkWidget* ctk_gvo_new(CtrlTarget *ctrl_target, * General information */ - frame = gtk_frame_new("General Information"); + frame = gtk_frame_new(_("General Information")); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); @@ -454,22 +457,22 @@ GtkWidget* ctk_gvo_new(CtrlTarget *ctrl_target, } add_table_row(table, 0, - 0, 0.5, "Firmware Version:", + 0, 0.5, _("Firmware Version:"), 0, 0.5, firmware); ctk_gvo->current_resolution_label = add_table_row(table, 1, - 0, 0.5, "Current SDI Resolution:", - 0, 0.5, "Inactive"); + 0, 0.5, _("Current SDI Resolution:"), + 0, 0.5, _("Inactive")); ctk_gvo->current_state_label = add_table_row(table, 2, - 0, 0.5, "Current SDI State:", - 0, 0.5, "Inactive"); + 0, 0.5, _("Current SDI State:"), + 0, 0.5, _("Inactive")); /* * Requested SDI Configuration */ - frame = gtk_frame_new("Requested SDI Configuration"); + frame = gtk_frame_new(_("Requested SDI Configuration")); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); @@ -483,12 +486,12 @@ GtkWidget* ctk_gvo_new(CtrlTarget *ctrl_target, ctk_gvo->current_output_video_format_label = add_table_row(table, 3, - 0, 0.5, "Requested SDI Video Format:", - 0, 0.5, "Inactive"); + 0, 0.5, _("Requested SDI Video Format:"), + 0, 0.5, _("Inactive")); ctk_gvo->current_output_data_format_label = add_table_row(table, 4, - 0, 0.5, "Requested SDI Data Format:", - 0, 0.5, "Inactive"); + 0, 0.5, _("Requested SDI Data Format:"), + 0, 0.5, _("Inactive")); /* * Set the initial UI state @@ -667,20 +670,20 @@ static void update_gvo_current_info(CtkGvo *ctk_gvo) switch (lock_owner) { case NV_CTRL_GVO_LOCK_OWNER_NONE: - snprintf(res_string, 64, "Inactive"); - snprintf(state_string, 64, "Inactive"); + snprintf(res_string, 64, _("Inactive")); + snprintf(state_string, 64, _("Inactive")); break; case NV_CTRL_GVO_LOCK_OWNER_CLONE: /* fall through for compatibility */ case NV_CTRL_GVO_LOCK_OWNER_X_SCREEN: snprintf(res_string, 64, "%d x %d", width, height); - snprintf(state_string, 64, "In use by X"); + snprintf(state_string, 64, _("In use by X")); break; case NV_CTRL_GVO_LOCK_OWNER_GLX: snprintf(res_string, 64, "%d x %d", width, height); - snprintf(state_string, 64, "In use by GLX"); + snprintf(state_string, 64, _("In use by GLX")); break; default: @@ -781,24 +784,24 @@ GtkTextBuffer* ctk_gvo_create_help(GtkTextTagTable *table) gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "GVO (Graphics to Video Out) Help"); - ctk_help_para(b, &i, "This page reports general information about the SDI " - "device."); - - ctk_help_heading(b, &i, "General Information"); - ctk_help_para(b, &i, "This section shows information about the SDI device " - "that is associated with the X screen."); - ctk_help_heading(b, &i, "Firmware Version"); - ctk_help_para(b, &i, "%s", __general_firmware_version_help); - ctk_help_heading(b, &i, "Current SDI Resolution"); - ctk_help_para(b, &i, "%s", __general_current_sdi_resolution_help); - ctk_help_heading(b, &i, "Current SDI State"); - ctk_help_para(b, &i, "%s", __general_current_sdi_state_help); - - ctk_help_heading(b, &i, "Requested SDI Video Format"); - ctk_help_para(b, &i, "%s", __requested_sdi_video_format_help); - ctk_help_heading(b, &i, "Requested SDI Data Format"); - ctk_help_para(b, &i, "%s", __requested_sdi_data_format_help); + ctk_help_title(b, &i, _("GVO (Graphics to Video Out) Help")); + ctk_help_para(b, &i, _("This page reports general information about the SDI " + "device.")); + + ctk_help_heading(b, &i, _("General Information")); + ctk_help_para(b, &i, _("This section shows information about the SDI device " + "that is associated with the X screen.")); + ctk_help_heading(b, &i, _("Firmware Version")); + ctk_help_para(b, &i, "%s", _(__general_firmware_version_help)); + ctk_help_heading(b, &i, _("Current SDI Resolution")); + ctk_help_para(b, &i, "%s", _(__general_current_sdi_resolution_help)); + ctk_help_heading(b, &i, _("Current SDI State")); + ctk_help_para(b, &i, "%s", _(__general_current_sdi_state_help)); + + ctk_help_heading(b, &i, _("Requested SDI Video Format")); + ctk_help_para(b, &i, "%s", _(__requested_sdi_video_format_help)); + ctk_help_heading(b, &i, _("Requested SDI Data Format")); + ctk_help_para(b, &i, "%s", _(__requested_sdi_data_format_help)); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkhelp.c b/src/gtk+-2.x/ctkhelp.c index 6a504610..e2b5b6f1 100644 --- a/src/gtk+-2.x/ctkhelp.c +++ b/src/gtk+-2.x/ctkhelp.c @@ -27,6 +27,9 @@ #include #include +#include + +#define _(STRING) gettext(STRING) static GtkTextBuffer *create_default_help(CtkHelp *ctk_help); static void close_button_clicked(GtkButton *button, gpointer user_data); @@ -82,7 +85,7 @@ GtkWidget* ctk_help_new(GtkWidget *toggle_button, GtkTextTagTable *tag_table) ctk_help->toggle_button = toggle_button; gtk_window_set_title(GTK_WINDOW(ctk_help), - "NVIDIA X Server Settings Help"); + _("NVIDIA X Server Settings Help")); gtk_window_set_default_size(GTK_WINDOW(ctk_help), -1, 400); @@ -203,11 +206,11 @@ static GtkTextBuffer *create_default_help(CtkHelp *ctk_help) gtk_text_buffer_get_iter_at_offset(buffer, &iter, 0); gtk_text_buffer_insert_with_tags_by_name - (buffer, &iter, "\nNVIDIA X Server Settings Help", -1, + (buffer, &iter, _("\nNVIDIA X Server Settings Help"), -1, CTK_HELP_TITLE_TAG, NULL); - gtk_text_buffer_insert(buffer, &iter, "\n\nThere is no help available " - "for this page.", -1); + gtk_text_buffer_insert(buffer, &iter, _("\n\nThere is no help available " + "for this page."), -1); /* * Apply CTK_HELP_HEADING_NOT_EDITABLE_TAG and @@ -406,14 +409,14 @@ void ctk_help_finish(GtkTextBuffer *buffer) gchar *ctk_help_create_reset_hardware_defaults_text(gchar *type, gchar *name) { - return g_strconcat("The Reset ", type, " Hardware Defaults button restores ", - "all ", name, " settings to their default values.", NULL); + return g_strdup_printf(_("The Reset %s Hardware Defaults button restores " + "all %s settings to their default values."), type, name); } void ctk_help_reset_hardware_defaults(GtkTextBuffer *b, GtkTextIter *i, gchar *text) { - ctk_help_heading(b, i, "Reset Hardware Defaults"); + ctk_help_heading(b, i, _("Reset Hardware Defaults")); ctk_help_para(b, i, "%s", text); } diff --git a/src/gtk+-2.x/ctkimagesliders.c b/src/gtk+-2.x/ctkimagesliders.c index e3484629..4b92ca47 100644 --- a/src/gtk+-2.x/ctkimagesliders.c +++ b/src/gtk+-2.x/ctkimagesliders.c @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +#include + #include #include @@ -27,14 +29,16 @@ #include "ctkhelp.h" #include "ctkutils.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING #define FRAME_PADDING 5 -static const char *__digital_vibrance_help = "The Digital Vibrance slider " -"alters the level of Digital Vibrance for this display device."; +static const char *__digital_vibrance_help = N_("The Digital Vibrance slider " +"alters the level of Digital Vibrance for this display device."); -static const char *__image_sharpening_help = "The Image Sharpening slider " -"alters the level of Image Sharpening for this display device."; +static const char *__image_sharpening_help = N_("The Image Sharpening slider " +"alters the level of Image Sharpening for this display device."); static void ctk_image_sliders_class_init(CtkImageSliders *ctk_object_class); @@ -151,8 +155,8 @@ GtkWidget* ctk_image_sliders_new(CtrlTarget *ctrl_target, ctk_image_sliders->digital_vibrance = add_scale(ctk_config, - NV_CTRL_DIGITAL_VIBRANCE, "Digital Vibrance", - __digital_vibrance_help, G_TYPE_INT, + NV_CTRL_DIGITAL_VIBRANCE, _("Digital Vibrance"), + _(__digital_vibrance_help), G_TYPE_INT, 0, /* default value */ ctk_image_sliders); @@ -175,8 +179,8 @@ GtkWidget* ctk_image_sliders_new(CtrlTarget *ctrl_target, ctk_image_sliders->image_sharpening = add_scale(ctk_config, - NV_CTRL_IMAGE_SHARPENING, "Image Sharpening", - __image_sharpening_help, G_TYPE_INT, val, ctk_image_sliders); + NV_CTRL_IMAGE_SHARPENING, _("Image Sharpening"), + _(__image_sharpening_help), G_TYPE_INT, val, ctk_image_sliders); g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_IMAGE_SHARPENING), @@ -256,7 +260,7 @@ static void post_scale_value_changed(GtkAdjustment *adjustment, gtk_widget_set_sensitive(ctk_image_sliders->reset_button, TRUE); ctk_config_statusbar_message(ctk_image_sliders->ctk_config, - "%s set to %d.", name, value); + _("%s set to %d."), name, value); } /* post_scale_value_changed() */ @@ -412,17 +416,17 @@ void add_image_sliders_help(CtkImageSliders *ctk_image_sliders, GtkTextBuffer *b, GtkTextIter *i) { - ctk_help_heading(b, i, "Digital Vibrance"); - ctk_help_para(b, i, "Digital Vibrance, a mechanism for " + ctk_help_heading(b, i, _("Digital Vibrance")); + ctk_help_para(b, i, _("Digital Vibrance, a mechanism for " "controlling color separation and intensity, boosts " "the color saturation of an image so that all images " "including 2D, 3D, and video appear brighter and " - "crisper (even on flat panels) in your applications."); + "crisper (even on flat panels) in your applications.")); - ctk_help_heading(b, i, "Image Sharpening"); - ctk_help_para(b, i, "Use the Image Sharpening slider to adjust the " + ctk_help_heading(b, i, _("Image Sharpening")); + ctk_help_para(b, i, _("Use the Image Sharpening slider to adjust the " "sharpness of the image quality by amplifying high " - "frequency content."); + "frequency content.")); } /* add_image_sliders_help() */ diff --git a/src/gtk+-2.x/ctkmultisample.c b/src/gtk+-2.x/ctkmultisample.c index 07628cd5..b444642d 100644 --- a/src/gtk+-2.x/ctkmultisample.c +++ b/src/gtk+-2.x/ctkmultisample.c @@ -19,6 +19,7 @@ #include #include +#include #include "NvCtrlAttributes.h" @@ -28,6 +29,8 @@ #include "ctkhelp.h" #include "ctkbanner.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING /* local prototypes */ @@ -98,41 +101,41 @@ static void update_fxaa_from_fsaa_change(CtkMultisample *ctk_multisample, static void update_fsaa_from_fxaa_change(CtkMultisample *ctk_multisample, gboolean fxaa_enabled); static gchar *applicationSettings[] = { - "Use Application Settings", - "Override Application Settings", - "Enhance Application Settings" + N_("Use Application Settings"), + N_("Override Application Settings"), + N_("Enhance Application Settings") }; static const char *__aa_override_app_help = -"Enable the Antialiasing \"Override Application Setting\" " +N_("Enable the Antialiasing \"Override Application Setting\" " "checkbox to make the antialiasing slider active and " "override any application antialiasing setting with the " -"value of the slider."; +"value of the slider."); static const char *__aa_menu_help = -"The Application Antialiasing Settings Menu allows the antialiasing " +N_("The Application Antialiasing Settings Menu allows the antialiasing " "setting of OpenGL applications to be overridden with the value of " -"the slider."; +"the slider."); static const char *__aa_slider_help = -"The Antialiasing slider controls the level of antialiasing. Using " -"antialiasing disables FXAA."; +N_("The Antialiasing slider controls the level of antialiasing. Using " +"antialiasing disables FXAA."); static const char *__aniso_override_app_help = -"Enable the Anisotropic Filtering \"Override Application Setting\" " +N_("Enable the Anisotropic Filtering \"Override Application Setting\" " "checkbox to make the anisotropic filtering slider " "active and override any application anisotropic " -"filtering setting with the value of the slider."; +"filtering setting with the value of the slider."); static const char *__aniso_slider_help = -"The Anisotropic Filtering slider controls the " -"level of automatic anisotropic texture filtering."; +N_("The Anisotropic Filtering slider controls the " +"level of automatic anisotropic texture filtering."); static const char *__fxaa_enable_help = -"Enable Fast Approximate Anti-Aliasing. This option is applied to " +N_("Enable Fast Approximate Anti-Aliasing. This option is applied to " "OpenGL applications that are started after this option is set. Enabling " "FXAA disables triple buffering, antialiasing, and other antialiasing " -"setting methods."; +"setting methods."); /* @@ -268,7 +271,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, /* create "Antialiasing Settings" frame */ - frame = gtk_frame_new("Antialiasing Settings"); + frame = gtk_frame_new(_("Antialiasing Settings")); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); /* create the vbox to store the widgets inside the frame */ @@ -301,7 +304,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, /* Create a checkbox */ check_button = gtk_check_button_new_with_label - ("Override Application Setting"); + (_("Override Application Setting")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), override); @@ -311,7 +314,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, (gpointer) ctk_multisample); ctk_config_set_tooltip(ctk_config, check_button, - __aa_override_app_help); + _(__aa_override_app_help)); gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0); @@ -354,7 +357,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, G_CALLBACK(fsaa_update_received), (gpointer) ctk_multisample); - ctk_config_set_tooltip(ctk_config, scale, __aa_slider_help); + ctk_config_set_tooltip(ctk_config, scale, _(__aa_slider_help)); ctk_multisample->active_attributes |= __FSAA; ctk_multisample->fsaa_scale = scale; @@ -368,7 +371,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, /* FXAA Option button */ - check_button = gtk_check_button_new_with_label("Enable FXAA"); + check_button = gtk_check_button_new_with_label(_("Enable FXAA")); if (mode == NV_CTRL_FSAA_MODE_NONE) { ret = NvCtrlGetAttribute(ctrl_target, NV_CTRL_FXAA, &val); @@ -392,7 +395,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, (gpointer) ctk_multisample); ctk_config_set_tooltip(ctk_config, check_button, - __fxaa_enable_help); + _(__fxaa_enable_help)); gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0); ctk_multisample->active_attributes |= __FXAA; @@ -427,7 +430,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, /* create "Anisotropic Filtering" frame */ - frame = gtk_frame_new("Anisotropic Filtering"); + frame = gtk_frame_new(_("Anisotropic Filtering")); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); /* create the vbox to store the widgets inside the frame */ @@ -439,7 +442,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, /* "Override Application Setting" checkbox */ check_button = gtk_check_button_new_with_label - ("Override Application Setting"); + (_("Override Application Setting")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), override); @@ -455,7 +458,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, (gpointer) ctk_multisample); ctk_config_set_tooltip(ctk_config, check_button, - __aniso_override_app_help); + _(__aniso_override_app_help)); gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0); @@ -490,7 +493,7 @@ GtkWidget *ctk_multisample_new(CtrlTarget *ctrl_target, G_CALLBACK(log_aniso_range_update_received), (gpointer) ctk_multisample); - ctk_config_set_tooltip(ctk_config, scale, __aniso_slider_help); + ctk_config_set_tooltip(ctk_config, scale, _(__aniso_slider_help)); ctk_multisample->active_attributes |= __LOG_ANISO_RANGE; ctk_multisample->log_aniso_scale = scale; @@ -649,7 +652,7 @@ static GtkWidget *create_fsaa_setting_menu(CtkMultisample *ctk_multisample, ctk_drop_down_menu_new(CTK_DROP_DOWN_MENU_FLAG_READONLY); for (i = 0; i < ARRAY_LEN(applicationSettings); i++) { - ctk_drop_down_menu_append_item(d, applicationSettings[i], i); + ctk_drop_down_menu_append_item(d, _(applicationSettings[i]), i); } if (!override) { @@ -666,7 +669,7 @@ static GtkWidget *create_fsaa_setting_menu(CtkMultisample *ctk_multisample, ctk_drop_down_menu_set_current_value(d, idx); ctk_drop_down_menu_set_tooltip(ctk_multisample->ctk_config, d, - __aa_menu_help); + _(__aa_menu_help)); g_signal_connect(G_OBJECT(d), "changed", @@ -707,9 +710,9 @@ static void post_fsaa_setting_changed(CtkMultisample *ctk_multisample, } ctk_config_statusbar_message(ctk_multisample->ctk_config, - "%s Application's Antialiasing Settings.", - (!override ? "Using" : - (enhance ? "Enhancing" : "Overriding"))); + (!override ? _("Using Application's Antialiasing Settings.") : + (enhance ? _("Enhancing Application's Antialiasing Settings.") : + _("Overriding Application's Antialiasing Settings.")))); } /* post_fsaa_setting_changed() */ @@ -928,7 +931,7 @@ static void fsaa_setting_update_received(GObject *object, static void post_fsaa_value_changed(CtkMultisample *ctk_multisample, gint val) { ctk_config_statusbar_message(ctk_multisample->ctk_config, - "Antialiasing set to %s.", + _("Antialiasing set to %s."), NvCtrlGetMultisampleModeName(val)); } /* post_fsaa_value_changed() */ @@ -1111,8 +1114,7 @@ static void post_fxaa_toggled(CtkMultisample *ctk_multisample, gboolean enable) { ctk_config_statusbar_message(ctk_multisample->ctk_config, - "FXAA " - "%s.", enable ? "enabled" : "disabled"); + enable ? _("FXAA enabled.") : _("FXAA disabled.")); } /* post_fxaa_toggled() */ @@ -1178,8 +1180,7 @@ post_log_aniso_app_override_toggled(CtkMultisample *ctk_multisample, } ctk_config_statusbar_message(ctk_multisample->ctk_config, - "Application Anisotropic Filtering Override " - "%s.", override ? "enabled" : "disabled"); + override ? _("Application Anisotropic Filtering Override enabled") : _("Application Anisotropic Filtering Override disabled")); } /* post_log_aniso_app_override_toggled() */ @@ -1272,7 +1273,7 @@ static const gchar *get_log_aniso_name(gint val) { static const gchar *log_aniso_names[] = { "1x", "2x", "4x", "8x", "16x" }; - if ((val < 0) || (val > 4)) return "Unknown"; + if ((val < 0) || (val > 4)) return _("Unknown"); return log_aniso_names[val]; @@ -1309,7 +1310,7 @@ static void post_log_aniso_value_changed(CtkMultisample *ctk_multisample, if (override) { ctk_config_statusbar_message(ctk_multisample->ctk_config, - "Anisotropic Filtering set to %s.", + _("Anisotropic Filtering set to %s."), get_log_aniso_name(val)); } @@ -1389,182 +1390,182 @@ GtkTextBuffer *ctk_multisample_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "Antialiasing Help"); + ctk_help_title(b, &i, _("Antialiasing Help")); if (ctk_multisample->active_attributes & __FSAA) { - ctk_help_heading(b, &i, "Antialiasing Settings"); - ctk_help_para(b, &i, "Antialiasing is a technique used in OpenGL " + ctk_help_heading(b, &i, _("Antialiasing Settings")); + ctk_help_para(b, &i, _("Antialiasing is a technique used in OpenGL " "to smooth the edges of objects in a scene to reduce " "the jagged 'stairstep' effect that sometimes appears " "along the edges of 3D objects. This is accomplished " "by rendering an image larger than normal (with " "multiple 'samples' per pixel), and then using a " "filter to average multiple samples into a " - "single pixel."); + "single pixel.")); - ctk_help_para(b, &i, "Several antialiasing " + ctk_help_para(b, &i, _("Several antialiasing " "methods are available which you may select between " "with the Antialiasing slider. Note that increasing " "the number of samples used during Antialiased " - "rendering may decrease performance."); + "rendering may decrease performance.")); - ctk_help_para(b, &i, "You can also configure Antialiasing " + ctk_help_para(b, &i, _("You can also configure Antialiasing " "using the __GL_FSAA_MODE environment variable (see " "the README for details). The __GL_FSAA_MODE " "environment variable overrides the value in " - "nvidia-settings."); + "nvidia-settings.")); - ctk_help_term(b, &i, "Application Antialiasing Settings"); + ctk_help_term(b, &i, _("Application Antialiasing Settings")); if (ctk_multisample->active_attributes & __FSAA_ENHANCE) { - ctk_help_para(b, &i, "%s", __aa_menu_help); - ctk_help_para(b, &i, "Use Application Settings will let applications " - "choose the AA mode."); - ctk_help_para(b, &i, "Override Application Settings will override " + ctk_help_para(b, &i, "%s", _(__aa_menu_help)); + ctk_help_para(b, &i, _("Use Application Settings will let applications " + "choose the AA mode.")); + ctk_help_para(b, &i, _("Override Application Settings will override " "all OpenGL applications to use the mode selected by " - "the slider."); - ctk_help_para(b, &i, "Enhance Application Settings will make " + "the slider.")); + ctk_help_para(b, &i, _("Enhance Application Settings will make " "applications that are requesting some type of " "antialiasing mode use the mode selected by the " - "slider."); + "slider.")); } else { - ctk_help_para(b, &i, "%s", __aa_override_app_help); + ctk_help_para(b, &i, "%s", _(__aa_override_app_help)); } if (ctk_multisample->active_attributes & __FSAA_NONE) { - ctk_help_term(b, &i, "Off"); - ctk_help_para(b, &i, "Disables antialiasing in OpenGL " + ctk_help_term(b, &i, _("Off")); + ctk_help_para(b, &i, _("Disables antialiasing in OpenGL " "applications. " "Select this option if you require maximum " - "performance in your applications."); + "performance in your applications.")); } if (ctk_multisample->active_attributes & __FSAA_2x) { - ctk_help_term(b, &i, "2x (2xMS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 2x (2xMS)" + ctk_help_term(b, &i, _("2x (2xMS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 2x (2xMS)" "Bilinear mode. This mode offers improved image " "quality and high performance in OpenGL " - "applications."); + "applications.")); } if (ctk_multisample->active_attributes & __FSAA_2x_5t) { - ctk_help_term(b, &i, "2x Quincunx"); - ctk_help_para(b, &i, "This enables the patented Quincunx " + ctk_help_term(b, &i, _("2x Quincunx")); + ctk_help_para(b, &i, _("This enables the patented Quincunx " "Antialiasing technique available in the GeForce " "GPU family. " "Quincunx Antialiasing offers the quality of the " "slower, 4x antialiasing mode, but at nearly the " - "performance of the faster, 2x mode."); + "performance of the faster, 2x mode.")); } if (ctk_multisample->active_attributes & __FSAA_15x15) { - ctk_help_term(b, &i, "1.5 x 1.5"); - ctk_help_para(b, &i, "This enables antialiasing using the 1.5x1.5 " + ctk_help_term(b, &i, _("1.5 x 1.5")); + ctk_help_para(b, &i, _("This enables antialiasing using the 1.5x1.5 " "mode. This mode offers improved image quality and " - "high performance in OpenGL applications."); + "high performance in OpenGL applications.")); } if (ctk_multisample->active_attributes & __FSAA_2x2) { - ctk_help_term(b, &i, "2 x 2 Supersampling"); - ctk_help_para(b, &i, "This enables antialiasing using the 2x2 " + ctk_help_term(b, &i, _("2 x 2 Supersampling")); + ctk_help_para(b, &i, _("This enables antialiasing using the 2x2 " "Supersampling mode. This mode offers higher image " "quality at the expense of some performance in " - "OpenGL applications."); + "OpenGL applications.")); } if (ctk_multisample->active_attributes & __FSAA_4x) { - ctk_help_term(b, &i, "4x (4xMS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 4x (4xMS)" + ctk_help_term(b, &i, _("4x (4xMS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 4x (4xMS)" "Bilinear mode. This mode offers higher image " "quality at the expense of some performance in " - "OpenGL applications."); + "OpenGL applications.")); } if (ctk_multisample->active_attributes & __FSAA_4x_9t) { - ctk_help_term(b, &i, "4x, 9-tap Gaussian"); - ctk_help_para(b, &i, "This enables antialiasing using the 4x, " + ctk_help_term(b, &i, _("4x, 9-tap Gaussian")); + ctk_help_para(b, &i, _("This enables antialiasing using the 4x, " "9-tap (Gaussian) mode. This mode offers higher " "image quality but at the expense of some " - "performance in OpenGL applications."); + "performance in OpenGL applications.")); } if (ctk_multisample->active_attributes & __FSAA_8x) { - ctk_help_term(b, &i, "8x (4xMS, 4xCS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 8x " + ctk_help_term(b, &i, _("8x (4xMS, 4xCS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 8x " "(4xMS, 4xCS) mode. This mode offers better image " - "quality than the 4x mode."); + "quality than the 4x mode.")); } if (ctk_multisample->active_attributes & __FSAA_8xS) { - ctk_help_term(b, &i, "8x (4xSS, 2xMS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 8x " + ctk_help_term(b, &i, _("8x (4xSS, 2xMS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 8x " "(4xSS, 2xMS) mode. This mode offers better image " - "quality than the 4x mode."); + "quality than the 4x mode.")); } if (ctk_multisample->active_attributes & __FSAA_16x) { - ctk_help_term(b, &i, "16x (4xMS, 12xCS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 16x " + ctk_help_term(b, &i, _("16x (4xMS, 12xCS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 16x " "(4xMS, 12xCS) mode. This mode offers better image " - "quality than the 8x mode."); + "quality than the 8x mode.")); } if (ctk_multisample->active_attributes & __FSAA_8xQ) { - ctk_help_term(b, &i, "8x (8xMS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 8x (8xMS) " + ctk_help_term(b, &i, _("8x (8xMS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 8x (8xMS) " "mode. This mode offers better image " - "quality than the 8x mode."); + "quality than the 8x mode.")); } if (ctk_multisample->active_attributes & __FSAA_16xS) { - ctk_help_term(b, &i, "16x (4xSS, 4xMS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 16x " + ctk_help_term(b, &i, _("16x (4xSS, 4xMS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 16x " "(4xSS, 4xMS) mode. This mode offers better image " - "quality than the 16x mode."); + "quality than the 16x mode.")); } if (ctk_multisample->active_attributes & __FSAA_16xQ) { - ctk_help_term(b, &i, "16x (8xMS, 8xCS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 16x " + ctk_help_term(b, &i, _("16x (8xMS, 8xCS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 16x " "(8xMS, 8xCS) mode. This mode offers better image " - "quality than the 16x mode."); + "quality than the 16x mode.")); } if (ctk_multisample->active_attributes & __FSAA_32xS) { - ctk_help_term(b, &i, "32x (4xSS, 8xMS)"); - ctk_help_para(b, &i, "This enables antialiasing using the 32x " + ctk_help_term(b, &i, _("32x (4xSS, 8xMS)")); + ctk_help_para(b, &i, _("This enables antialiasing using the 32x " "(4xSS, 8xMS) mode. This mode offers better image " - "quality than the 16x mode."); + "quality than the 16x mode.")); } } if (ctk_multisample->active_attributes & __FXAA) { - ctk_help_term(b, &i, "Enable FXAA"); - ctk_help_para(b, &i, "%s", __fxaa_enable_help); + ctk_help_term(b, &i, _("Enable FXAA")); + ctk_help_para(b, &i, "%s", _(__fxaa_enable_help)); } if (ctk_multisample->active_attributes & __LOG_ANISO_RANGE) { - ctk_help_heading(b, &i, "Anisotropic Filtering"); + ctk_help_heading(b, &i, _("Anisotropic Filtering")); - ctk_help_para(b, &i, "Anisotropic filtering is a technique used to " + ctk_help_para(b, &i, _("Anisotropic filtering is a technique used to " "improve the quality of textures applied to the " "surfaces of 3D objects when drawn at a sharp angle. " "Use the Anisotropic filtering slider to set the degree " "of anisotropic filtering for improved image quality. " "Enabling this option improves image quality at the " - "expense of some performance."); + "expense of some performance.")); - ctk_help_para(b, &i, "You can also configure Anisotropic filtering " + ctk_help_para(b, &i, _("You can also configure Anisotropic filtering " "using the __GL_LOG_MAX_ANISO environment variable " "(see the README for details). The " "__GL_LOG_MAX_ANISO environment variable overrides " - "the value in nvidia-settings."); + "the value in nvidia-settings.")); - ctk_help_term(b, &i, "Override Application Setting"); + ctk_help_term(b, &i, _("Override Application Setting")); - ctk_help_para(b, &i, "%s", __aniso_override_app_help); + ctk_help_para(b, &i, "%s", _(__aniso_override_app_help)); - ctk_help_para(b, &i, "%s", __aniso_slider_help); + ctk_help_para(b, &i, "%s", _(__aniso_slider_help)); } ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkopengl.c b/src/gtk+-2.x/ctkopengl.c index c8836ce4..1beb8c91 100644 --- a/src/gtk+-2.x/ctkopengl.c +++ b/src/gtk+-2.x/ctkopengl.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "ctkbanner.h" @@ -30,6 +31,9 @@ #include "ctkconfig.h" #include "ctkhelp.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + static void vblank_sync_button_toggled (GtkWidget *, gpointer); static void post_vblank_sync_button_toggled(CtkOpenGL *, gboolean); @@ -133,58 +137,58 @@ static void ctk_opengl_new_finalize(GObject *object); #define FRAME_PADDING 5 static const char *__sync_to_vblank_help = -"When enabled, OpenGL applications will swap " +N_("When enabled, OpenGL applications will swap " "buffers during the vertical retrace; this option is " "applied to OpenGL applications that are started after " -"this option is set."; +"this option is set."); static const char *__aa_line_gamma_checkbox_help = -"Enable the antialiased lines gamma correction checkbox to make the " -"gamma correction slider active."; +N_("Enable the antialiased lines gamma correction checkbox to make the " +"gamma correction slider active."); static const char *__ssm_menu_help = -"This menu controls the swap mode when Quad-Buffered stereo is used." +N_("This menu controls the swap mode when Quad-Buffered stereo is used." " Application-controled: Stereo swap mode is derived from the " "value of swap interval. If it's odd, the per eye " "swap mode is used. If it's even, the per eye pair swap mode is used." " Per Eye: The driver swaps each eye as it is ready." " Per Eye-Pair: The driver waits for both eyes to complete rendering " -"before swapping."; +"before swapping."); static const char *__aa_line_gamma_slider_help = -"This option allows Gamma-corrected " +N_("This option allows Gamma-corrected " "antialiased lines to consider variances in the color " "display capabilities of output devices when rendering " "smooth lines. This option is applied to OpenGL applications " -"that are started after this option is set."; +"that are started after this option is set."); static const char *__image_settings_slider_help = -"The Image Settings slider controls the image quality setting."; +N_("The Image Settings slider controls the image quality setting."); static const char *__force_stereo_help = -"Enabling this option causes OpenGL to force " +N_("Enabling this option causes OpenGL to force " "stereo flipping even if a stereo drawable is " "not visible. This option is applied " -"immediately."; +"immediately."); static const char *__xinerama_stereo_help = - "Enabling this option causes OpenGL to allow " +N_("Enabling this option causes OpenGL to allow " "stereo flipping on multiple X screens configured " -"with Xinerama. This option is applied immediately."; +"with Xinerama. This option is applied immediately."); static const char *__show_sli_visual_indicator_help = -"Enabling this option causes OpenGL to draw " +N_("Enabling this option causes OpenGL to draw " "information about the current SLI mode on the " "screen. This option is applied to OpenGL " "applications that are started after this option is " -"set."; +"set."); static const char *__show_multigpu_visual_indicator_help = -"Enabling this option causes OpenGL to draw " +N_("Enabling this option causes OpenGL to draw " "information about the current Multi-GPU mode on the " "screen. This option is applied to OpenGL " "applications that are started after this option is " -"set."; +"set."); static const char *__show_graphics_visual_indicator_help = "Enabling this option causes the driver to draw " @@ -195,21 +199,21 @@ static const char *__show_graphics_visual_indicator_help = "started after this option is set."; static const char *__stereo_eyes_exchange_help = -"Enabling this option causes OpenGL to draw the left " +N_("Enabling this option causes OpenGL to draw the left " "eye image in the right eye and vice versa for stereo " -"drawables. This option is applied immediately."; +"drawables. This option is applied immediately."); static const char *__use_conformant_clamping_help = -"Disabling this option causes OpenGL to replace GL_CLAMP with " +N_("Disabling this option causes OpenGL to replace GL_CLAMP with " "GL_CLAMP_TO_EDGE for borderless 2D textures. This eliminates " "seams at the edges of textures in some older games such as " -"Quake 3."; +"Quake 3."); static const char *__show_gsync_visual_indicator_help = -"Enabling this option causes OpenGL to draw an indicator showing whether " +N_("Enabling this option causes OpenGL to draw an indicator showing whether " "G-SYNC is in use, when an application is swapping using flipping. This " "option is applied to OpenGL applications that are started after this option " -"is set."; +"is set."); #define __SYNC_TO_VBLANK (1 << 1) #define __ALLOW_FLIPPING (1 << 2) @@ -448,7 +452,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Performance"); + label = gtk_label_new(_("Performance")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -468,7 +472,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, if (ret_sync_to_vblank == NvCtrlSuccess) { - label = gtk_label_new("Sync to VBlank"); + label = gtk_label_new(_("Sync to VBlank")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -487,7 +491,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_config, check_button, - __sync_to_vblank_help); + _(__sync_to_vblank_help)); ctk_opengl->active_attributes |= __SYNC_TO_VBLANK; @@ -500,7 +504,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, if (ret_flipping_allowed == NvCtrlSuccess) { - label = gtk_label_new("Allow Flipping"); + label = gtk_label_new(_("Allow Flipping")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -519,9 +523,9 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_config, check_button, - "Enabling this option allows OpenGL to swap " + _("Enabling this option allows OpenGL to swap " "by flipping when possible. This option is " - "applied immediately."); + "applied immediately.")); ctk_opengl->active_attributes |= __ALLOW_FLIPPING; @@ -535,7 +539,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, * available. */ - label = gtk_label_new("Allow G-SYNC"); + label = gtk_label_new(_("Allow G-SYNC")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -554,9 +558,9 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_config, check_button, - "Enabling this option allows OpenGL to flip " + _("Enabling this option allows OpenGL to flip " "using G-SYNC when possible. This option is " - "applied immediately."); + "applied immediately.")); ctk_opengl->active_attributes |= __ALLOW_GSYNC; @@ -569,7 +573,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, * available. */ - label = gtk_label_new("Enable G-SYNC Visual Indicator"); + label = gtk_label_new(_("Enable G-SYNC Visual Indicator")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -588,7 +592,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_config, check_button, - __show_gsync_visual_indicator_help); + _(__show_gsync_visual_indicator_help)); ctk_opengl->active_attributes |= __SHOW_GSYNC_VISUAL_INDICATOR; @@ -597,7 +601,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, if (ret_force_stereo == NvCtrlSuccess) { - label = gtk_label_new("Force Stereo Flipping"); + label = gtk_label_new(_("Force Stereo Flipping")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -615,7 +619,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, CTK_EVENT_NAME(NV_CTRL_FORCE_STEREO), G_CALLBACK(value_changed), (gpointer) ctk_opengl); - ctk_config_set_tooltip(ctk_config, check_button, __force_stereo_help); + ctk_config_set_tooltip(ctk_config, check_button, _(__force_stereo_help)); ctk_opengl->active_attributes |= __FORCE_STEREO; @@ -624,7 +628,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, if (ret_xinerama_stereo == NvCtrlSuccess) { - label = gtk_label_new("Allow Xinerama Stereo Flipping"); + label = gtk_label_new(_("Allow Xinerama Stereo Flipping")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -642,7 +646,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, CTK_EVENT_NAME(NV_CTRL_XINERAMA_STEREO), G_CALLBACK(value_changed), (gpointer) ctk_opengl); - ctk_config_set_tooltip(ctk_config, check_button, __xinerama_stereo_help); + ctk_config_set_tooltip(ctk_config, check_button, _(__xinerama_stereo_help)); ctk_opengl->active_attributes |= __XINERAMA_STEREO; @@ -651,7 +655,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, if (ret_stereo_eyes_exchange == NvCtrlSuccess) { - label = gtk_label_new("Exchange Stereo Eyes"); + label = gtk_label_new(_("Exchange Stereo Eyes")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -670,7 +674,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_config, check_button, - __stereo_eyes_exchange_help); + _(__stereo_eyes_exchange_help)); ctk_opengl->active_attributes |= __STEREO_EYES_EXCHANGE; @@ -678,7 +682,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, } if (ret_stereo_eyes_exchange == NvCtrlSuccess) { /* Create a menu */ - label = gtk_label_new("Stereo - swap mode:"); + label = gtk_label_new(_("Stereo - swap mode:")); ctk_opengl->active_attributes |= __STEREO_SWAP_MODE; menu = create_stereo_swap_mode_menu(ctk_opengl, ctk_event, @@ -697,7 +701,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, if (ret_image_settings == NvCtrlSuccess) { - frame = gtk_frame_new("Image Settings"); + frame = gtk_frame_new(_("Image Settings")); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 3); hbox = gtk_hbox_new(FALSE, 0); @@ -731,7 +735,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(image_settings_update_received), (gpointer) ctk_opengl); - ctk_config_set_tooltip(ctk_config, scale, __image_settings_slider_help); + ctk_config_set_tooltip(ctk_config, scale, _(__image_settings_slider_help)); ctk_opengl->active_attributes |= __IMAGE_SETTINGS; ctk_opengl->image_settings_scale = scale; @@ -744,7 +748,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Miscellaneous"); + label = gtk_label_new(_("Miscellaneous")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -759,7 +763,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, */ if (ret_aa_line_gamma == NvCtrlSuccess) { - label = gtk_label_new("Enable gamma correction for antialiased lines"); + label = gtk_label_new(_("Enable gamma correction for antialiased lines")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -779,14 +783,14 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_opengl->ctk_config, - check_button, __aa_line_gamma_checkbox_help); + check_button, _(__aa_line_gamma_checkbox_help)); ctk_opengl->aa_line_gamma_button = check_button; ctk_opengl->active_attributes |= __AA_LINE_GAMMA; ctk_opengl->aa_line_gamma_scale = - create_slider(ctk_opengl, vbox, "Gamma correction", - __aa_line_gamma_slider_help, + create_slider(ctk_opengl, vbox, _("Gamma correction"), + _(__aa_line_gamma_slider_help), NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE, __AA_LINE_GAMMA_VALUE); @@ -806,7 +810,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, */ if (ret_use_conformant_clamping == NvCtrlSuccess) { - label = gtk_label_new("Use Conformant Texture Clamping"); + label = gtk_label_new(_("Use Conformant Texture Clamping")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -825,7 +829,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_config, check_button, - __use_conformant_clamping_help); + _(__use_conformant_clamping_help)); ctk_opengl->active_attributes |= __CONFORMANT_CLAMPING; @@ -834,7 +838,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, if (ret_show_sli_visual_indicator == NvCtrlSuccess) { - label = gtk_label_new("Enable SLI Visual Indicator"); + label = gtk_label_new(_("Enable SLI Visual Indicator")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -853,7 +857,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_config, - check_button, __show_sli_visual_indicator_help); + check_button, _(__show_sli_visual_indicator_help)); ctk_opengl->active_attributes |= __SHOW_SLI_VISUAL_INDICATOR; @@ -862,7 +866,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, if (ret_show_multigpu_visual_indicator == NvCtrlSuccess) { - label = gtk_label_new("Enable Multi-GPU Visual Indicator"); + label = gtk_label_new(_("Enable Multi-GPU Visual Indicator")); check_button = gtk_check_button_new(); gtk_container_add(GTK_CONTAINER(check_button), label); @@ -881,7 +885,7 @@ GtkWidget* ctk_opengl_new(CtrlTarget *ctrl_target, G_CALLBACK(value_changed), (gpointer) ctk_opengl); ctk_config_set_tooltip(ctk_config, check_button, - __show_multigpu_visual_indicator_help); + _(__show_multigpu_visual_indicator_help)); ctk_opengl->active_attributes |= __SHOW_MULTIGPU_VISUAL_INDICATOR; @@ -939,48 +943,42 @@ static void post_vblank_sync_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL Sync to VBlank %s.", - enabled ? "enabled" : "disabled"); + enabled ? _("OpenGL Sync to VBlank enabled.") : _("OpenGL Sync to VBlank disabled.")); } static void post_allow_flipping_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL Flipping %s.", - enabled ? "allowed" : "not allowed"); + enabled ? _("OpenGL Flipping allowed.") : _("OpenGL Flipping not allowed.")); } static void post_allow_gsync_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "G-SYNC %s.", - enabled ? "allowed" : "not allowed"); + enabled ? _("G-SYNC allowed.") : _("G-SYNC not allowed.")); } static void post_show_gsync_visual_indicator_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "G-SYNC visual indicator %s.", - enabled ? "enabled" : "disabled"); + enabled ? _("G-SYNC visual indicator enabled.") : _("G-SYNC visual indicator disabled.")); } static void post_force_stereo_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL Stereo Flipping %s.", - enabled ? "forced" : "not forced"); + enabled ? _("OpenGL Stereo Flipping forced.") : _("OpenGL Stereo Flipping not forced.")); } static void post_show_sli_visual_indicator_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL SLI Visual Indicator %s.", - enabled ? "enabled" : "disabled"); + enabled ? _("OpenGL SLI Visual Indicator enabled.") : _("OpenGL SLI Visual Indicator disabled.")); } static void @@ -988,8 +986,7 @@ post_show_multigpu_visual_indicator_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL Multi-GPU Visual Indicator %s.", - enabled ? "enabled" : "disabled"); + enabled ? _("OpenGL Multi-GPU Visual Indicator enabled.") : _("OpenGL Multi-GPU Visual Indicator disabled.")); } static void @@ -1005,25 +1002,21 @@ static void post_xinerama_stereo_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL Xinerama Stereo Flipping %s.", - enabled ? "allowed" : "not allowed"); + enabled ? _("OpenGL Xinerama Stereo Flipping allowed.") : _("OpenGL Xinerama Stereo Flipping not allowed.")); } static void post_stereo_eyes_exchange_button_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL Stereo Eyes Exchanged %s.", - enabled ? "enabled" : "disabled"); + enabled ? _("OpenGL Stereo Eyes Exchanged enabled.") : _("OpenGL Stereo Eyes Exchanged disabled.")); } static void post_aa_line_gamma_toggled(CtkOpenGL *ctk_opengl, gboolean enabled) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL gamma correction for antialiased " - "lines %s.", - enabled ? "enabled" : "disabled"); + enabled ? _("OpenGL gamma correction for antialiased lines enabled.") : _("OpenGL gamma correction for antialiased lines disabled.")); } static void @@ -1031,9 +1024,8 @@ post_use_conformant_clamping_button_toggled(CtkOpenGL *ctk_opengl, int clamping) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "Use %sConformant OpenGL Texture Clamping", (clamping == NV_CTRL_TEXTURE_CLAMPING_SPEC) ? - "" : "Non-"); + _("Use Conformant OpenGL Texture Clamping") : _("Use Non-Conformant OpenGL Texture Clamping")); } static void vblank_sync_button_toggled(GtkWidget *widget, @@ -1419,16 +1411,16 @@ static GtkWidget *create_stereo_swap_mode_menu(CtkOpenGL *ctk_opengl, for (i = 0; i < ctk_opengl->stereo_swap_mode_table_size; i++) { switch (ctk_opengl->stereo_swap_mode_table[i]) { case NV_CTRL_STEREO_SWAP_MODE_PER_EYE: - ctk_drop_down_menu_append_item(stereo_swap_mode_menu, "Per Eye", i); + ctk_drop_down_menu_append_item(stereo_swap_mode_menu, _("Per Eye"), i); break; case NV_CTRL_STEREO_SWAP_MODE_PER_EYE_PAIR: ctk_drop_down_menu_append_item(stereo_swap_mode_menu, - "Per Eye-Pair", i); + _("Per Eye-Pair"), i); break; default: case NV_CTRL_STEREO_SWAP_MODE_APPLICATION_CONTROL: ctk_drop_down_menu_append_item(stereo_swap_mode_menu, - "Application-controlled", i); + _("Application-controlled"), i); break; } } @@ -1438,7 +1430,7 @@ static GtkWidget *create_stereo_swap_mode_menu(CtkOpenGL *ctk_opengl, ctk_drop_down_menu_set_current_value(stereo_swap_mode_menu, idx); ctk_drop_down_menu_set_tooltip(ctk_opengl->ctk_config, stereo_swap_mode_menu, - __ssm_menu_help); + _(__ssm_menu_help)); g_signal_connect(G_OBJECT(stereo_swap_mode_menu), "changed", @@ -1500,9 +1492,9 @@ static void stereo_swap_mode_menu_changed(GObject *object, gpointer user_data) static void post_stereo_swap_mode_changed(CtkOpenGL *ctk_opengl, gint idx) { static const char *stereo_swap_mode_table[] = { - "Application-controlled", /* NV_CTRL_STEREO_SWAP_MODE_APPLICATION_CONTROL */ - "Per Eye", /* NV_CTRL_STEREO_SWAP_MODE_PER_EYE */ - "Per Eye-Pair", /* NV_CTRL_STEREO_SWAP_MODE_PER_EYE_PAIR */ + N_("Application-controlled"), /* NV_CTRL_STEREO_SWAP_MODE_APPLICATION_CONTROL */ + N_("Per Eye"), /* NV_CTRL_STEREO_SWAP_MODE_PER_EYE */ + N_("Per Eye-Pair"), /* NV_CTRL_STEREO_SWAP_MODE_PER_EYE_PAIR */ }; if (idx < NV_CTRL_STEREO_SWAP_MODE_APPLICATION_CONTROL || @@ -1511,8 +1503,8 @@ static void post_stereo_swap_mode_changed(CtkOpenGL *ctk_opengl, gint idx) } ctk_config_statusbar_message(ctk_opengl->ctk_config, - "Set %s Stereo swap mode.", - stereo_swap_mode_table[idx]); + _("Set %s Stereo swap mode."), + _(stereo_swap_mode_table[idx])); } @@ -1555,11 +1547,11 @@ static void stereo_swap_mode_update_received(GObject *object, static const gchar *get_image_settings_string(gint val) { static const gchar *image_settings_strings[] = { - "High Quality", "Quality", "Performance", "High Performance" + N_("High Quality"), N_("Quality"), N_("Performance"), N_("High Performance") }; if ((val < NV_CTRL_IMAGE_SETTINGS_HIGH_QUALITY) || - (val > NV_CTRL_IMAGE_SETTINGS_HIGH_PERFORMANCE)) return "Unknown"; + (val > NV_CTRL_IMAGE_SETTINGS_HIGH_PERFORMANCE)) return _("Unknown"); return image_settings_strings[val]; @@ -1573,7 +1565,7 @@ static const gchar *get_image_settings_string(gint val) static gchar *format_image_settings_value(GtkScale *scale, gdouble arg1, gpointer user_data) { - return g_strdup(get_image_settings_string(arg1)); + return g_strdup(_(get_image_settings_string(arg1))); } /* format_image_settings_value() */ @@ -1586,8 +1578,8 @@ static gchar *format_image_settings_value(GtkScale *scale, gdouble arg1, static void post_image_settings_value_changed(CtkOpenGL *ctk_opengl, gint val) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "Image Settings set to %s.", - get_image_settings_string(val)); + _("Image Settings set to %s."), + _(get_image_settings_string(val))); } /* post_image_settings_value_changed() */ @@ -1646,8 +1638,8 @@ static void image_settings_update_received(GObject *object, static void post_slider_value_changed(CtkOpenGL *ctk_opengl, gint val) { ctk_config_statusbar_message(ctk_opengl->ctk_config, - "OpenGL anti-aliased lines edge smoothness " - "changed to %d%%.", + _("OpenGL anti-aliased lines edge smoothness " + "changed to %d%%."), val); } /* post_slider_value_changed() */ @@ -1776,179 +1768,179 @@ GtkTextBuffer *ctk_opengl_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "OpenGL Help"); + ctk_help_title(b, &i, _("OpenGL Help")); if (ctk_opengl->active_attributes & __SYNC_TO_VBLANK) { - ctk_help_heading(b, &i, "Sync to VBlank"); - ctk_help_para(b, &i, "%s", __sync_to_vblank_help); + ctk_help_heading(b, &i, _("Sync to VBlank")); + ctk_help_para(b, &i, "%s", _(__sync_to_vblank_help)); } if (ctk_opengl->active_attributes & __ALLOW_FLIPPING) { - ctk_help_heading(b, &i, "Allow Flipping"); - ctk_help_para(b, &i, "Enabling this option allows OpenGL to swap " + ctk_help_heading(b, &i, _("Allow Flipping")); + ctk_help_para(b, &i, _("Enabling this option allows OpenGL to swap " "by flipping when possible. Flipping is a mechanism " "of performing swaps where the OpenGL driver changes " "which buffer is scanned out by the DAC. The " "alternative swapping mechanism is blitting, where " "buffer contents are copied from the back buffer to " "the front buffer. It is usually faster to flip than " - "it is to blit."); + "it is to blit.")); - ctk_help_para(b, &i, "Note that this option is applied immediately, " + ctk_help_para(b, &i, _("Note that this option is applied immediately, " "unlike most other OpenGL options which are only " "applied to OpenGL applications that are started " - "after the option is set."); + "after the option is set.")); } if (ctk_opengl->active_attributes & __ALLOW_GSYNC) { - ctk_help_heading(b, &i, "Allow G-SYNC"); - ctk_help_para(b, &i, "Enabling this option allows OpenGL to use G-SYNC " + ctk_help_heading(b, &i, _("Allow G-SYNC")); + ctk_help_para(b, &i, _("Enabling this option allows OpenGL to use G-SYNC " "when available. G-SYNC is a technology that allows a " "monitor to delay updating the screen until the GPU is " "ready to display a new frame. Without G-SYNC, the GPU " "waits for the display to be ready to accept a new frame " - "instead."); + "instead.")); - ctk_help_para(b, &i, "Note that this option is applied immediately, " + ctk_help_para(b, &i, _("Note that this option is applied immediately, " "unlike most other OpenGL options which are only " "applied to OpenGL applications that are started " - "after the option is set."); + "after the option is set.")); - ctk_help_para(b, &i, "When G-SYNC is active and \"Sync to VBlank\" is " + ctk_help_para(b, &i, _("When G-SYNC is active and \"Sync to VBlank\" is " "disabled, applications rendering faster than the " "maximum refresh rate will tear. This eliminates tearing " "for frame rates below the monitor's maximum refresh " "rate while minimizing latency for frame rates above it. " "When \"Sync to VBlank\" is enabled, the frame rate is " "limited to the monitor's maximum refresh rate to " - "eliminate tearing completely."); + "eliminate tearing completely.")); - ctk_help_para(b, &i, "This option can be overridden on a " + ctk_help_para(b, &i, _("This option can be overridden on a " "per-application basis using the GLGSYNCAllowed " - "application profile key."); + "application profile key.")); } if (ctk_opengl->active_attributes & __SHOW_GSYNC_VISUAL_INDICATOR) { - ctk_help_heading(b, &i, "G-SYNC Visual Indicator"); - ctk_help_para(b, &i, "%s", __show_gsync_visual_indicator_help); + ctk_help_heading(b, &i, _("G-SYNC Visual Indicator")); + ctk_help_para(b, &i, "%s", _(__show_gsync_visual_indicator_help)); } if (ctk_opengl->active_attributes & __FORCE_STEREO) { - ctk_help_heading(b, &i, "Force Stereo Flipping"); - ctk_help_para(b, &i, "%s", __force_stereo_help); + ctk_help_heading(b, &i, _("Force Stereo Flipping")); + ctk_help_para(b, &i, "%s", _(__force_stereo_help)); } if (ctk_opengl->active_attributes & __XINERAMA_STEREO) { - ctk_help_heading(b, &i, "Allow Xinerama Stereo Flipping"); - ctk_help_para(b, &i, "%s", __xinerama_stereo_help); + ctk_help_heading(b, &i, _("Allow Xinerama Stereo Flipping")); + ctk_help_para(b, &i, "%s", _(__xinerama_stereo_help)); } if (ctk_opengl->active_attributes & __STEREO_EYES_EXCHANGE) { - ctk_help_heading(b, &i, "Exchange Stereo Eyes"); - ctk_help_para(b, &i, "%s", __stereo_eyes_exchange_help); + ctk_help_heading(b, &i, _("Exchange Stereo Eyes")); + ctk_help_para(b, &i, "%s", _(__stereo_eyes_exchange_help)); } if (ctk_opengl->active_attributes & __STEREO_SWAP_MODE) { - ctk_help_term(b, &i, "Stereo - swap mode"); - ctk_help_para(b, &i, "%s", __ssm_menu_help); + ctk_help_term(b, &i, _("Stereo - swap mode")); + ctk_help_para(b, &i, "%s", _(__ssm_menu_help)); } if (ctk_opengl->active_attributes & __IMAGE_SETTINGS) { - ctk_help_heading(b, &i, "Image Settings"); - ctk_help_para(b, &i, "This setting gives you full control over the " - "image quality in your applications."); - ctk_help_para(b, &i, "Several quality settings are available for " + ctk_help_heading(b, &i, _("Image Settings")); + ctk_help_para(b, &i, _("This setting gives you full control over the " + "image quality in your applications.")); + ctk_help_para(b, &i, _("Several quality settings are available for " "you to choose from with the Image Settings slider. " "Note that choosing higher image quality settings may " - "result in decreased performance."); + "result in decreased performance.")); - ctk_help_term(b, &i, "High Quality"); - ctk_help_para(b, &i, "This setting results in the best image quality " + ctk_help_term(b, &i, _("High Quality")); + ctk_help_para(b, &i, _("This setting results in the best image quality " "for your applications. It is not necessary for " "average users who run game applications, and designed " "for more advanced users to generate images that do not " "take advantage of the programming capability of the " - "texture filtering hardware."); + "texture filtering hardware.")); - ctk_help_term(b, &i, "Quality"); - ctk_help_para(b, &i, "This is the default setting that results in " - "optimal image quality for your applications."); + ctk_help_term(b, &i, _("Quality")); + ctk_help_para(b, &i, _("This is the default setting that results in " + "optimal image quality for your applications.")); - ctk_help_term(b, &i, "Performance"); - ctk_help_para(b, &i, "This setting offers an optimal blend of image " + ctk_help_term(b, &i, _("Performance")); + ctk_help_para(b, &i, _("This setting offers an optimal blend of image " "quality and performance. The result is optimal " "performance and good image quality for your " - "applications."); + "applications.")); - ctk_help_term(b, &i, "High Performance"); - ctk_help_para(b, &i, "This setting offers the highest frame rate " + ctk_help_term(b, &i, _("High Performance")); + ctk_help_para(b, &i, _("This setting offers the highest frame rate " "possible, resulting in the best performance for your " - "applications."); + "applications.")); } if (ctk_opengl->active_attributes & __AA_LINE_GAMMA) { - ctk_help_heading(b, &i, "Enable gamma correction for " - "antialiased lines"); - ctk_help_para(b, &i, "%s", __aa_line_gamma_checkbox_help ); + ctk_help_heading(b, &i, _("Enable gamma correction for " + "antialiased lines")); + ctk_help_para(b, &i, "%s", _(__aa_line_gamma_checkbox_help) ); } if (ctk_opengl->active_attributes & __AA_LINE_GAMMA_VALUE) { - ctk_help_heading(b, &i, "Set gamma correction for " - "antialiased lines"); - ctk_help_para(b, &i, "%s", __aa_line_gamma_slider_help); + ctk_help_heading(b, &i, _("Set gamma correction for " + "antialiased lines")); + ctk_help_para(b, &i, "%s", _(__aa_line_gamma_slider_help)); } if (ctk_opengl->active_attributes & __CONFORMANT_CLAMPING) { - ctk_help_heading(b, &i, "Use Conformant Texture Clamping"); - ctk_help_para(b, &i, "%s", __use_conformant_clamping_help); + ctk_help_heading(b, &i, _("Use Conformant Texture Clamping")); + ctk_help_para(b, &i, "%s", _(__use_conformant_clamping_help)); } if (ctk_opengl->active_attributes & __SHOW_SLI_VISUAL_INDICATOR) { - ctk_help_heading(b, &i, "SLI Visual Indicator"); - ctk_help_para(b, &i, "This option draws information about the current " + ctk_help_heading(b, &i, _("SLI Visual Indicator")); + ctk_help_para(b, &i, _("This option draws information about the current " "SLI mode on top of OpenGL windows. Its behavior " - "depends on which SLI mode is in use:"); - ctk_help_term(b, &i, "Alternate Frame Rendering"); - ctk_help_para(b, &i, "In AFR mode, a vertical green bar displays the " + "depends on which SLI mode is in use:")); + ctk_help_term(b, &i, _("Alternate Frame Rendering")); + ctk_help_para(b, &i, _("In AFR mode, a vertical green bar displays the " "amount of scaling currently being achieved. A longer " - "bar indicates more scaling."); - ctk_help_term(b, &i, "Split-Frame Rendering"); - ctk_help_para(b, &i, "In this mode, OpenGL draws a horizontal green " + "bar indicates more scaling.")); + ctk_help_term(b, &i, _("Split-Frame Rendering")); + ctk_help_para(b, &i, _("In this mode, OpenGL draws a horizontal green " "line showing where the screen is split. Everything " "above the line is drawn on one GPU and everything " - "below is drawn on the other."); - ctk_help_term(b, &i, "SLI Antialiasing"); - ctk_help_para(b, &i, "In this mode, OpenGL draws a horizontal green " + "below is drawn on the other.")); + ctk_help_term(b, &i, _("SLI Antialiasing")); + ctk_help_para(b, &i, _("In this mode, OpenGL draws a horizontal green " "line one third of the way across the screen. Above " "this line, the images from both GPUs are blended to " "produce the currently selected SLIAA mode. Below the " "line, the image from just one GPU is displayed without " "blending. This allows easy comparison between the " - "SLIAA and single-GPU AA modes."); + "SLIAA and single-GPU AA modes.")); } if (ctk_opengl->active_attributes & __SHOW_MULTIGPU_VISUAL_INDICATOR) { - ctk_help_heading(b, &i, "Multi-GPU Visual Indicator"); - ctk_help_para(b, &i, "This option draws information about the current " + ctk_help_heading(b, &i, _("Multi-GPU Visual Indicator")); + ctk_help_para(b, &i, _("This option draws information about the current " "Multi-GPU mode on top of OpenGL windows. Its behavior " - "depends on which Multi-GPU mode is in use:"); - ctk_help_term(b, &i, "Alternate Frame Rendering"); - ctk_help_para(b, &i, "In AFR mode, a vertical green bar displays the " + "depends on which Multi-GPU mode is in use:")); + ctk_help_term(b, &i, _("Alternate Frame Rendering")); + ctk_help_para(b, &i, _("In AFR mode, a vertical green bar displays the " "amount of scaling currently being achieved. A longer " - "bar indicates more scaling."); - ctk_help_term(b, &i, "Split-Frame Rendering"); - ctk_help_para(b, &i, "In this mode, OpenGL draws a horizontal green " + "bar indicates more scaling.")); + ctk_help_term(b, &i, _("Split-Frame Rendering")); + ctk_help_para(b, &i, _("In this mode, OpenGL draws a horizontal green " "line showing where the screen is split. Everything " "above the line is drawn on one GPU and everything " - "below is drawn on the other."); - ctk_help_term(b, &i, "Multi-GPU Antialiasing"); - ctk_help_para(b, &i, "In this mode, OpenGL draws a horizontal green " + "below is drawn on the other.")); + ctk_help_term(b, &i, _("Multi-GPU Antialiasing")); + ctk_help_para(b, &i, _("In this mode, OpenGL draws a horizontal green " "line one third of the way across the screen. Above " "this line, the images from both GPUs are blended to " "produce the currently selected multi-GPU AA mode. Below the " "line, the image from just one GPU is displayed without " "blending. This allows easy comparison between the " - "multi-GPU AA and single-GPU AA modes."); + "multi-GPU AA and single-GPU AA modes.")); } if (ctk_opengl->active_attributes & __SHOW_GRAPHICS_VISUAL_INDICATOR) { diff --git a/src/gtk+-2.x/ctkpowermizer.c b/src/gtk+-2.x/ctkpowermizer.c index 7a2d8b57..8760f0e1 100644 --- a/src/gtk+-2.x/ctkpowermizer.c +++ b/src/gtk+-2.x/ctkpowermizer.c @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -31,7 +32,8 @@ #include "ctkbanner.h" #include "ctkdropdownmenu.h" - +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING #define FRAME_PADDING 10 #define DEFAULT_UPDATE_POWERMIZER_INFO_TIME_INTERVAL 1000 @@ -64,82 +66,82 @@ static void offset_value_changed_event_received(GObject *object, static void update_editable_perf_level_info(CtkPowermizer *ctk_powermizer); static const char *__adaptive_clock_help = -"The Adaptive Clocking status describes if this feature " -"is currently enabled in this GPU."; +N_("The Adaptive Clocking status describes if this feature " +"is currently enabled in this GPU."); static const char *__power_source_help = -"The Power Source indicates whether the machine " -"is running on AC or Battery power."; +N_("The Power Source indicates whether the machine " +"is running on AC or Battery power."); static const char *__current_pcie_link_width_help = -"This is the current PCIe link width of the GPU, in number of lanes."; +N_("This is the current PCIe link width of the GPU, in number of lanes."); static const char *__current_pcie_link_speed_help = -"This is the current PCIe link speed of the GPU, " -"in gigatransfers per second (GT/s)."; +N_("This is the current PCIe link speed of the GPU, " +"in gigatransfers per second (GT/s)."); static const char *__performance_level_help = -"This indicates the current Performance Level of the GPU."; +N_("This indicates the current Performance Level of the GPU."); static const char *__gpu_clock_freq_help = -"This indicates the current Graphics Clock frequency."; +N_("This indicates the current Graphics Clock frequency."); static const char *__memory_transfer_rate_freq_help = -"This indicates the current Memory transfer rate."; +N_("This indicates the current Memory transfer rate."); static const char *__processor_clock_freq_help = -"This indicates the current Processor Clock frequency."; +N_("This indicates the current Processor Clock frequency."); static const char *__performance_levels_table_help = -"This indicates the Performance Levels available for the GPU. Each " +N_("This indicates the Performance Levels available for the GPU. Each " "performance level is indicated by a Performance Level number, along with " "the Graphics, Memory and Processor clocks for that level. The currently active " "performance level is shown in regular text. All other performance " "levels are shown in gray. Note that multiple performance levels may share " -"the same range of available clocks."; +"the same range of available clocks."); static const char *__editable_performance_levels_table_help = -"Each Performance Level that allows clock modifications will allow custom " +N_("Each Performance Level that allows clock modifications will allow custom " "offsets to be applied to the Graphics clock and Memory Transfer Rate." " For clock domains that have a minimum and maximum clock per " -"performance level, the offset applies to both the minimum and maximum."; +"performance level, the offset applies to both the minimum and maximum."); static const char *__gpu_clock_offset_help = -"This is the amount, in MHz, to over- or under-clock the Graphics Clock." -" The requested offset will be adjusted to the nearest available clock."; +N_("This is the amount, in MHz, to over- or under-clock the Graphics Clock." +" The requested offset will be adjusted to the nearest available clock."); static const char *__memory_transfer_rate_offset_help = -"This is the amount, in MHz, to over- or under-clock the Memory Transfer Rate."; +N_("This is the amount, in MHz, to over- or under-clock the Memory Transfer Rate."); static const char *__powermizer_menu_help = -"The Preferred Mode menu allows you to choose the preferred Performance " +N_("The Preferred Mode menu allows you to choose the preferred Performance " "State for the GPU, provided the GPU has multiple Performance Levels. " "If a single X server is running, the mode selected in nvidia-settings is what " "the system will be using; if two or more X servers are running, the behavior " "is undefined. The value of this setting does not persist across X server or " -"system restarts. "; +"system restarts. "); static const char *__powermizer_auto_mode_help = -"'Auto' mode lets the driver choose the best Performance State for your GPU. "; +N_("'Auto' mode lets the driver choose the best Performance State for your GPU. "); static const char *__powermizer_adaptive_mode_help = -"'Adaptive' mode allows the GPU clocks to be adjusted based on GPU " -"utilization. "; +N_("'Adaptive' mode allows the GPU clocks to be adjusted based on GPU " +"utilization. "); static const char *__powermizer_prefer_maximum_performance_help = -"'Prefer Maximum Performance' hints to the driver to prefer higher GPU clocks, " -"when possible. "; +N_("'Prefer Maximum Performance' hints to the driver to prefer higher GPU clocks, " +"when possible. "); static const char *__powermizer_prefer_consistent_performance_help = -"'Prefer Consistent Performance' hints to the driver to lock to GPU base clocks, " -"when possible. "; +N_("'Prefer Consistent Performance' hints to the driver to lock to GPU base clocks, " +"when possible. "); static const char *__dp_configuration_button_help = -"CUDA - Double Precision lets you enable " +N_("CUDA - Double Precision lets you enable " "increased double-precision calculations in CUDA applications. Available on " "GPUs with the capability for increased double-precision performance." " NOTE: Selecting a GPU reduces performance for non-CUDA applications, " -"including games. To increase game performance, disable this checkbox."; +"including games. To increase game performance, disable this checkbox."); GType ctk_powermizer_get_type(void) { @@ -269,19 +271,19 @@ static void post_set_attribute_offset_value(CtkPowermizer *ctk_powermizer, switch (attribute) { case NV_CTRL_GPU_NVCLOCK_OFFSET_ALL_PERFORMANCE_LEVELS: case NV_CTRL_GPU_NVCLOCK_OFFSET: - str = "Graphics Clock"; + str = _("Graphics Clock"); break; case NV_CTRL_GPU_MEM_TRANSFER_RATE_OFFSET_ALL_PERFORMANCE_LEVELS: case NV_CTRL_GPU_MEM_TRANSFER_RATE_OFFSET: - str = "Memory Transfer Rate"; + str = _("Memory Transfer Rate"); break; default: - str = "unknown"; + str = _("unknown"); break; } ctk_config_statusbar_message(ctk_powermizer->ctk_config, - "%s offset set to %d.", str, val); + _("%s offset set to %d."), str, val); } @@ -358,7 +360,7 @@ static void update_editable_perf_level_info(CtkPowermizer *ctk_powermizer) hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Editable Performance Levels"); + label = gtk_label_new(_("Editable Performance Levels")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -374,7 +376,7 @@ static void update_editable_perf_level_info(CtkPowermizer *ctk_powermizer) ctk_powermizer->editable_perf_level_table = table; if (ctk_powermizer->performance_level) { - label = gtk_label_new("Level"); + label = gtk_label_new(_("Level")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -390,19 +392,19 @@ static void update_editable_perf_level_info(CtkPowermizer *ctk_powermizer) if (ctk_powermizer->gpu_clock && ctk_powermizer->nvclock_attribute) { /* Graphics clock */ - label = gtk_label_new("Graphics Clock Offset"); + label = gtk_label_new(_("Graphics Clock Offset")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+0, col_idx+3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Current"); + label = gtk_label_new(_("Current")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+0, col_idx+1, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Min"); + label = gtk_label_new(_("Min")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+1, col_idx+2, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Max"); + label = gtk_label_new(_("Max")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+2, col_idx+3, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -418,19 +420,19 @@ static void update_editable_perf_level_info(CtkPowermizer *ctk_powermizer) if (ctk_powermizer->memory_transfer_rate && ctk_powermizer->mem_transfer_rate_attribute) { /* Memory transfer rate */ - label = gtk_label_new("Memory Transfer Rate Offset"); + label = gtk_label_new(_("Memory Transfer Rate Offset")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+0, col_idx+3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Current"); + label = gtk_label_new(_("Current")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+0, col_idx+1, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Min"); + label = gtk_label_new(_("Min")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+1, col_idx+2, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Max"); + label = gtk_label_new(_("Max")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+2, col_idx+3, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -475,7 +477,7 @@ static void update_editable_perf_level_info(CtkPowermizer *ctk_powermizer) gtk_entry_set_width_chars(GTK_ENTRY(txt_nvclock_offset), 6); ctk_config_set_tooltip(ctk_powermizer->ctk_config, txt_nvclock_offset, - __gpu_clock_offset_help); + _(__gpu_clock_offset_help)); g_signal_connect(G_OBJECT(txt_nvclock_offset), "activate", G_CALLBACK(set_attribute_offset_value), (gpointer) ctk_powermizer); @@ -507,7 +509,7 @@ static void update_editable_perf_level_info(CtkPowermizer *ctk_powermizer) 6); ctk_config_set_tooltip(ctk_powermizer->ctk_config, txt_mem_transfer_rate_offset, - __memory_transfer_rate_offset_help); + _(__memory_transfer_rate_offset_help)); g_signal_connect(G_OBJECT(txt_mem_transfer_rate_offset), "activate", G_CALLBACK(set_attribute_offset_value), @@ -526,7 +528,7 @@ static void update_editable_perf_level_info(CtkPowermizer *ctk_powermizer) if (ctk_powermizer->performance_level) { if (ctk_powermizer->editable_performance_levels_unified) { - label = gtk_label_new("All"); + label = gtk_label_new(_("All")); } else { g_snprintf(tmp_str, 24, "%d", i); label = gtk_label_new(tmp_str); @@ -722,7 +724,7 @@ static void update_perf_mode_table(CtkPowermizer *ctk_powermizer, table, FALSE, FALSE, 0); if (ctk_powermizer->performance_level) { - label = gtk_label_new("Level"); + label = gtk_label_new(_("Level")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -735,15 +737,15 @@ static void update_perf_mode_table(CtkPowermizer *ctk_powermizer, if (ctk_powermizer->gpu_clock) { /* Graphics clock */ - label = gtk_label_new("Graphics Clock"); + label = gtk_label_new(_("Graphics Clock")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+2, col_idx+4, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Min"); + label = gtk_label_new(_("Min")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+2, col_idx+3, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Max"); + label = gtk_label_new(_("Max")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+3, col_idx+4, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -759,15 +761,15 @@ static void update_perf_mode_table(CtkPowermizer *ctk_powermizer, /* Memory transfer rate */ if (ctk_powermizer->memory_transfer_rate && pEntry[i].memtransferratemin_specified) { - label = gtk_label_new("Memory Transfer Rate"); + label = gtk_label_new(_("Memory Transfer Rate")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+1, col_idx+3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Min"); + label = gtk_label_new(_("Min")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+1, col_idx+2, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Max"); + label = gtk_label_new(_("Max")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+2, col_idx+3, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -782,15 +784,15 @@ static void update_perf_mode_table(CtkPowermizer *ctk_powermizer, if (ctk_powermizer->processor_clock) { /* Processor clock */ - label = gtk_label_new("Processor Clock"); + label = gtk_label_new(_("Processor Clock")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+1, col_idx+3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Min"); + label = gtk_label_new(_("Min")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+1, col_idx+2, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Max"); + label = gtk_label_new(_("Max")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+2, col_idx+3, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -813,13 +815,13 @@ static void update_perf_mode_table(CtkPowermizer *ctk_powermizer, if (ctk_powermizer->performance_level) { label = gtk_label_new("Performance Level"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); + gtk_misc_set_alignment(GTK_MISC(_(label)), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); } if (ctk_powermizer->gpu_clock) { - label = gtk_label_new("Graphics Clock"); + label = gtk_label_new(_("Graphics Clock")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -828,7 +830,7 @@ static void update_perf_mode_table(CtkPowermizer *ctk_powermizer, if (pEntry[i].memtransferrate_specified && ctk_powermizer->memory_transfer_rate) { - label = gtk_label_new("Memory Transfer Rate"); + label = gtk_label_new(_("Memory Transfer Rate")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+1, col_idx+2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -836,7 +838,7 @@ static void update_perf_mode_table(CtkPowermizer *ctk_powermizer, } if (ctk_powermizer->processor_clock) { - label = gtk_label_new("Processor Clock"); + label = gtk_label_new(_("Processor Clock")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, col_idx+1, col_idx+2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -1008,13 +1010,13 @@ static gboolean update_powermizer_info(gpointer user_data) if (ret == NvCtrlSuccess && ctk_powermizer->adaptive_clock_status) { if (adaptive_clock == NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE_ENABLED) { - s = g_strdup_printf("Enabled"); + s = g_strdup_printf(_("Enabled")); } else if (adaptive_clock == NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE_DISABLED) { - s = g_strdup_printf("Disabled"); + s = g_strdup_printf(_("Disabled")); } else { - s = g_strdup_printf("Error"); + s = g_strdup_printf(_("Error")); } gtk_label_set_text(GTK_LABEL(ctk_powermizer->adaptive_clock_status), s); @@ -1064,13 +1066,13 @@ static gboolean update_powermizer_info(gpointer user_data) if (ret == NvCtrlSuccess && ctk_powermizer->power_source) { if (power_source == NV_CTRL_GPU_POWER_SOURCE_AC) { - s = g_strdup_printf("AC"); + s = g_strdup_printf(_("AC")); } else if (power_source == NV_CTRL_GPU_POWER_SOURCE_BATTERY) { - s = g_strdup_printf("Battery"); + s = g_strdup_printf(_("Battery")); } else { - s = g_strdup_printf("Error"); + s = g_strdup_printf(_("Error")); } gtk_label_set_text(GTK_LABEL(ctk_powermizer->power_source), s); @@ -1117,16 +1119,16 @@ static gchar* get_powermizer_menu_label(const unsigned int val) switch (val) { case NV_CTRL_GPU_POWER_MIZER_MODE_AUTO: - label = g_strdup_printf("Auto"); + label = g_strdup_printf(_("Auto")); break; case NV_CTRL_GPU_POWER_MIZER_MODE_ADAPTIVE: - label = g_strdup_printf("Adaptive"); + label = g_strdup_printf(_("Adaptive")); break; case NV_CTRL_GPU_POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE: - label = g_strdup_printf("Prefer Maximum Performance"); + label = g_strdup_printf(_("Prefer Maximum Performance")); break; case NV_CTRL_GPU_POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE: - label = g_strdup_printf("Prefer Consistent Performance"); + label = g_strdup_printf(_("Prefer Consistent Performance")); break; default: label = g_strdup_printf(""); @@ -1153,11 +1155,11 @@ static gchar* get_powermizer_help_text(const unsigned int bit_mask) text = g_strdup_printf("%s%s%s%s%s", - __powermizer_menu_help, - bAuto ? __powermizer_auto_mode_help : "", - bAdaptive ? __powermizer_adaptive_mode_help : "", - bMaximum ? __powermizer_prefer_maximum_performance_help : "", - bConsistent ? __powermizer_prefer_consistent_performance_help : ""); + _(__powermizer_menu_help), + bAuto ? _(__powermizer_auto_mode_help) : "", + bAdaptive ? _(__powermizer_adaptive_mode_help) : "", + bMaximum ? _(__powermizer_prefer_maximum_performance_help) : "", + bConsistent ? _(__powermizer_prefer_consistent_performance_help) : ""); return text; } @@ -1336,7 +1338,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("PowerMizer Information"); + label = gtk_label_new(_("PowerMizer Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -1352,12 +1354,12 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, if (adaptive_clock_state_available) { ctk_powermizer->adaptive_clock_status = add_table_row_with_help_text(table, ctk_config, - __adaptive_clock_help, + _(__adaptive_clock_help), row++, //row 0, // column 0.0f, 0.5, - "Adaptive Clocking:", + _("Adaptive Clocking:"), 0.0, 0.5, NULL); @@ -1372,12 +1374,12 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, row += 3; ctk_powermizer->gpu_clock = add_table_row_with_help_text(table, ctk_config, - __gpu_clock_freq_help, + _(__gpu_clock_freq_help), row++, //row 0, // column 0.0f, 0.5, - "Graphics Clock:", + _("Graphics Clock:"), 0.0, 0.5, NULL); @@ -1387,12 +1389,12 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, if (mem_transfer_rate_available) { ctk_powermizer->memory_transfer_rate = add_table_row_with_help_text(table, ctk_config, - __memory_transfer_rate_freq_help, + _(__memory_transfer_rate_freq_help), row++, //row 0, // column 0.0f, 0.5, - "Memory Transfer Rate:", + _("Memory Transfer Rate:"), 0.0, 0.5, NULL); @@ -1405,12 +1407,12 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, row += 3; ctk_powermizer->processor_clock = add_table_row_with_help_text(table, ctk_config, - __processor_clock_freq_help, + _(__processor_clock_freq_help), row++, //row 0, // column 0.0f, 0.5, - "Processor Clock:", + _("Processor Clock:"), 0.0, 0.5, NULL); @@ -1423,12 +1425,12 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, row += 3; ctk_powermizer->power_source = add_table_row_with_help_text(table, ctk_config, - __power_source_help, + _(__power_source_help), row++, //row 0, // column 0.0f, 0.5, - "Power Source:", + _("Power Source:"), 0.0, 0.5, NULL); @@ -1441,12 +1443,12 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, row += 3; ctk_powermizer->link_width = add_table_row_with_help_text(table, ctk_config, - __current_pcie_link_width_help, + _(__current_pcie_link_width_help), row++, //row 0, // column 0.0f, 0.5, - "Current PCIe Link Width:", + _("Current PCIe Link Width:"), 0.0, 0.5, NULL); @@ -1454,12 +1456,12 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, /* Current PCIe Link Speed */ ctk_powermizer->link_speed = add_table_row_with_help_text(table, ctk_config, - __current_pcie_link_speed_help, + _(__current_pcie_link_speed_help), row++, //row 0, // column 0.0f, 0.5, - "Current PCIe Link Speed:", + _("Current PCIe Link Speed:"), 0.0, 0.5, NULL); @@ -1474,12 +1476,12 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, row += 3; ctk_powermizer->performance_level = add_table_row_with_help_text(table, ctk_config, - __performance_level_help, + _(__performance_level_help), row++, //row 0, // column 0.0f, 0.5, - "Performance Level:", + _("Performance Level:"), 0.0, 0.5, NULL); @@ -1494,7 +1496,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Performance Levels"); + label = gtk_label_new(_("Performance Levels")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -1512,7 +1514,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, /* Register a timer callback to update the temperatures */ - s = g_strdup_printf("PowerMizer Monitor (GPU %d)", + s = g_strdup_printf(_("PowerMizer Monitor (GPU %d)"), NvCtrlGetTargetId(ctrl_target)); ctk_config_add_timer(ctk_powermizer->ctk_config, @@ -1545,7 +1547,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, hbox2 = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox2, FALSE, FALSE, 0); - label = gtk_label_new("PowerMizer Settings"); + label = gtk_label_new(_("PowerMizer Settings")); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -1593,7 +1595,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, hbox2 = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Preferred Mode:"); + label = gtk_label_new(_("Preferred Mode:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); @@ -1607,7 +1609,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, hbox2 = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox2, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Current Mode:"); + label = gtk_label_new(_("Current Mode:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); @@ -1655,7 +1657,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("CUDA"); + label = gtk_label_new(_("CUDA")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -1663,7 +1665,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, hbox2 = gtk_hbox_new(FALSE, 0); ctk_powermizer->configuration_button = - gtk_check_button_new_with_label("CUDA - Double precision"); + gtk_check_button_new_with_label(_("CUDA - Double precision")); gtk_box_pack_start(GTK_BOX(hbox2), ctk_powermizer->configuration_button, FALSE, FALSE, 0); @@ -1705,7 +1707,7 @@ GtkWidget* ctk_powermizer_new(CtrlTarget *ctrl_target, } ctk_config_set_tooltip(ctk_config, ctk_powermizer->configuration_button, - __dp_configuration_button_help); + _(__dp_configuration_button_help)); g_signal_connect(G_OBJECT(ctk_powermizer->configuration_button), "clicked", G_CALLBACK(dp_config_button_toggled), @@ -1780,7 +1782,7 @@ static void post_powermizer_menu_update(CtkPowermizer *ctk_powermizer) const char *label = ctk_drop_down_menu_get_current_name(menu); ctk_config_statusbar_message(ctk_powermizer->ctk_config, - "Preferred Mode set to %s.", label); + _("Preferred Mode set to %s."), label); } @@ -1879,7 +1881,7 @@ static void powermizer_menu_changed(GtkWidget *widget, powerMizerMode); if (ret != NvCtrlSuccess) { ctk_config_statusbar_message(ctk_powermizer->ctk_config, - "Unable to set Preferred Mode to %s.", + _("Unable to set Preferred Mode to %s."), label); return; } @@ -1906,10 +1908,10 @@ static void show_dp_toggle_warning_dlg(CtkPowermizer *ctk_powermizer) GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Changes to the CUDA - Double precision " + _("Changes to the CUDA - Double precision " "setting " "require a system reboot before " - "taking effect."); + "taking effect.")); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy (dlg); @@ -1925,15 +1927,15 @@ static void post_dp_configuration_update(CtkPowermizer *ctk_powermizer) { gboolean enabled = ctk_powermizer->dp_enabled; - const char *conf_string = enabled ? "enabled" : "disabled"; + const char *conf_string = enabled ? _("enabled") : _("disabled"); char message[128]; if (ctk_powermizer->attribute == NV_CTRL_GPU_DOUBLE_PRECISION_BOOST_REBOOT) { - snprintf(message, sizeof(message), "CUDA - Double precision will " - "be %s after reboot.", + snprintf(message, sizeof(message), _("CUDA - Double precision will " + "be %s after reboot."), conf_string); } else { - snprintf(message, sizeof(message), "CUDA - Double precision %s.", + snprintf(message, sizeof(message), _("CUDA - Double precision %s."), conf_string); } @@ -2036,9 +2038,9 @@ static void dp_config_button_toggled(GtkWidget *widget, enabled); if (ret != NvCtrlSuccess) { ctk_config_statusbar_message(ctk_powermizer->ctk_config, - "Failed to set " + _("Failed to set " "CUDA - Double precision " - "configuration!"); + "configuration!")); return; } @@ -2046,7 +2048,7 @@ static void dp_config_button_toggled(GtkWidget *widget, dp_set_config_status(ctk_powermizer); if (ctk_powermizer->status) { gtk_label_set_text(GTK_LABEL(ctk_powermizer->status), - "pending reboot"); + _("pending reboot")); } /* Update status bar message */ @@ -2066,66 +2068,66 @@ GtkTextBuffer *ctk_powermizer_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "PowerMizer Monitor Help"); - ctk_help_para(b, &i, "This page shows powermizer monitor options " - "available on this GPU."); + ctk_help_title(b, &i, _("PowerMizer Monitor Help")); + ctk_help_para(b, &i, _("This page shows powermizer monitor options " + "available on this GPU.")); if (ctk_powermizer->adaptive_clock_status) { - ctk_help_heading(b, &i, "Adaptive Clocking"); - ctk_help_para(b, &i, "%s", __adaptive_clock_help); + ctk_help_heading(b, &i, _("Adaptive Clocking")); + ctk_help_para(b, &i, "%s", _(__adaptive_clock_help)); } if (ctk_powermizer->gpu_clock) { - ctk_help_heading(b, &i, "Clock Frequencies"); + ctk_help_heading(b, &i, _("Clock Frequencies")); if (ctk_powermizer->memory_transfer_rate && ctk_powermizer->processor_clock) { - s = "This indicates the GPU's current Graphics Clock, " - "Memory transfer rate and Processor Clock frequencies."; + s = _("This indicates the GPU's current Graphics Clock, " + "Memory transfer rate and Processor Clock frequencies."); } else if (ctk_powermizer->memory_transfer_rate) { - s = "This indicates the GPU's current Graphics Clock and " - "Memory transfer rate."; + s = _("This indicates the GPU's current Graphics Clock and " + "Memory transfer rate."); } else { - s = "This indicates the GPU's current Graphics Clock ferquencies."; + s = _("This indicates the GPU's current Graphics Clock ferquencies."); } ctk_help_para(b, &i, "%s", s); } if (ctk_powermizer->power_source) { - ctk_help_heading(b, &i, "Power Source"); - ctk_help_para(b, &i, "%s", __power_source_help); + ctk_help_heading(b, &i, _("Power Source")); + ctk_help_para(b, &i, "%s", _(__power_source_help)); } if (ctk_powermizer->pcie_gen_queriable) { - ctk_help_heading(b, &i, "Current PCIe link width"); - ctk_help_para(b, &i, "%s", __current_pcie_link_width_help); - ctk_help_heading(b, &i, "Current PCIe link speed"); - ctk_help_para(b, &i, "%s", __current_pcie_link_speed_help); + ctk_help_heading(b, &i, _("Current PCIe link width")); + ctk_help_para(b, &i, "%s", _(__current_pcie_link_width_help)); + ctk_help_heading(b, &i, _("Current PCIe link speed")); + ctk_help_para(b, &i, "%s", _(__current_pcie_link_speed_help)); } if (ctk_powermizer->performance_level) { - ctk_help_heading(b, &i, "Performance Level"); - ctk_help_para(b, &i, "%s", __performance_level_help); - ctk_help_heading(b, &i, "Performance Levels (Table)"); - ctk_help_para(b, &i, "%s", __performance_levels_table_help); + ctk_help_heading(b, &i, _("Performance Level")); + ctk_help_para(b, &i, "%s", _(__performance_level_help)); + ctk_help_heading(b, &i, _("Performance Levels (Table)")); + ctk_help_para(b, &i, "%s", _(__performance_levels_table_help)); } if (ctk_powermizer->hasEditablePerfLevel) { - ctk_help_heading(b, &i, "Editable Performance Levels (Table)"); - ctk_help_para(b, &i, "%s", __editable_performance_levels_table_help); - ctk_help_heading(b, &i, "Graphics Clock Offset"); - ctk_help_para(b, &i, "%s", __gpu_clock_offset_help); - ctk_help_heading(b, &i, "Memory Transfer Rate Offset"); - ctk_help_para(b, &i, "%s", __memory_transfer_rate_offset_help); + ctk_help_heading(b, &i, _("Editable Performance Levels (Table)")); + ctk_help_para(b, &i, "%s", _(__editable_performance_levels_table_help)); + ctk_help_heading(b, &i, _("Graphics Clock Offset")); + ctk_help_para(b, &i, "%s", _(__gpu_clock_offset_help)); + ctk_help_heading(b, &i, _("Memory Transfer Rate Offset")); + ctk_help_para(b, &i, "%s", _(__memory_transfer_rate_offset_help)); } if (ctk_powermizer->powermizer_menu) { - ctk_help_heading(b, &i, "PowerMizer Settings"); + ctk_help_heading(b, &i, _("PowerMizer Settings")); ctk_help_para(b, &i, "%s", ctk_powermizer->powermizer_menu_help); } if (ctk_powermizer->configuration_button) { - ctk_help_heading(b, &i, "CUDA - Double precision"); - ctk_help_para(b, &i, "%s", __dp_configuration_button_help); + ctk_help_heading(b, &i, _("CUDA - Double precision")); + ctk_help_para(b, &i, "%s", _(__dp_configuration_button_help)); } ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkscreen.c b/src/gtk+-2.x/ctkscreen.c index a4528491..7f26b203 100644 --- a/src/gtk+-2.x/ctkscreen.c +++ b/src/gtk+-2.x/ctkscreen.c @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -37,6 +38,8 @@ #include "ctkglwidget.h" #include "ctkglstereo.h" +#define _(STRING) gettext(STRING) + void ctk_screen_event_handler(GtkWidget *widget, CtrlEvent *event, gpointer data); @@ -164,7 +167,7 @@ GtkWidget* ctk_screen_new(CtrlTarget *ctrl_target, CtkEvent *ctk_event) display_name = NvCtrlGetDisplayName(ctrl_target); - dimensions = g_strdup_printf("%dx%d pixels (%dx%d millimeters)", + dimensions = g_strdup_printf(_("%dx%d pixels (%dx%d millimeters)"), NvCtrlGetScreenWidth(ctrl_target), NvCtrlGetScreenHeight(ctrl_target), NvCtrlGetScreenWidthMM(ctrl_target), @@ -184,7 +187,7 @@ GtkWidget* ctk_screen_new(CtrlTarget *ctrl_target, CtkEvent *ctk_event) yres = (((double) NvCtrlGetScreenHeight(ctrl_target)) * 25.4) / ((double) NvCtrlGetScreenHeightMM(ctrl_target)); - resolution = g_strdup_printf("%dx%d dots per inch", + resolution = g_strdup_printf(_("%dx%d dots per inch"), (int) (xres + 0.5), (int) (yres + 0.5)); @@ -214,13 +217,13 @@ GtkWidget* ctk_screen_new(CtrlTarget *ctrl_target, CtkEvent *ctk_event) NV_CTRL_STRING_PRODUCT_NAME, &gpu_name); if (ret != NvCtrlSuccess) { - gpu_name = "Unknown"; + gpu_name = _("Unknown"); } if (gpus) { - tmp_str = g_strdup_printf("%s,\n%s (GPU %d)", + tmp_str = g_strdup_printf("%s,_(\n%s) (GPU %d)", gpus, gpu_name, pData[i]); } else { - tmp_str = g_strdup_printf("%s (GPU %d)", gpu_name, pData[i]); + tmp_str = g_strdup_printf(_("%s (GPU %d)"), gpu_name, pData[i]); } if (ret == NvCtrlSuccess) { free(gpu_name); @@ -229,7 +232,7 @@ GtkWidget* ctk_screen_new(CtrlTarget *ctrl_target, CtkEvent *ctk_event) gpus = tmp_str; } if (!gpus) { - gpus = g_strdup("None"); + gpus = g_strdup(_("None")); } free(pData); } @@ -285,7 +288,7 @@ GtkWidget* ctk_screen_new(CtrlTarget *ctrl_target, CtkEvent *ctk_event) hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("X Screen Information"); + label = gtk_label_new(_("X Screen Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -297,23 +300,23 @@ GtkWidget* ctk_screen_new(CtrlTarget *ctrl_target, CtkEvent *ctk_event) gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - add_table_row(table, 0, 0, 0.5, "Screen Number:", 0, 0.5, screen_number); - add_table_row(table, 1, 0, 0.5, "Display Name:", 0, 0.5, display_name); + add_table_row(table, 0, 0, 0.5, _("Screen Number:"), 0, 0.5, screen_number); + add_table_row(table, 1, 0, 0.5, _("Display Name:"), 0, 0.5, display_name); /* spacing */ ctk_screen->dimensions = - add_table_row(table, 5, 0, 0.5, "Dimensions:", 0, 0.5, dimensions); - add_table_row(table, 6, 0, 0.5, "Resolution:", 0, 0.5, resolution); - add_table_row(table, 7, 0, 0.5, "Depth:", 0, 0.5, depth); + add_table_row(table, 5, 0, 0.5, _("Dimensions:"), 0, 0.5, dimensions); + add_table_row(table, 6, 0, 0.5, _("Resolution:"), 0, 0.5, resolution); + add_table_row(table, 7, 0, 0.5, _("Depth:"), 0, 0.5, depth); /* spacing */ - add_table_row(table, 11, 0, 0, "GPUs:", 0, 0, gpus); + add_table_row(table, 11, 0, 0, _("GPUs:"), 0, 0, gpus); /* spacing */ ctk_screen->displays = - add_table_row(table, 15, 0, 0, "Displays:", 0, 0, displays); + add_table_row(table, 15, 0, 0, _("Displays:"), 0, 0, displays); /* gpu errors */ ctk_screen->gpu_errors = - add_table_row(table, 19, 0, 0, "Recovered GPU Errors:", 0, 0, tmp); + add_table_row(table, 19, 0, 0, _("Recovered GPU Errors:"), 0, 0, tmp); if (ctk_screen->stereo_available) { - add_table_row(table, 20, 0, 0, "Stereo Mode:", 0, 0, + add_table_row(table, 20, 0, 0, _("Stereo Mode:"), 0, 0, NvCtrlGetStereoModeName(stereo_mode)); if (stereo_mode != NV_CTRL_STEREO_OFF) { @@ -364,52 +367,52 @@ GtkTextBuffer *ctk_screen_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "X Screen Information Help"); + ctk_help_title(b, &i, _("X Screen Information Help")); - ctk_help_para(b, &i, "This page in the NVIDIA " + ctk_help_para(b, &i, _("This page in the NVIDIA " "X Server Control Panel describes basic " - "information about the X Screen '%s'.", + "information about the X Screen '%s'."), screen_name); - ctk_help_heading(b, &i, "Screen Number"); - ctk_help_para(b, &i, "This is the X Screen number."); + ctk_help_heading(b, &i, _("Screen Number")); + ctk_help_para(b, &i, _("This is the X Screen number.")); - ctk_help_heading(b, &i, "Display Name"); - ctk_help_para(b, &i, "This is the display connection string used to " - "communicate with the X Screen on the X Server."); + ctk_help_heading(b, &i, _("Display Name")); + ctk_help_para(b, &i, _("This is the display connection string used to " + "communicate with the X Screen on the X Server.")); - ctk_help_heading(b, &i, "Dimensions"); - ctk_help_para(b, &i, "This displays the X Screen's horizontal and " - "vertical dimensions in pixels and millimeters."); + ctk_help_heading(b, &i, _("Dimensions")); + ctk_help_para(b, &i, _("This displays the X Screen's horizontal and " + "vertical dimensions in pixels and millimeters.")); - ctk_help_heading(b, &i, "Resolution"); - ctk_help_para(b, &i, "This is the resolution (in dots per inch) of the " - "X Screen."); + ctk_help_heading(b, &i, _("Resolution")); + ctk_help_para(b, &i, _("This is the resolution (in dots per inch) of the " + "X Screen.")); - ctk_help_heading(b, &i, "Depth"); - ctk_help_para(b, &i, "This is the number of planes (depth) the X Screen " - "has available."); + ctk_help_heading(b, &i, _("Depth")); + ctk_help_para(b, &i, _("This is the number of planes (depth) the X Screen " + "has available.")); - ctk_help_heading(b, &i, "GPUs"); - ctk_help_para(b, &i, "This is the list of GPUs that drive this X Screen."); + ctk_help_heading(b, &i, _("GPUs")); + ctk_help_para(b, &i, _("This is the list of GPUs that drive this X Screen.")); - ctk_help_heading(b, &i, "Display Devices"); - ctk_help_para(b, &i, "This is the list of Display Devices (CRTs, TVs etc) " - "enabled on this X Screen."); + ctk_help_heading(b, &i, _("Display Devices")); + ctk_help_para(b, &i, _("This is the list of Display Devices (CRTs, TVs etc) " + "enabled on this X Screen.")); - ctk_help_heading(b, &i, "Recovered GPU Errors"); - ctk_help_para(b, &i, "The GPU can encounter errors, either due to bugs in " + ctk_help_heading(b, &i, _("Recovered GPU Errors")); + ctk_help_para(b, &i, _("The GPU can encounter errors, either due to bugs in " "the NVIDIA driver, or due to corruption of the command " "stream as it is sent from the NVIDIA X driver to the GPU. " "When the GPU encounters one of these errors, it reports it " "to the NVIDIA X driver and the NVIDIA X driver attempts to " "recover from the error. This reports how many errors the " "GPU received and the NVIDIA X driver successfully recovered " - "from."); + "from.")); if (ctk_screen->stereo_available) { - ctk_help_heading(b, &i, "Stereo Mode"); - ctk_help_para(b, &i, "This is the stereo mode set for the X screen."); + ctk_help_heading(b, &i, _("Stereo Mode")); + ctk_help_para(b, &i, _("This is the stereo mode set for the X screen.")); } ctk_help_finish(b); @@ -435,7 +438,7 @@ void ctk_screen_event_handler(GtkWidget *widget, return; } - dimensions = g_strdup_printf("%dx%d pixels (%dx%d millimeters)", + dimensions = g_strdup_printf(_("%dx%d pixels (%dx%d millimeters)"), event->screen_change.width, event->screen_change.height, event->screen_change.mwidth, diff --git a/src/gtk+-2.x/ctkserver.c b/src/gtk+-2.x/ctkserver.c index e4c21c15..521ac937 100644 --- a/src/gtk+-2.x/ctkserver.c +++ b/src/gtk+-2.x/ctkserver.c @@ -19,6 +19,7 @@ #include /* malloc */ #include /* snprintf */ +#include #include #include @@ -31,6 +32,7 @@ #include "ctkhelp.h" #include "ctkutils.h" +#define _(STRING) gettext(STRING) GType ctk_server_get_type(void) { @@ -286,7 +288,7 @@ GtkWidget* ctk_server_new(CtrlTarget *ctrl_target, else if (os_val == NV_CTRL_OPERATING_SYSTEM_FREEBSD) os = "FreeBSD"; else if (os_val == NV_CTRL_OPERATING_SYSTEM_SUNOS) os = "SunOS"; } - if (!os) os = "Unknown"; + if (!os) os = _("Unknown"); /* NV_CTRL_ARCHITECTURE */ @@ -302,7 +304,7 @@ GtkWidget* ctk_server_new(CtrlTarget *ctrl_target, case NV_CTRL_ARCHITECTURE_PPC64LE: arch = "ppc64le"; break; } } - if (!arch) arch = "Unknown"; + if (!arch) arch = _("Unknown"); os = g_strdup_printf("%s-%s", os, arch); /* NV_CTRL_STRING_NVIDIA_DRIVER_VERSION */ @@ -378,7 +380,7 @@ GtkWidget* ctk_server_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("System Information"); + label = gtk_label_new(_("System Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -393,9 +395,9 @@ GtkWidget* ctk_server_new(CtrlTarget *ctrl_target, gtk_container_set_border_width(GTK_CONTAINER(table), 5); add_table_row(table, 0, - 0, 0.5, "Operating System:", 0, 0.5, os); + 0, 0.5, _("Operating System:"), 0, 0.5, os); add_table_row(table, 1, - 0, 0.5, "NVIDIA Driver Version:", 0, 0.5, driver_version); + 0, 0.5, _("NVIDIA Driver Version:"), 0, 0.5, driver_version); /* * This displays basic X Server information, including @@ -406,7 +408,7 @@ GtkWidget* ctk_server_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("X Server Information"); + label = gtk_label_new(_("X Server Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -419,20 +421,20 @@ GtkWidget* ctk_server_new(CtrlTarget *ctrl_target, gtk_container_set_border_width(GTK_CONTAINER(table), 5); add_table_row(table, 0, - 0, 0.5, "Display Name:", 0, 0.5, display_name); + 0, 0.5, _("Display Name:"), 0, 0.5, display_name); /* separator */ add_table_row(table, 4, - 0, 0.5, "Server Version Number:", 0, 0.5, server_version); + 0, 0.5, _("Server Version Number:"), 0, 0.5, server_version); add_table_row(table, 5, - 0, 0.5, "Server Vendor String:", 0, 0.5, vendor_str); + 0, 0.5, _("Server Vendor String:"), 0, 0.5, vendor_str); add_table_row(table, 6, - 0, 0.5, "Server Vendor Version:", 0, 0.5, vendor_ver); + 0, 0.5, _("Server Vendor Version:"), 0, 0.5, vendor_ver); /* separator */ add_table_row(table, 10, - 0, 0, "NV-CONTROL Version:", 0, 0, nv_control_server_version); + 0, 0, _("NV-CONTROL Version:"), 0, 0, nv_control_server_version); /* separator */ add_table_row(table, 14, - 0, 0, "Screens:", 0, 0, num_screens); + 0, 0, _("Screens:"), 0, 0, num_screens); /* print special trademark text for FreeBSD */ @@ -445,7 +447,7 @@ GtkWidget* ctk_server_new(CtrlTarget *ctrl_target, label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), - "" + _("" "\n" "The mark FreeBSD is a registered trademark " "of The FreeBSD Foundation and is used by " @@ -457,7 +459,7 @@ GtkWidget* ctk_server_new(CtrlTarget *ctrl_target, "with the permission of The FreeBSD " "Foundation." "\n" - ""); + "")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); @@ -499,41 +501,41 @@ GtkTextBuffer *ctk_server_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "X Server Information Help"); + ctk_help_title(b, &i, _("X Server Information Help")); - ctk_help_heading(b, &i, "Operating System"); - ctk_help_para(b, &i, "This is the operating system on which the NVIDIA " + ctk_help_heading(b, &i, _("Operating System")); + ctk_help_para(b, &i, _("This is the operating system on which the NVIDIA " "X driver is running; possible values are " "'Linux', 'FreeBSD', and 'SunOS'. This also specifies the " "platform on which the operating system is running, such " - "as x86, x86_64, or ia64."); + "as x86, x86_64, or ia64.")); - ctk_help_heading(b, &i, "NVIDIA Driver Version"); - ctk_help_para(b, &i, "This is the version of the NVIDIA Accelerated " - "Graphics Driver currently in use."); + ctk_help_heading(b, &i, _("NVIDIA Driver Version")); + ctk_help_para(b, &i, _("This is the version of the NVIDIA Accelerated " + "Graphics Driver currently in use.")); - ctk_help_heading(b, &i, "Display Name"); - ctk_help_para(b, &i, "This is the display connection string used to " - "communicate with the X Server."); + ctk_help_heading(b, &i, _("Display Name")); + ctk_help_para(b, &i, _("This is the display connection string used to " + "communicate with the X Server.")); - ctk_help_heading(b, &i, "Server Version"); - ctk_help_para(b, &i, "This is the version number of the X Server."); + ctk_help_heading(b, &i, _("Server Version")); + ctk_help_para(b, &i, _("This is the version number of the X Server.")); - ctk_help_heading(b, &i, "Server Vendor String"); - ctk_help_para(b, &i, "This is the X Server vendor information string."); + ctk_help_heading(b, &i, _("Server Vendor String")); + ctk_help_para(b, &i, _("This is the X Server vendor information string.")); - ctk_help_heading(b, &i, "Server Vendor Version"); - ctk_help_para(b, &i, "This is the version number of the X Server " - "vendor."); + ctk_help_heading(b, &i, _("Server Vendor Version")); + ctk_help_para(b, &i, _("This is the version number of the X Server " + "vendor.")); - ctk_help_heading(b, &i, "NV-CONTROL Version"); - ctk_help_para(b, &i, "This is the version number of the NV-CONTROL X extension, " + ctk_help_heading(b, &i, _("NV-CONTROL Version")); + ctk_help_para(b, &i, _("This is the version number of the NV-CONTROL X extension, " "used by nvidia-settings to communicate with the " - "NVIDIA X driver."); + "NVIDIA X driver.")); - ctk_help_heading(b, &i, "Screens"); - ctk_help_para(b, &i, "This is the number of X Screens on the " - "display. (When Xinerama is enabled this is always 1)."); + ctk_help_heading(b, &i, _("Screens")); + ctk_help_para(b, &i, _("This is the number of X Screens on the " + "display. (When Xinerama is enabled this is always 1).")); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkslimm.c b/src/gtk+-2.x/ctkslimm.c index 843d6dc7..69bb195b 100644 --- a/src/gtk+-2.x/ctkslimm.c +++ b/src/gtk+-2.x/ctkslimm.c @@ -22,6 +22,7 @@ #include #include +#include #include #include "msg.h" @@ -36,6 +37,7 @@ #include "ctkutils.h" #include "ctkdropdownmenu.h" +#define _(STRING) gettext(STRING) /* Static function declarations */ static void setup_display_refresh_dropdown(CtkSLIMM *ctk_object); @@ -293,14 +295,14 @@ static void save_xconfig_button_clicked(GtkWidget *widget, gpointer user_data) /* Make sure the screen size is acceptable */ if (!compute_screen_size(ctk_object, &width, &height)) { error = TRUE; - err_msg = g_strdup("Unknown screen size!"); + err_msg = g_strdup(_("Unknown screen size!")); } else if ((width > ctk_object->max_screen_width) || (height > ctk_object->max_screen_height)) { error = TRUE; - err_msg = g_strdup_printf("The configured X screen size of %dx%d is \n" + err_msg = g_strdup_printf(_("The configured X screen size of %dx%d is \n" "too large. The maximum supported size is\n" - "%dx%d.", + "%dx%d."), width, height, ctk_object->max_screen_width, ctk_object->max_screen_height); @@ -523,7 +525,7 @@ static void setup_display_refresh_dropdown(CtkSLIMM *ctk_object) modeline_rate = modeline->refresh_rate; - name = g_strdup_printf("%.0f Hz", modeline_rate); + name = g_strdup_printf(_("%.0f Hz"), modeline_rate); /* Get a unique number for this modeline */ @@ -531,7 +533,7 @@ static void setup_display_refresh_dropdown(CtkSLIMM *ctk_object) num_ref = 0; /* Modeline # in a group of similar refresh rates */ for (m = ctk_object->modelines; m; m = m->next) { float m_rate = m->refresh_rate; - gchar *tmp = g_strdup_printf("%.0f Hz", m_rate); + gchar *tmp = g_strdup_printf(_("%.0f Hz"), m_rate); if (m->data.hdisplay == modeline->data.hdisplay && m->data.vdisplay == modeline->data.vdisplay && @@ -553,16 +555,16 @@ static void setup_display_refresh_dropdown(CtkSLIMM *ctk_object) /* Add "DoubleScan" and "Interlace" information */ if (modeline->data.flags & V_DBLSCAN) { - extra = g_strdup_printf("DoubleScan"); + extra = g_strdup_printf(_("DoubleScan")); } if (modeline->data.flags & V_INTERLACE) { if (extra) { - tmp = g_strdup_printf("%s, Interlace", extra); + tmp = g_strdup_printf(_("%s, Interlace"), extra); g_free(extra); extra = tmp; } else { - extra = g_strdup_printf("Interlace"); + extra = g_strdup_printf(_("Interlace")); } } @@ -1369,12 +1371,15 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, /* Make sure we have enough displays for the minimum config */ if (num_displays < 2) { - err_str = g_strdup_printf("Not enough display devices to " - "configure SLI Mosaic Mode.\nYou must " - "have at least 2 Displays connected, " - "but only %d Display%s detected.", - num_displays, - (num_displays != 1) ? "s were" : " was"); + err_str = g_strdup_printf(ngettext("Not enough display devices to " + "configure SLI Mosaic Mode.\nYou must " + "have at least 2 Displays connected, " + "but only %d Display detected.", + "Not enough display devices to " + "configure SLI Mosaic Mode.\nYou must " + "have at least 2 Displays connected, " + "but only %d Displays detected.", num_displays), + num_displays); layout_free(layout); layout = NULL; @@ -1395,8 +1400,8 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, display = intersect_modelines(layout); if (display == NULL) { - err_str = g_strdup("Unable to find active display with " - "intersected modelines."); + err_str = g_strdup(_("Unable to find active display with " + "intersected modelines.")); goto slimm_fail; } else if ((display->modelines == NULL) && (display->cur_mode->modeline == NULL)) { @@ -1430,12 +1435,12 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, (!STEREO_IS_3D_VISION(stereo) && STEREO_IS_3D_VISION(other_stereo))) { - err_str = g_strdup("Unable to find common modelines between\n" + err_str = g_strdup(_("Unable to find common modelines between\n" "all connected displays due to 3D vision\n" "being enabled on some displays and not\n" "others. Please make sure that 3D vision\n" "is enabled on all connected displays\n" - "before enabling SLI mosaic mode."); + "before enabling SLI mosaic mode.")); goto slimm_fail; } @@ -1445,8 +1450,8 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, /* The intersected modepool was empty, but not because of a mismatch * in 3D Vision settings. */ - err_str = g_strdup("Unable to find find common modelines between " - "all connected displays."); + err_str = g_strdup(_("Unable to find find common modelines between " + "all connected displays.")); goto slimm_fail; } @@ -1483,7 +1488,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(ctk_slimm), vbox, TRUE, TRUE, 0); hbox = gtk_hbox_new(FALSE, 0); - checkbutton = gtk_check_button_new_with_label("Use SLI Mosaic Mode"); + checkbutton = gtk_check_button_new_with_label(_("Use SLI Mosaic Mode")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), TRUE); ctk_slimm->cbtn_slimm_enable = checkbutton; g_signal_connect(G_OBJECT(checkbutton), "toggled", @@ -1493,7 +1498,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Display Configuration (rows x columns)"); + label = gtk_label_new(_("Display Configuration (rows x columns)")); hseparator = gtk_hseparator_new(); gtk_widget_show(hseparator); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); @@ -1517,8 +1522,8 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, G_CALLBACK(display_config_changed), (gpointer) ctk_object); - checkbutton = gtk_check_button_new_with_label("Only show configurations " - "using all displays"); + checkbutton = gtk_check_button_new_with_label(_("Only show configurations " + "using all displays")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), only_max); g_signal_connect(G_OBJECT(checkbutton), "toggled", G_CALLBACK(restrict_display_config_changed), @@ -1537,7 +1542,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, gtk_container_set_border_width(GTK_CONTAINER(table), 5); hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Resolution (per display)"); + label = gtk_label_new(_("Resolution (per display)")); hseparator = gtk_hseparator_new(); gtk_widget_show(hseparator); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); @@ -1547,7 +1552,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, GTK_EXPAND | GTK_FILL, 0.5, 0.5); hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Refresh Rate"); + label = gtk_label_new(_("Refresh Rate")); hseparator = gtk_hseparator_new(); gtk_widget_show(hseparator); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); @@ -1592,7 +1597,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, /* Edge Overlap section */ hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Edge Overlap"); + label = gtk_label_new(_("Edge Overlap")); hseparator = gtk_hseparator_new(); gtk_widget_show(hseparator); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); @@ -1602,7 +1607,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, GTK_EXPAND | GTK_FILL, 0.5, 0.5); hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Total Size"); + label = gtk_label_new(_("Total Size")); hseparator = gtk_hseparator_new(); gtk_widget_show(hseparator); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); @@ -1612,7 +1617,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Horizontal:"); + label = gtk_label_new(_("Horizontal:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); spinbutton = gtk_spin_button_new_with_range(-ctk_object->cur_modeline->data.hdisplay, @@ -1628,7 +1633,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(hbox), spinbutton, FALSE, FALSE, 5); - label = gtk_label_new("pixels"); + label = gtk_label_new(_("pixels")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 9, 10, GTK_EXPAND | GTK_FILL, @@ -1636,7 +1641,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Vertical: "); + label = gtk_label_new(_("Vertical: ")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); spinbutton = gtk_spin_button_new_with_range(-ctk_object->cur_modeline->data.vdisplay, @@ -1651,13 +1656,13 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(hbox), spinbutton, FALSE, FALSE, 5); - label = gtk_label_new("pixels"); + label = gtk_label_new(_("pixels")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 10, 11, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0.5, 0.5); - label = gtk_label_new("NULL"); + label = gtk_label_new(_("NULL")); ctk_slimm->lbl_total_size = label; setup_total_size_label(ctk_slimm); @@ -1668,7 +1673,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, GTK_EXPAND | GTK_FILL, 0.5, 0.5); hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Maximum Size"); + label = gtk_label_new(_("Maximum Size")); hseparator = gtk_hseparator_new(); gtk_widget_show(hseparator); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); @@ -1686,7 +1691,7 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, GTK_EXPAND | GTK_FILL, 0.5, 0.5); - label = gtk_label_new("Save to X Configuration File"); + label = gtk_label_new(_("Save to X Configuration File")); hbox = gtk_hbox_new(FALSE, 0); button = gtk_button_new(); ctk_slimm->btn_save_config = button; @@ -1734,10 +1739,10 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, } if (!err_str) { - str = g_strdup("Unable to load SLI Mosaic Mode Settings page."); + str = g_strdup(_("Unable to load SLI Mosaic Mode Settings page.")); } else { - str = g_strdup_printf("Unable to load SLI Mosaic Mode Settings " - "page:\n\n%s", err_str); + str = g_strdup_printf(_("Unable to load SLI Mosaic Mode Settings " + "page:\n\n%s"), err_str); g_free(err_str); } @@ -1764,54 +1769,54 @@ GtkTextBuffer *ctk_slimm_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "SLI Mosaic Mode Settings Help"); + ctk_help_title(b, &i, _("SLI Mosaic Mode Settings Help")); - ctk_help_para(b, &i, "This page allows easy configuration " - "of SLI Mosaic Mode."); + ctk_help_para(b, &i, _("This page allows easy configuration " + "of SLI Mosaic Mode.")); - ctk_help_heading(b, &i, "Use SLI Mosaic Mode"); - ctk_help_para(b, &i, "This checkbox controls whether SLI Mosaic Mode is enabled " - "or disabled."); + ctk_help_heading(b, &i, _("Use SLI Mosaic Mode")); + ctk_help_para(b, &i, _("This checkbox controls whether SLI Mosaic Mode is enabled " + "or disabled.")); - ctk_help_heading(b, &i, "Display Configuration"); - ctk_help_para(b, &i, "This drop down menu allows selection of the display grid " + ctk_help_heading(b, &i, _("Display Configuration")); + ctk_help_para(b, &i, _("This drop down menu allows selection of the display grid " "configuration for SLI Mosaic Mode; the possible configurations " - "are described as rows x columns."); + "are described as rows x columns.")); - ctk_help_heading(b, &i, "Resolution"); - ctk_help_para(b, &i, "This drop down menu allows selection of the resolution to " + ctk_help_heading(b, &i, _("Resolution")); + ctk_help_para(b, &i, _("This drop down menu allows selection of the resolution to " "use for each of the displays in SLI Mosaic Mode. Note that only " "the resolutions that are available for each display will be " - "shown here."); + "shown here.")); - ctk_help_heading(b, &i, "Refresh Rate"); - ctk_help_para(b, &i, "This drop down menu allows selection of the refresh rate " + ctk_help_heading(b, &i, _("Refresh Rate")); + ctk_help_para(b, &i, _("This drop down menu allows selection of the refresh rate " "to use for each of the displays in SLI Mosaic Mode. By default " "the highest refresh rate each of the displays can achieve at " "the selected resolution is chosen. This combo box gets updated " - "when a new resolution is picked."); + "when a new resolution is picked.")); - ctk_help_heading(b, &i, "Edge Overlap"); - ctk_help_para(b, &i, "These two controls allow the user to specify the " + ctk_help_heading(b, &i, _("Edge Overlap")); + ctk_help_para(b, &i, _("These two controls allow the user to specify the " "Horizontal and Vertical Edge Overlap values. The displays " "will overlap by the specified number of pixels when forming " "the grid configuration. For example, 4 flat panel displays " "forming a 2 x 2 grid in SLI Mosaic Mode with a resolution of " "1600x1200 and a Horizontal and Vertical Edge overlap of 50 " "will generate the following MetaMode: \"1600x1200+0+0," - "1600x1200+1550+0,1600x1200+0+1150,1600x1200+1550+1150\"."); + "1600x1200+1550+0,1600x1200+0+1150,1600x1200+1550+1150\".")); - ctk_help_heading(b, &i, "Total Size"); - ctk_help_para(b, &i, "This is the total size of the X screen formed using all " - "displays in SLI Mosaic Mode."); + ctk_help_heading(b, &i, _("Total Size")); + ctk_help_para(b, &i, _("This is the total size of the X screen formed using all " + "displays in SLI Mosaic Mode.")); - ctk_help_heading(b, &i, "Maximum Size"); - ctk_help_para(b, &i, "This is the maximum allowable size of the X screen " - "formed using all displays in SLI Mosaic Mode."); + ctk_help_heading(b, &i, _("Maximum Size")); + ctk_help_para(b, &i, _("This is the maximum allowable size of the X screen " + "formed using all displays in SLI Mosaic Mode.")); - ctk_help_heading(b, &i, "Save to X Configuration File"); - ctk_help_para(b, &i, "Clicking this button saves the selected SLI Mosaic Mode " - "settings into the X Configuration File."); + ctk_help_heading(b, &i, _("Save to X Configuration File")); + ctk_help_para(b, &i, _("Clicking this button saves the selected SLI Mosaic Mode " + "settings into the X Configuration File.")); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkthermal.c b/src/gtk+-2.x/ctkthermal.c index 873e2199..eb1b3ed8 100644 --- a/src/gtk+-2.x/ctkthermal.c +++ b/src/gtk+-2.x/ctkthermal.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "ctkutils.h" #include "ctkscale.h" @@ -28,6 +29,9 @@ #include "ctkgauge.h" #include "ctkbanner.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + #define FRAME_PADDING 10 #define DEFAULT_UPDATE_THERMAL_INFO_TIME_INTERVAL 1000 @@ -52,73 +56,70 @@ static GtkWidget *pack_gauge(GtkWidget *hbox, gint lower, gint upper, CtkConfig *ctk_config, const char *help); static const char *__core_threshold_help = -"The Core Slowdown Threshold Temperature is the temperature " +N_("The Core Slowdown Threshold Temperature is the temperature " "at which the NVIDIA Accelerated Graphics driver will throttle " -"the GPU to prevent damage, in \xc2\xb0" -/* split for g_utf8_validate() */ "C."; +"the GPU to prevent damage, in degrees Celsius."); static const char *__core_temp_help = -"The Core Temperature is the Graphics Processing Unit's " -"(GPU) current core temperature, in \xc2\xb0" -/* split for g_utf8_validate() */ "C."; +N_("The Core Temperature is the Graphics Processing Unit's " +"(GPU) current core temperature, in degrees Celsius."); static const char *__ambient_temp_help = -"The Ambient Temperature is the current temperature in the " -"GPU's immediate neighbourhood, in \xc2\xb0" -/* split for g_utf8_validate() */ "C."; +N_("The Ambient Temperature is the current temperature in the " +"GPU's immediate neighbourhood, in degrees Celsius."); static const char *__temp_level_help = -"This is a graphical representation of the current GPU core " +N_("This is a graphical representation of the current GPU core " "temperature relative to the maximum GPU Core Slowdown " -"Threshold temperature."; +"Threshold temperature."); static const char *__thermal_sensor_id_help = -"This shows the thermal sensor's index."; +N_("This shows the thermal sensor's index."); static const char *__thermal_sensor_target_help = -"This shows what hardware component the thermal sensor is measuring."; +N_("This shows what hardware component the thermal sensor is measuring."); static const char *__thermal_sensor_provider_help = -"This shows the hardware device that provides the thermal sensor."; +N_("This shows the hardware device that provides the thermal sensor."); static const char *__thermal_sensor_reading_help = -"This shows the thermal sensor's current reading."; +N_("This shows the thermal sensor's current reading."); static const char * __enable_button_help = -"The Enable GPU Fan Settings checkbox enables access to control GPU Fan " +N_("The Enable GPU Fan Settings checkbox enables access to control GPU Fan " "Speed. This option is available after enabling coolbits for GPU Fan control." "Note that controlling your GPU Fan Speed is not recommended and " -"is done at your own risk. You should never have to enable this."; +"is done at your own risk. You should never have to enable this."); static const char * __fan_id_help = -"This shows the GPU Fan's index."; +N_("This shows the GPU Fan's index."); static const char * __fan_rpm_help = -"This shows the current GPU Fan Speed in rotations per minute (RPM)."; +N_("This shows the current GPU Fan Speed in rotations per minute (RPM)."); static const char * __fan_speed_help = -"This shows the current GPU Fan Speed level as a percentage."; +N_("This shows the current GPU Fan Speed level as a percentage."); static const char * __fan_control_type_help = -"Fan Type indicates if and how this fan may be controlled. Possible " +N_("Fan Type indicates if and how this fan may be controlled. Possible " "types are Variable, Toggle or Restricted. Variable fans can be " "freely adjusted within a given range, while Toggle fans can " "be turned either ON or OFF. Restricted fans are not adjustable " -"under end user control."; +"under end user control."); static const char * __fan_cooling_target_help = -"Fan target shows which graphics device component is being cooled by " +N_("Fan target shows which graphics device component is being cooled by " "a given fan. The target may be GPU, Memory, Power Supply or " -"All."; +"All."); static const char * __apply_button_help = -"The Apply button allows you to set the desired speed for the " +N_("The Apply button allows you to set the desired speed for the " "GPU Fans. Slider positions are only applied " -"after clicking this button."; +"after clicking this button."); static const char * __reset_button_help = -"The Reset Hardware Defaults button lets you restore the original GPU " -"Fan Speed and Fan control policy."; +N_("The Reset Hardware Defaults button lets you restore the original GPU " +"Fan Speed and Fan control policy."); GType ctk_thermal_get_type(void) { @@ -181,47 +182,47 @@ static gboolean update_cooler_info(gpointer user_data) gtk_box_pack_start(GTK_BOX(ctk_thermal->cooler_table_hbox), table, FALSE, FALSE, 0); - label = gtk_label_new("ID"); + label = gtk_label_new(_("ID")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); eventbox = gtk_event_box_new(); gtk_table_attach(GTK_TABLE(table), eventbox, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, __fan_id_help); + ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, _(__fan_id_help)); - label = gtk_label_new("Speed (RPM)"); + label = gtk_label_new(_("Speed (RPM)")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); eventbox = gtk_event_box_new(); gtk_table_attach(GTK_TABLE(table), eventbox, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, __fan_rpm_help); + ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, _(__fan_rpm_help)); - label = gtk_label_new("Speed (%)"); + label = gtk_label_new(_("Speed (%)")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); eventbox = gtk_event_box_new(); gtk_table_attach(GTK_TABLE(table), eventbox, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); gtk_container_add(GTK_CONTAINER(eventbox), label); - ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, __fan_speed_help); + ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, _(__fan_speed_help)); - label = gtk_label_new("Control Type"); + label = gtk_label_new(_("Control Type")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); eventbox = gtk_event_box_new(); gtk_table_attach(GTK_TABLE(table), eventbox, 3, 4, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); gtk_container_add(GTK_CONTAINER(eventbox), label); ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, - __fan_control_type_help); + _(__fan_control_type_help)); - label = gtk_label_new("Cooling Target"); + label = gtk_label_new(_("Cooling Target")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); eventbox = gtk_event_box_new(); gtk_table_attach(GTK_TABLE(table), eventbox, 4, 5, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); gtk_container_add(GTK_CONTAINER(eventbox), label); ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, - __fan_cooling_target_help); + _(__fan_cooling_target_help)); /* Fill the cooler info */ for (i = 0; i < ctk_thermal->cooler_count; i++) { @@ -243,7 +244,7 @@ static gboolean update_cooler_info(gpointer user_data) tmp_str = g_strdup_printf("%d", speed); } else { - tmp_str = g_strdup_printf("Unsupported"); + tmp_str = g_strdup_printf(_("Unsupported")); } label = gtk_label_new(tmp_str); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); @@ -273,11 +274,11 @@ static gboolean update_cooler_info(gpointer user_data) return FALSE; } if (cooler_type == NV_CTRL_THERMAL_COOLER_CONTROL_TYPE_VARIABLE) { - tmp_str = g_strdup_printf("Variable"); + tmp_str = g_strdup_printf(_("Variable")); } else if (cooler_type == NV_CTRL_THERMAL_COOLER_CONTROL_TYPE_TOGGLE) { - tmp_str = g_strdup_printf("Toggle"); + tmp_str = g_strdup_printf(_("Toggle")); } else if (cooler_type == NV_CTRL_THERMAL_COOLER_CONTROL_TYPE_NONE) { - tmp_str = g_strdup_printf("Restricted"); + tmp_str = g_strdup_printf(_("Restricted")); } label = gtk_label_new(tmp_str); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); @@ -294,16 +295,16 @@ static gboolean update_cooler_info(gpointer user_data) } switch(cooler_target) { case NV_CTRL_THERMAL_COOLER_TARGET_GPU: - tmp_str = g_strdup_printf("GPU"); + tmp_str = g_strdup_printf(_("GPU")); break; case NV_CTRL_THERMAL_COOLER_TARGET_MEMORY: - tmp_str = g_strdup_printf("Memory"); + tmp_str = g_strdup_printf(_("Memory")); break; case NV_CTRL_THERMAL_COOLER_TARGET_POWER_SUPPLY: - tmp_str = g_strdup_printf("Power Supply"); + tmp_str = g_strdup_printf(_("Power Supply")); break; case NV_CTRL_THERMAL_COOLER_TARGET_GPU_RELATED: - tmp_str = g_strdup_printf("GPU, Memory, and Power Supply"); + tmp_str = g_strdup_printf(_("GPU, Memory, and Power Supply")); break; default: break; @@ -434,9 +435,8 @@ static void cooler_control_state_update_gui(CtkThermal *ctk_thermal) /* Update the status bar */ - ctk_config_statusbar_message(ctk_thermal->ctk_config, - "GPU Fan control %sabled.", - enabled?"en":"dis"); + ctk_config_statusbar_message(ctk_thermal->ctk_config, + enabled?_("GPU Fan control enabled."):_("GPU Fan control disabled.")); } /* cooler_control_state_update_gui() */ @@ -580,7 +580,7 @@ static void apply_button_clicked(GtkWidget *widget, gpointer user_data) if ( ret != NvCtrlSuccess ) { ctk_config_statusbar_message(ctk_thermal->ctk_config, - "Failed to set new Fan Speed!"); + _("Failed to set new Fan Speed!")); return; } ctk_thermal->cooler_control[i].changed = FALSE; @@ -602,7 +602,7 @@ static void apply_button_clicked(GtkWidget *widget, gpointer user_data) gtk_widget_set_sensitive(ctk_thermal->reset_button, TRUE); ctk_config_statusbar_message(ctk_thermal->ctk_config, - "Set new Fan Speed."); + _("Set new Fan Speed.")); } /* apply_button_clicked() */ @@ -648,10 +648,10 @@ static void reset_button_clicked(GtkWidget *widget, gpointer user_data) if ( reset_failed ) { ctk_config_statusbar_message(ctk_thermal->ctk_config, - "Failed to reset fan speed default value!"); + _("Failed to reset fan speed default value!")); } else { ctk_config_statusbar_message(ctk_thermal->ctk_config, - "Reset to fan speed default value."); + _("Reset to fan speed default value.")); } return; @@ -912,7 +912,7 @@ static GtkWidget *pack_gauge(GtkWidget *hbox, gint lower, gint upper, vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); - frame = gtk_frame_new("Temperature"); + frame = gtk_frame_new(_("Temperature")); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 0); @@ -960,7 +960,7 @@ static void draw_sensor_gui(GtkWidget *vbox1, CtkThermal *ctk_thermal, /* GPU sensor ID */ hbox2 = gtk_hbox_new(FALSE, 0); - s = g_strdup_printf("ID: %d", cur_sensor_idx); + s = g_strdup_printf(_("ID: %d"), cur_sensor_idx); label = gtk_label_new(s); g_free(s); gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0); @@ -977,9 +977,9 @@ static void draw_sensor_gui(GtkWidget *vbox1, CtkThermal *ctk_thermal, /* sensor target type */ if (target) { add_table_row_with_help_text(table, ctk_thermal->ctk_config, - __thermal_sensor_target_help, + _(__thermal_sensor_target_help), 0, 0, 0, 0.5, - "Target:", 0, 0.5, + _("Target:"), 0, 0.5, get_nvctrl_format_name(targetFormatNames, target)); ctk_thermal->sensor_info[cur_sensor_idx].target_type = label; } else { @@ -989,9 +989,9 @@ static void draw_sensor_gui(GtkWidget *vbox1, CtkThermal *ctk_thermal, /* sensor provider type */ if (provider) { add_table_row_with_help_text(table, ctk_thermal->ctk_config, - __thermal_sensor_provider_help, + _(__thermal_sensor_provider_help), 1, 0, 0, 0.5, - "Provider:", 0, 0.5, + _("Provider:"), 0, 0.5, get_nvctrl_format_name(providerFormatNames, provider)); ctk_thermal->sensor_info[cur_sensor_idx].provider_type = label; } else { @@ -1004,7 +1004,7 @@ static void draw_sensor_gui(GtkWidget *vbox1, CtkThermal *ctk_thermal, gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 3, 4, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0); - label = gtk_label_new("Temperature:"); + label = gtk_label_new(_("Temperature:")); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); frame = gtk_frame_new(NULL); @@ -1017,7 +1017,7 @@ static void draw_sensor_gui(GtkWidget *vbox1, CtkThermal *ctk_thermal, gtk_container_add(GTK_CONTAINER(frame), label); ctk_thermal->sensor_info[cur_sensor_idx].temp_label = label; ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox, - __thermal_sensor_reading_help); + _(__thermal_sensor_reading_help)); } else { ctk_thermal->sensor_info[cur_sensor_idx].temp_label = NULL; } @@ -1025,7 +1025,7 @@ static void draw_sensor_gui(GtkWidget *vbox1, CtkThermal *ctk_thermal, /* GPU Core Temperature Gauge */ ctk_thermal->sensor_info[cur_sensor_idx].core_gauge = pack_gauge(hbox, lower, upper, - ctk_thermal->ctk_config, __temp_level_help); + ctk_thermal->ctk_config, _(__temp_level_help)); /* add horizontal bar between sensors */ if (cur_sensor_idx+1 != ctk_thermal->sensor_count) { @@ -1202,7 +1202,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, } hbox1 = gtk_hbox_new(FALSE, FRAME_PADDING); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); - label = gtk_label_new("Thermal Sensor Information"); + label = gtk_label_new(_("Thermal Sensor Information")); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -1268,7 +1268,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, vbox1 = gtk_vbox_new(FALSE, 0); hbox1 = gtk_hbox_new(FALSE, 0); - frame = gtk_frame_new("Slowdown Threshold"); + frame = gtk_frame_new(_("Slowdown Threshold")); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox1), vbox1, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 0); @@ -1277,7 +1277,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, gtk_container_set_border_width(GTK_CONTAINER(hbox2), FRAME_PADDING); gtk_container_add(GTK_CONTAINER(frame), hbox2); - label = gtk_label_new("Degrees: "); + label = gtk_label_new(_("Degrees: ")); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); eventbox = gtk_event_box_new(); @@ -1292,7 +1292,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, s = g_strdup_printf(" %d ", trigger); gtk_entry_set_text(GTK_ENTRY(entry), s); g_free(s); - ctk_config_set_tooltip(ctk_config, eventbox, __core_threshold_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__core_threshold_help)); label = gtk_label_new(" C"); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); @@ -1306,7 +1306,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Core Temperature:"); + label = gtk_label_new(_("Core Temperature:")); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); frame = gtk_frame_new(NULL); @@ -1319,7 +1319,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, gtk_container_add(GTK_CONTAINER(frame), label); ctk_thermal->core_label = label; - ctk_config_set_tooltip(ctk_config, eventbox, __core_temp_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__core_temp_help)); /* Ambient Temperature */ @@ -1331,7 +1331,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Ambient Temperature:"); + label = gtk_label_new(_("Ambient Temperature:")); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); frame = gtk_frame_new(NULL); @@ -1344,7 +1344,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, gtk_container_add(GTK_CONTAINER(frame), label); ctk_thermal->ambient_label = label; - ctk_config_set_tooltip(ctk_config, eventbox, __ambient_temp_help); + ctk_config_set_tooltip(ctk_config, eventbox, _(__ambient_temp_help)); } else { ctk_thermal->ambient_label = NULL; } @@ -1352,7 +1352,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, /* GPU Core Temperature Gauge */ ctk_thermal->core_gauge = pack_gauge(hbox1, 25, upper, - ctk_config, __temp_level_help); + ctk_config, _(__temp_level_help)); } sensor_end: @@ -1369,7 +1369,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, gtk_box_pack_start(GTK_BOX(object), vbox, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Fan Information"); + label = gtk_label_new(_("Fan Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hsep = gtk_hseparator_new(); @@ -1438,7 +1438,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, cooler_range.range.min, cooler_range.range.max, 1, 5, 0.0)); - name = g_strdup_printf("Fan %d Speed", cur_cooler_idx); + name = g_strdup_printf(_("Fan %d Speed"), cur_cooler_idx); scale = ctk_scale_new(GTK_ADJUSTMENT(adjustment), name, ctk_config, G_TYPE_INT); ctk_thermal->cooler_control[cur_cooler_idx].widget = scale; @@ -1451,7 +1451,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, } else if ((ret == NvCtrlSuccess) && (cooler_control_type == NV_CTRL_THERMAL_COOLER_CONTROL_TYPE_TOGGLE)) { - name = g_strdup_printf("Fan-%d Speed", cur_cooler_idx); + name = g_strdup_printf(_("Fan-%d Speed"), cur_cooler_idx); ctk_thermal->cooler_control[cur_cooler_idx].widget = gtk_check_button_new_with_label(name); @@ -1476,7 +1476,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, /* Create the Enable Cooler control checkbox widget */ ctk_thermal->enable_checkbox = - gtk_check_button_new_with_label("Enable GPU Fan Settings"); + gtk_check_button_new_with_label(_("Enable GPU Fan Settings")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ctk_thermal->enable_checkbox), @@ -1487,33 +1487,33 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, (gpointer) ctk_thermal); ctk_config_set_tooltip(ctk_config, ctk_thermal->enable_checkbox, - __enable_button_help); + _(__enable_button_help)); /* Create the Apply button widget */ ctk_thermal->apply_button = - gtk_button_new_with_label("Apply"); + gtk_button_new_with_label(_("Apply")); g_signal_connect(G_OBJECT(ctk_thermal->apply_button), "clicked", G_CALLBACK(apply_button_clicked), (gpointer) ctk_thermal); ctk_config_set_tooltip(ctk_config, ctk_thermal->apply_button, - __apply_button_help); + _(__apply_button_help)); gtk_widget_set_sensitive(ctk_thermal->apply_button, FALSE); /* Create the Reset hardware button widget */ ctk_thermal->reset_button = - gtk_button_new_with_label("Reset Hardware Defaults"); + gtk_button_new_with_label(_("Reset Hardware Defaults")); g_signal_connect(G_OBJECT(ctk_thermal->reset_button), "clicked", G_CALLBACK(reset_button_clicked), (gpointer) ctk_thermal); ctk_config_set_tooltip(ctk_config, ctk_thermal->reset_button, - __reset_button_help); + _(__reset_button_help)); gtk_widget_set_sensitive(ctk_thermal->reset_button, FALSE); @@ -1581,7 +1581,7 @@ GtkWidget* ctk_thermal_new(CtrlTarget *ctrl_target, /* Register a timer callback to update the temperatures */ - s = g_strdup_printf("Thermal Monitor (GPU %d)", + s = g_strdup_printf(_("Thermal Monitor (GPU %d)"), NvCtrlGetTargetId(ctrl_target)); ctk_config_add_timer(ctk_thermal->ctk_config, @@ -1606,7 +1606,7 @@ GtkTextBuffer *ctk_thermal_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "Thermal Settings Help"); + ctk_help_title(b, &i, _("Thermal Settings Help")); /* if sensor not available skip online help */ if (!ctk_thermal->sensor_count) { @@ -1614,33 +1614,33 @@ GtkTextBuffer *ctk_thermal_create_help(GtkTextTagTable *table, } if (!ctk_thermal->thermal_sensor_target_type_supported) { - ctk_help_heading(b, &i, "Slowdown Threshold"); - ctk_help_para(b, &i, "%s", __core_threshold_help); + ctk_help_heading(b, &i, _("Slowdown Threshold")); + ctk_help_para(b, &i, "%s", _(__core_threshold_help)); - ctk_help_heading(b, &i, "Core Temperature"); - ctk_help_para(b, &i, "%s", __core_temp_help); + ctk_help_heading(b, &i, _("Core Temperature")); + ctk_help_para(b, &i, "%s", _(__core_temp_help)); if (ctk_thermal->ambient_label) { - ctk_help_heading(b, &i, "Ambient Temperature"); - ctk_help_para(b, &i, "%s", __ambient_temp_help); + ctk_help_heading(b, &i, _("Ambient Temperature")); + ctk_help_para(b, &i, "%s", _(__ambient_temp_help)); } } else { - ctk_help_title(b, &i, "Thermal Sensor Information Help"); + ctk_help_title(b, &i, _("Thermal Sensor Information Help")); - ctk_help_heading(b, &i, "ID"); - ctk_help_para(b, &i, "%s", __thermal_sensor_id_help); + ctk_help_heading(b, &i, _("ID")); + ctk_help_para(b, &i, "%s", _(__thermal_sensor_id_help)); - ctk_help_heading(b, &i, "Temperature"); - ctk_help_para(b, &i, "%s", __thermal_sensor_reading_help); + ctk_help_heading(b, &i, _("Temperature")); + ctk_help_para(b, &i, "%s", _(__thermal_sensor_reading_help)); - ctk_help_heading(b, &i, "Target"); - ctk_help_para(b, &i, "%s", __thermal_sensor_target_help); + ctk_help_heading(b, &i, _("Target")); + ctk_help_para(b, &i, "%s", _(__thermal_sensor_target_help)); - ctk_help_heading(b, &i, "Provider"); - ctk_help_para(b, &i, "%s", __thermal_sensor_provider_help); + ctk_help_heading(b, &i, _("Provider")); + ctk_help_para(b, &i, "%s", _(__thermal_sensor_provider_help)); } - ctk_help_heading(b, &i, "Level"); - ctk_help_para(b, &i, "%s", __temp_level_help); + ctk_help_heading(b, &i, _("Level")); + ctk_help_para(b, &i, "%s", _(__temp_level_help)); next_help: /* if Fan not available skip online help */ @@ -1648,32 +1648,32 @@ GtkTextBuffer *ctk_thermal_create_help(GtkTextTagTable *table, goto done; } - ctk_help_title(b, &i, "GPU Fan Settings Help"); + ctk_help_title(b, &i, _("GPU Fan Settings Help")); - ctk_help_heading(b, &i, "ID"); - ctk_help_para(b, &i, "%s", __fan_id_help); + ctk_help_heading(b, &i, _("ID")); + ctk_help_para(b, &i, "%s", _(__fan_id_help)); - ctk_help_heading(b, &i, "Speed (RPM)"); - ctk_help_para(b, &i,"%s", __fan_rpm_help); + ctk_help_heading(b, &i, _("Speed (RPM)")); + ctk_help_para(b, &i,"%s", _(__fan_rpm_help)); - ctk_help_heading(b, &i, "Speed (%%)"); - ctk_help_para(b, &i, "%s", __fan_speed_help); + ctk_help_heading(b, &i, _("Speed (%%)")); + ctk_help_para(b, &i, "%s", _(__fan_speed_help)); - ctk_help_heading(b, &i, "Type"); - ctk_help_para(b, &i, "%s", __fan_control_type_help); + ctk_help_heading(b, &i, _("Type")); + ctk_help_para(b, &i, "%s", _(__fan_control_type_help)); - ctk_help_heading(b, &i, "Cooling Target"); - ctk_help_para(b, &i, "%s", __fan_cooling_target_help); + ctk_help_heading(b, &i, _("Cooling Target")); + ctk_help_para(b, &i, "%s", _(__fan_cooling_target_help)); - ctk_help_heading(b, &i, "Enable GPU Fan Settings"); - ctk_help_para(b, &i, "%s", __enable_button_help); + ctk_help_heading(b, &i, _("Enable GPU Fan Settings")); + ctk_help_para(b, &i, "%s", _(__enable_button_help)); if ( ctk_thermal->show_fan_control_frame ) { - ctk_help_heading(b, &i, "Enable GPU Fan Settings"); - ctk_help_para(b, &i, "%s", __apply_button_help); + ctk_help_heading(b, &i, _("Enable GPU Fan Settings")); + ctk_help_para(b, &i, "%s", _(__apply_button_help)); - ctk_help_heading(b, &i, "Enable GPU Fan Settings"); - ctk_help_para(b, &i, "%s", __reset_button_help); + ctk_help_heading(b, &i, _("Enable GPU Fan Settings")); + ctk_help_para(b, &i, "%s", _(__reset_button_help)); } done: ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkui.c b/src/gtk+-2.x/ctkui.c index ce5ef08c..39f11427 100644 --- a/src/gtk+-2.x/ctkui.c +++ b/src/gtk+-2.x/ctkui.c @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include #include "ctkui.h" @@ -27,6 +28,8 @@ * that nvidia-settings.c doesn't need to include gtk+ */ +#define _(STRING) gettext(STRING) + int ctk_init_check(int *argc, char **argv[]) { return gtk_init_check(argc, argv); @@ -64,10 +67,10 @@ void ctk_main(ParsedAttribute *p, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "You do not appear to be using the NVIDIA " + _("You do not appear to be using the NVIDIA " "X driver. Please edit your X configuration " "file (just run `nvidia-xconfig` " - "as root), and restart the X server."); + "as root), and restart the X server.")); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy (dlg); } diff --git a/src/gtk+-2.x/ctkvcs.c b/src/gtk+-2.x/ctkvcs.c index c929675e..9f3543cd 100644 --- a/src/gtk+-2.x/ctkvcs.c +++ b/src/gtk+-2.x/ctkvcs.c @@ -20,6 +20,7 @@ #include /* malloc */ #include /* snprintf */ #include +#include #include #include @@ -32,6 +33,8 @@ #include "ctkhelp.h" #include "ctkutils.h" +#define _(STRING) gettext(STRING) + #define DEFAULT_UPDATE_VCS_INFO_TIME_INTERVAL 5000 #define VCS_PSU_STATE_NORMAL 0 @@ -187,13 +190,13 @@ static gboolean update_vcs_info(gpointer user_data) if (ctk_object->psu_state) { switch (psuEntry.psu_state) { case VCS_PSU_STATE_NORMAL: - g_snprintf(output_str, 16, "Normal"); + g_snprintf(output_str, 16, _("Normal")); break; case VCS_PSU_STATE_ABNORMAL: - g_snprintf(output_str, 16, "Abnormal"); + g_snprintf(output_str, 16, _("Abnormal")); break; default: - g_snprintf(output_str, 16, "Unknown"); + g_snprintf(output_str, 16, _("Unknown")); break; } gtk_label_set_text(GTK_LABEL(ctk_object->psu_state), output_str); @@ -234,7 +237,7 @@ static GtkWidget * create_error_dialog(CtkVcs *ctk_object) /* Display validation override confirmation dialog */ dialog = gtk_dialog_new_with_buttons - ("Cannot Apply", + (_("Cannot Apply"), GTK_WINDOW(gtk_widget_get_parent(GTK_WIDGET(ctk_object))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -262,7 +265,7 @@ static GtkWidget * create_error_dialog(CtkVcs *ctk_object) ctk_object->error_dialog_label = label; /* Action Buttons */ - gtk_dialog_add_button(GTK_DIALOG(dialog), "OK", + gtk_dialog_add_button(GTK_DIALOG(dialog), _("OK"), GTK_RESPONSE_ACCEPT); gtk_widget_show_all(ctk_dialog_get_content_area(GTK_DIALOG(dialog))); @@ -286,8 +289,7 @@ static void vcs_perf_checkbox_toggled(GtkWidget *widget, gpointer user_data) if (ret != NvCtrlSuccess) { if (ctk_object->error_dialog_label) { gchar *str; - str = g_strdup_printf("Failed to %s High Performance mode!", - (enabled ? "enable" : "disable")); + str = g_strdup_printf(enabled ? _("Failed to enable High Performance mode!") : _("Failed to disable High Performance mode!")); gtk_label_set_text(GTK_LABEL(ctk_object->error_dialog_label), str); gtk_window_set_resizable(GTK_WINDOW(ctk_object->error_dialog), FALSE); gtk_window_set_transient_for @@ -347,18 +349,18 @@ static gboolean update_fan_status(CtkVcs *ctk_object) table, FALSE, FALSE, 0); - label = gtk_label_new("Fan Number"); + label = gtk_label_new(_("Fan Number")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_widget_set_size_request(label, ctk_object->req.width, -1); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Fan Speed"); + label = gtk_label_new(_("Fan Speed")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Fan Status"); + label = gtk_label_new(_("Fan Status")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -399,9 +401,9 @@ static gboolean update_fan_status(CtkVcs *ctk_object) if (!current_fan.fan_failed) { - g_snprintf(output_str, 16, "Ok"); + g_snprintf(output_str, 16, _("Ok")); } else { - g_snprintf(output_str, 16, "Failed"); + g_snprintf(output_str, 16, _("Failed")); } label = gtk_label_new(output_str); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); @@ -469,7 +471,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, NV_CTRL_STRING_VCSC_PRODUCT_NAME, &product_name); if (ret != NvCtrlSuccess) { - product_name = g_strdup("Unable to determine"); + product_name = g_strdup(_("Unable to determine")); } /* Serial Number */ @@ -477,7 +479,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, NV_CTRL_STRING_VCSC_SERIAL_NUMBER, &serial_number); if (ret != NvCtrlSuccess) { - serial_number = g_strdup("Unable to determine"); + serial_number = g_strdup(_("Unable to determine")); } /* Build Date */ @@ -485,7 +487,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, NV_CTRL_STRING_VCSC_BUILD_DATE, &build_date); if (ret != NvCtrlSuccess) { - build_date = g_strdup("Unable to determine"); + build_date = g_strdup(_("Unable to determine")); } /* Product ID */ @@ -493,7 +495,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, NV_CTRL_STRING_VCSC_PRODUCT_ID, &product_id); if (ret != NvCtrlSuccess) { - product_id = g_strdup("Unable to determine"); + product_id = g_strdup(_("Unable to determine")); } /* Firmware Version */ @@ -501,7 +503,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, NV_CTRL_STRING_VCSC_FIRMWARE_VERSION, &firmware_version); if (ret != NvCtrlSuccess) { - firmware_version = g_strdup("Unable to determine"); + firmware_version = g_strdup(_("Unable to determine")); } /* Hardware Version */ @@ -509,7 +511,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, NV_CTRL_STRING_VCSC_HARDWARE_VERSION, &hardware_version); if (ret != NvCtrlSuccess) { - hardware_version = g_strdup("Unable to determine"); + hardware_version = g_strdup(_("Unable to determine")); } @@ -547,7 +549,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, &high_perf_mode) == NvCtrlSuccess) { hbox = gtk_hbox_new(FALSE, 0); - checkbutton = gtk_check_button_new_with_label("Enable High Performance Mode"); + checkbutton = gtk_check_button_new_with_label(_("Enable High Performance Mode")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), high_perf_mode); g_signal_connect(G_OBJECT(checkbutton), "toggled", G_CALLBACK(vcs_perf_checkbox_toggled), @@ -574,7 +576,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox_scroll), hbox, FALSE, FALSE, 0); - label = gtk_label_new("VCS Information"); + label = gtk_label_new(_("VCS Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -589,17 +591,17 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, gtk_container_set_border_width(GTK_CONTAINER(table), 5); add_table_row(table, 0, - 0, 0.5, "Product Name:", 0, 0.5, product_name); + 0, 0.5, _("Product Name:"), 0, 0.5, product_name); add_table_row(table, 1, - 0, 0.5, "Serial Number:", 0, 0.5, serial_number); + 0, 0.5, _("Serial Number:"), 0, 0.5, serial_number); add_table_row(table, 2, - 0, 0.5, "Build Date:", 0, 0.5, build_date); + 0, 0.5, _("Build Date:"), 0, 0.5, build_date); add_table_row(table, 3, - 0, 0.5, "Product ID:", 0, 0.5, product_id); + 0, 0.5, _("Product ID:"), 0, 0.5, product_id); add_table_row(table, 4, - 0, 0.5, "Firmware version:", 0, 0.5, firmware_version); + 0, 0.5, _("Firmware version:"), 0, 0.5, firmware_version); add_table_row(table, 5, - 0, 0.5, "Hardware version:", 0, 0.5, hardware_version); + 0, 0.5, _("Hardware version:"), 0, 0.5, hardware_version); g_free(product_name); g_free(serial_number); @@ -625,7 +627,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox_scroll), vbox_padding, FALSE, FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox_scroll), hbox, FALSE, FALSE, 0); - label = gtk_label_new("VCS Thermal Information"); + label = gtk_label_new(_("VCS Thermal Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5); @@ -638,7 +640,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("Intake Temperature:"); + label = gtk_label_new(_("Intake Temperature:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -649,7 +651,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); ctk_object->intake_temp = label; - label = gtk_label_new("Exhaust Temperature:"); + label = gtk_label_new(_("Exhaust Temperature:")); /* This is the current largest label. Get its size */ ctk_widget_get_preferred_size(label, &ctk_object->req); @@ -663,7 +665,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); ctk_object->exhaust_temp = label; - label = gtk_label_new("Board Temperature:"); + label = gtk_label_new(_("Board Temperature:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); @@ -689,7 +691,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox_scroll), vbox_padding, FALSE, FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox_scroll), hbox, FALSE, FALSE, 0); - label = gtk_label_new("VCS Power Supply Unit Information"); + label = gtk_label_new(_("VCS Power Supply Unit Information")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5); @@ -700,7 +702,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("PSU State:"); + label = gtk_label_new(_("PSU State:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_widget_set_size_request(label, ctk_object->req.width, -1); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, @@ -713,7 +715,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); ctk_object->psu_state = label; - label = gtk_label_new("PSU Current:"); + label = gtk_label_new(_("PSU Current:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_widget_set_size_request(label, ctk_object->req.width, -1); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, @@ -729,7 +731,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, current_row = 2; if (psuEntry.psu_power != -1) { - label = gtk_label_new("PSU Power:"); + label = gtk_label_new(_("PSU Power:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_widget_set_size_request(label, ctk_object->req.width, -1); gtk_table_attach(GTK_TABLE(table), label, 0, 1, @@ -746,7 +748,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, } if (psuEntry.psu_voltage != -1) { - label = gtk_label_new("PSU Voltage:"); + label = gtk_label_new(_("PSU Voltage:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_widget_set_size_request(label, ctk_object->req.width, -1); gtk_table_attach(GTK_TABLE(table), label, 0, 1, @@ -767,7 +769,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox_scroll), vbox_padding, FALSE, FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox_scroll), hbox, FALSE, FALSE, 0); - label = gtk_label_new("VCS Fan Status"); + label = gtk_label_new(_("VCS Fan Status")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5); @@ -777,7 +779,7 @@ GtkWidget* ctk_vcs_new(CtrlTarget *ctrl_target, ctk_object->fan_status_container = hbox; /* Register a timer callback to update the dynamic information */ - s = g_strdup_printf("VCS Monitor (VCS %d)", + s = g_strdup_printf(_("VCS Monitor (VCS %d)"), NvCtrlGetTargetId(ctrl_target)); ctk_config_add_timer(ctk_object->ctk_config, @@ -810,27 +812,27 @@ GtkTextBuffer *ctk_vcs_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "VCS (Visual Computing System) Help"); + ctk_help_title(b, &i, _("VCS (Visual Computing System) Help")); - ctk_help_heading(b, &i, "Product Name"); - ctk_help_para(b, &i, "This is the product name of the VCS."); + ctk_help_heading(b, &i, _("Product Name")); + ctk_help_para(b, &i, _("This is the product name of the VCS.")); - ctk_help_heading(b, &i, "Serial Number"); - ctk_help_para(b, &i, "This is the unique serial number of the VCS."); + ctk_help_heading(b, &i, _("Serial Number")); + ctk_help_para(b, &i, _("This is the unique serial number of the VCS.")); - ctk_help_heading(b, &i, "Build Date"); - ctk_help_para(b, &i, "This is the date the VCS was build, " - "shown in a 'week.year' format"); + ctk_help_heading(b, &i, _("Build Date")); + ctk_help_para(b, &i, _("This is the date the VCS was build, " + "shown in a 'week.year' format")); - ctk_help_heading(b, &i, "Product ID"); - ctk_help_para(b, &i, "This identifies the VCS configuration."); + ctk_help_heading(b, &i, _("Product ID")); + ctk_help_para(b, &i, _("This identifies the VCS configuration.")); - ctk_help_heading(b, &i, "Firmware Version"); - ctk_help_para(b, &i, "This is the firmware version currently running on " - "the VCS."); + ctk_help_heading(b, &i, _("Firmware Version")); + ctk_help_para(b, &i, _("This is the firmware version currently running on " + "the VCS.")); - ctk_help_heading(b, &i, "Hardware Version"); - ctk_help_para(b, &i, "This is the hardware version of the VCS."); + ctk_help_heading(b, &i, _("Hardware Version")); + ctk_help_para(b, &i, _("This is the hardware version of the VCS.")); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkvdpau.c b/src/gtk+-2.x/ctkvdpau.c index 58b756dc..d076ff1d 100644 --- a/src/gtk+-2.x/ctkvdpau.c +++ b/src/gtk+-2.x/ctkvdpau.c @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -60,48 +61,51 @@ #include "ctkvdpau.h" #include "ctkbanner.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING + const gchar* __vdpau_information_label_help = -"This page shows information about the Video Decode and Presentation API for " -"Unix-like systems (VDPAU) library."; +N_("This page shows information about the Video Decode and Presentation API for " +"Unix-like systems (VDPAU) library."); const gchar* __base_information_help = -"This tab shows the VDPAU API version and supported codecs."; +N_("This tab shows the VDPAU API version and supported codecs."); const gchar* __vdpau_api_version_help = -"This shows the VDPAU API version."; +N_("This shows the VDPAU API version."); const gchar* __supported_codecs_help = -"This shows the supported codecs."; +N_("This shows the supported codecs."); const gchar* __surface_limits_help = -"This tab shows the maximum supported resolution and formats for video, " -"bitmap and output surfaces."; +N_("This tab shows the maximum supported resolution and formats for video, " +"bitmap and output surfaces."); const gchar* __video_surface_help = -"This shows the maximum supported resolution and formats for video surfaces."; +N_("This shows the maximum supported resolution and formats for video surfaces."); const gchar* __bitmap_surface_help = -"This shows the maximum supported resolution and formats for bitmap surfaces."; +N_("This shows the maximum supported resolution and formats for bitmap surfaces."); const gchar* __ouput_surface_help = -"This shows the maximum supported resolution and formats for output surfaces."; +N_("This shows the maximum supported resolution and formats for output surfaces."); const gchar* __decoder_limits_help = -"This tab shows the maximum level, number of macroblocks and resolution for " -"each supported VDPAU decoder."; +N_("This tab shows the maximum level, number of macroblocks and resolution for " +"each supported VDPAU decoder."); const gchar* __video_mixer_help = -"This tab shows the capabilities of the VDPAU video mixer: the features, " -"parameters, and attributes."; +N_("This tab shows the capabilities of the VDPAU video mixer: the features, " +"parameters, and attributes."); const gchar* __video_mixer_feature_help = -"This shows the features supported by the video mixer."; +N_("This shows the features supported by the video mixer."); const gchar* __video_mixer_parameter_help = -"This shows the video mixer parameters and any applicable ranges."; +N_("This shows the video mixer parameters and any applicable ranges."); const gchar* __video_mixer_attribute_help = -"This shows the video mixer attributes and any applicable ranges."; +N_("This shows the video mixer attributes and any applicable ranges."); static int queryOutputSurface(CtkVDPAU *ctk_vdpau, VdpDevice device, VdpGetProcAddress *getProcAddress); @@ -213,7 +217,7 @@ static int queryBaseInfo(CtkVDPAU *ctk_vdpau, VdpDevice device, ctk_force_text_colors_on_widget(eventbox); gtk_container_add(GTK_CONTAINER(eventbox), vbox); gtk_notebook_append_page(GTK_NOTEBOOK(ctk_vdpau->notebook), eventbox, - gtk_label_new("Base Information")); + gtk_label_new(_("Base Information"))); hbox = gtk_hbox_new(FALSE, 0); table = gtk_table_new(2, 2, FALSE); @@ -222,17 +226,17 @@ static int queryBaseInfo(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_set_row_spacings(GTK_TABLE(table), 3); gtk_table_set_col_spacings(GTK_TABLE(table), 15); add_table_row_with_help_text(table, ctk_vdpau->ctk_config, - __vdpau_api_version_help, + _(__vdpau_api_version_help), 0, 0, - 0, 0, "API version:", + 0, 0, _("API version:"), 0, 0, g_strdup_printf("%i", api)); - label = gtk_label_new("Supported Codecs:"); + label = gtk_label_new(_("Supported Codecs:")); event = gtk_event_box_new(); ctk_force_text_colors_on_widget(event); gtk_container_add(GTK_CONTAINER(event), label); ctk_config_set_tooltip(ctk_vdpau->ctk_config, event, - __supported_codecs_help); + _(__supported_codecs_help)); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), event, 0, 1, 1, 2, @@ -332,14 +336,14 @@ static int queryVideoSurface(CtkVDPAU *ctk_vdpau, VdpDevice device, vbox = gtk_vbox_new(FALSE, 0); hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Video Surface:"); + label = gtk_label_new(_("Video Surface:")); eventbox = gtk_event_box_new(); ctk_force_text_colors_on_widget(eventbox); event = gtk_event_box_new(); ctk_force_text_colors_on_widget(event); gtk_container_add(GTK_CONTAINER(event), label); ctk_config_set_tooltip(ctk_vdpau->ctk_config, event, - __video_surface_help); + _(__video_surface_help)); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), event, FALSE, FALSE, 0); @@ -356,7 +360,7 @@ static int queryVideoSurface(CtkVDPAU *ctk_vdpau, VdpDevice device, /* Add tab to notebook */ gtk_notebook_append_page(GTK_NOTEBOOK(ctk_vdpau->notebook), scrollWin, - gtk_label_new("Surface Limits")); + gtk_label_new(_("Surface Limits"))); ctk_vdpau->surfaceVbox = vbox; @@ -367,25 +371,25 @@ static int queryVideoSurface(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("Name"); + label = gtk_label_new(_("Name")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Width"); + label = gtk_label_new(_("Width")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Height"); + label = gtk_label_new(_("Height")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Types"); + label = gtk_label_new(_("Types")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, @@ -538,7 +542,7 @@ static int queryDecoderCaps(CtkVDPAU *ctk_vdpau, VdpDevice device, /* Add tab to notebook */ gtk_notebook_append_page(GTK_NOTEBOOK(ctk_vdpau->notebook), eventbox, - gtk_label_new("Decoder Limits")); + gtk_label_new(_("Decoder Limits"))); /* Generate a new table */ @@ -548,31 +552,31 @@ static int queryDecoderCaps(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("Name"); + label = gtk_label_new(_("Name")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Level"); + label = gtk_label_new(_("Level")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Macroblocks"); + label = gtk_label_new(_("Macroblocks")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Width"); + label = gtk_label_new(_("Width")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Height"); + label = gtk_label_new(_("Height")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 4, 5, 0, 1, @@ -677,12 +681,12 @@ static int queryOutputSurface(CtkVDPAU *ctk_vdpau, VdpDevice device, vbox = ctk_vdpau->surfaceVbox; hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Output Surface:"); + label = gtk_label_new(_("Output Surface:")); eventbox = gtk_event_box_new(); ctk_force_text_colors_on_widget(eventbox); gtk_container_add(GTK_CONTAINER(eventbox), label); ctk_config_set_tooltip(ctk_vdpau->ctk_config, eventbox, - __ouput_surface_help); + _(__ouput_surface_help)); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, FALSE, 0); @@ -695,31 +699,31 @@ static int queryOutputSurface(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("Name"); + label = gtk_label_new(_("Name")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Width"); + label = gtk_label_new(_("Width")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Height"); + label = gtk_label_new(_("Height")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Native"); + label = gtk_label_new(_("Native")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Types"); + label = gtk_label_new(_("Types")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 4, 5, 0, 1, @@ -828,12 +832,12 @@ static int queryBitmapSurface(CtkVDPAU *ctk_vdpau, VdpDevice device, vbox = ctk_vdpau->surfaceVbox; hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("Bitmap Surface:"); + label = gtk_label_new(_("Bitmap Surface:")); eventbox = gtk_event_box_new(); ctk_force_text_colors_on_widget(eventbox); gtk_container_add(GTK_CONTAINER(eventbox), label); ctk_config_set_tooltip(ctk_vdpau->ctk_config, eventbox, - __bitmap_surface_help); + _(__bitmap_surface_help)); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, FALSE, 0); @@ -846,19 +850,19 @@ static int queryBitmapSurface(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("Name"); + label = gtk_label_new(_("Name")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Width"); + label = gtk_label_new(_("Width")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Height"); + label = gtk_label_new(_("Height")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, @@ -1058,12 +1062,12 @@ static int queryVideoMixer(CtkVDPAU *ctk_vdpau, VdpDevice device, /* Add Video mixer information */ vbox = gtk_vbox_new(FALSE, 0); - label = gtk_label_new("Video Mixer:"); + label = gtk_label_new(_("Video Mixer:")); eventbox = gtk_event_box_new(); ctk_force_text_colors_on_widget(eventbox); gtk_container_add(GTK_CONTAINER(eventbox), label); ctk_config_set_tooltip(ctk_vdpau->ctk_config, eventbox, - __video_mixer_help); + _(__video_mixer_help)); scrollWin = gtk_scrolled_window_new(NULL, NULL); hbox = gtk_hbox_new(FALSE, 0); @@ -1080,7 +1084,7 @@ static int queryVideoMixer(CtkVDPAU *ctk_vdpau, VdpDevice device, /* Add tab to notebook */ gtk_notebook_append_page(GTK_NOTEBOOK(ctk_vdpau->notebook), scrollWin, - gtk_label_new("Video Mixer")); + gtk_label_new(_("Video Mixer"))); /* Generate a new table */ @@ -1090,7 +1094,7 @@ static int queryVideoMixer(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("Feature Name"); + label = gtk_label_new(_("Feature Name")); eventbox = gtk_event_box_new(); ctk_force_text_colors_on_widget(eventbox); gtk_container_add(GTK_CONTAINER(eventbox), label); @@ -1099,15 +1103,15 @@ static int queryVideoMixer(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_attach(GTK_TABLE(table), eventbox, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); ctk_config_set_tooltip(ctk_vdpau->ctk_config, eventbox, - __video_mixer_feature_help); + _(__video_mixer_feature_help)); - label = gtk_label_new("Supported"); + label = gtk_label_new(_("Supported")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); ctk_config_set_tooltip(ctk_vdpau->ctk_config, eventbox, - __video_mixer_attribute_help); + _(__video_mixer_attribute_help)); /* separator between heading and data */ @@ -1165,7 +1169,7 @@ static int queryVideoMixer(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("Parameter Name"); + label = gtk_label_new(_("Parameter Name")); eventbox = gtk_event_box_new(); ctk_force_text_colors_on_widget(eventbox); gtk_container_add(GTK_CONTAINER(eventbox), label); @@ -1173,21 +1177,21 @@ static int queryVideoMixer(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_attach(GTK_TABLE(table), eventbox, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); ctk_config_set_tooltip(ctk_vdpau->ctk_config, eventbox, - __video_mixer_parameter_help); + _(__video_mixer_parameter_help)); - label = gtk_label_new("Supported"); + label = gtk_label_new(_("Supported")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Min"); + label = gtk_label_new(_("Min")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Max"); + label = gtk_label_new(_("Max")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, @@ -1256,7 +1260,7 @@ static int queryVideoMixer(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_set_col_spacings(GTK_TABLE(table), 15); gtk_container_set_border_width(GTK_CONTAINER(table), 5); - label = gtk_label_new("Attribute Name"); + label = gtk_label_new(_("Attribute Name")); eventbox = gtk_event_box_new(); ctk_force_text_colors_on_widget(eventbox); gtk_container_add(GTK_CONTAINER(eventbox), label); @@ -1265,21 +1269,21 @@ static int queryVideoMixer(CtkVDPAU *ctk_vdpau, VdpDevice device, gtk_table_attach(GTK_TABLE(table), eventbox, 0, 1, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); ctk_config_set_tooltip(ctk_vdpau->ctk_config, eventbox, - __video_mixer_attribute_help); + _(__video_mixer_attribute_help)); - label = gtk_label_new("Supported"); + label = gtk_label_new(_("Supported")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Min"); + label = gtk_label_new(_("Min")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); - label = gtk_label_new("Max"); + label = gtk_label_new(_("Max")); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, @@ -1513,44 +1517,44 @@ GtkTextBuffer *ctk_vdpau_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "VDPAU Information Help"); - ctk_help_para(b, &i, "%s", __vdpau_information_label_help); + ctk_help_title(b, &i, _("VDPAU Information Help")); + ctk_help_para(b, &i, "%s", _(__vdpau_information_label_help)); - ctk_help_heading(b, &i, "Base Information"); - ctk_help_para(b, &i, "%s", __base_information_help); + ctk_help_heading(b, &i, _("Base Information")); + ctk_help_para(b, &i, "%s", _(__base_information_help)); - ctk_help_heading(b, &i, "API Version"); - ctk_help_para(b, &i, "%s", __vdpau_api_version_help); + ctk_help_heading(b, &i, _("API Version")); + ctk_help_para(b, &i, "%s", _(__vdpau_api_version_help)); - ctk_help_heading(b, &i, "Supported Codecs"); - ctk_help_para(b, &i, "%s", __supported_codecs_help); + ctk_help_heading(b, &i, _("Supported Codecs")); + ctk_help_para(b, &i, "%s", _(__supported_codecs_help)); - ctk_help_heading(b, &i, "Surface Limits"); - ctk_help_para(b, &i, "%s", __surface_limits_help); + ctk_help_heading(b, &i, _("Surface Limits")); + ctk_help_para(b, &i, "%s", _(__surface_limits_help)); - ctk_help_heading(b, &i, "Video Surface"); - ctk_help_para(b, &i, "%s", __video_surface_help); + ctk_help_heading(b, &i, _("Video Surface")); + ctk_help_para(b, &i, "%s", _(__video_surface_help)); - ctk_help_heading(b, &i, "Output Surface"); - ctk_help_para(b, &i, "%s", __ouput_surface_help); + ctk_help_heading(b, &i, _("Output Surface")); + ctk_help_para(b, &i, "%s", _(__ouput_surface_help)); - ctk_help_heading(b, &i, "Bitmap Surface"); - ctk_help_para(b, &i, "%s", __bitmap_surface_help); + ctk_help_heading(b, &i, _("Bitmap Surface")); + ctk_help_para(b, &i, "%s", _(__bitmap_surface_help)); - ctk_help_heading(b, &i, "Decoder Limits"); - ctk_help_para(b, &i, "%s", __decoder_limits_help); + ctk_help_heading(b, &i, _("Decoder Limits")); + ctk_help_para(b, &i, "%s", _(__decoder_limits_help)); - ctk_help_heading(b, &i, "Video Mixer"); - ctk_help_para(b, &i, "%s", __video_mixer_help); + ctk_help_heading(b, &i, _("Video Mixer")); + ctk_help_para(b, &i, "%s", _(__video_mixer_help)); - ctk_help_term(b, &i, "Feature"); - ctk_help_para(b, &i, "%s", __video_mixer_feature_help); + ctk_help_term(b, &i, _("Feature")); + ctk_help_para(b, &i, "%s", _(__video_mixer_feature_help)); - ctk_help_term(b, &i, "Parameter"); - ctk_help_para(b, &i, "%s", __video_mixer_parameter_help); + ctk_help_term(b, &i, _("Parameter")); + ctk_help_para(b, &i, "%s", _(__video_mixer_parameter_help)); - ctk_help_term(b, &i, "Attribute"); - ctk_help_para(b, &i, "%s", __video_mixer_attribute_help); + ctk_help_term(b, &i, _("Attribute")); + ctk_help_para(b, &i, "%s", _(__video_mixer_attribute_help)); ctk_help_finish(b); return b; diff --git a/src/gtk+-2.x/ctkwindow.c b/src/gtk+-2.x/ctkwindow.c index d7fdaa70..6715fd67 100644 --- a/src/gtk+-2.x/ctkwindow.c +++ b/src/gtk+-2.x/ctkwindow.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "ctkwindow.h" @@ -75,6 +76,8 @@ #include "opengl_loading.h" +#define _(STRING) gettext(STRING) + /* column enumeration */ enum { @@ -484,9 +487,9 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, gtk_box_pack_start(GTK_BOX(hbox), eventbox, TRUE, TRUE, 0); - ctk_config_set_tooltip(ctk_config, eventbox, "The status bar displays " + ctk_config_set_tooltip(ctk_config, eventbox, _("The status bar displays " "the most recent change that has been sent to the " - "X server."); + "X server.")); /* create and place the help toggle button */ @@ -508,10 +511,10 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, tag_table = ctk_help_create_tag_table(); ctk_window->help_tag_table = tag_table; - ctk_config_set_tooltip(ctk_config, toggle_button, "The Help button " + ctk_config_set_tooltip(ctk_config, toggle_button, _("The Help button " "toggles the display of a help window which " "provides a detailed explanation of the available " - "options in the current page."); + "options in the current page.")); /* create and place the close button */ @@ -524,10 +527,10 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - ctk_config_set_tooltip(ctk_config, button, "The Quit button causes the " + ctk_config_set_tooltip(ctk_config, button, _("The Quit button causes the " "current settings to be saved to the configuration " "file (~/.nvidia-settings-rc), and nvidia-settings " - "to exit."); + "to exit.")); /* create the horizontal pane */ @@ -620,7 +623,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, add_page(child, ctk_server_create_help(tag_table, CTK_SERVER(child)), - ctk_window, NULL, NULL, "X Server Information", + ctk_window, NULL, NULL, _("X Server Information"), NULL, NULL, NULL); /* X Server Display Configuration */ @@ -632,7 +635,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, ctk_display_config_create_help(tag_table, CTK_DISPLAY_CONFIG(child)), ctk_window, NULL, NULL, - "X Server Display Configuration", + _("X Server Display Configuration"), NULL, ctk_display_config_selected, ctk_display_config_unselected); } @@ -657,7 +660,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, ctk_event = CTK_EVENT(ctk_event_new(screen_target)); - screen_name = g_strdup_printf("X Screen %d", + screen_name = g_strdup_printf(_("X Screen %d"), NvCtrlGetTargetId(screen_target)); /* create the screen entry */ @@ -689,9 +692,9 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, child = ctk_slimm_new(screen_target, ctk_event, ctk_config); if (child) { slimm_page_added = TRUE; - help = ctk_slimm_create_help(tag_table, "SLI Mosaic Mode Settings"); + help = ctk_slimm_create_help(tag_table, _("SLI Mosaic Mode Settings")); add_page(child, help, ctk_window, &iter, NULL, - "SLI Mosaic Mode Settings", NULL, NULL, NULL); + _("SLI Mosaic Mode Settings"), NULL, NULL, NULL); } } @@ -708,7 +711,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, if (child) { help = ctk_color_correction_page_create_help(tag_table); add_page(child, help, ctk_window, &iter, NULL, - "X Server Color Correction", NULL, NULL, NULL); + _("X Server Color Correction"), NULL, NULL, NULL); } } @@ -718,7 +721,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, if (child) { help = ctk_xvideo_create_help(tag_table, CTK_XVIDEO(child)); add_page(child, help, ctk_window, &iter, NULL, - "X Server XVideo Settings", NULL, NULL, NULL); + _("X Server XVideo Settings"), NULL, NULL, NULL); } /* opengl settings */ @@ -726,7 +729,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, child = ctk_opengl_new(screen_target, ctk_config, ctk_event); if (child) { help = ctk_opengl_create_help(tag_table, CTK_OPENGL(child)); - add_page(child, help, ctk_window, &iter, NULL, "OpenGL Settings", + add_page(child, help, ctk_window, &iter, NULL, _("OpenGL Settings"), NULL, NULL, NULL); } @@ -737,7 +740,8 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, if (child) { help = ctk_glx_create_help(tag_table, CTK_GLX(child)); add_page(child, help, ctk_window, &iter, NULL, - "Graphics Information", NULL, ctk_glx_probe_info, NULL); + _("Graphics Information"), NULL, ctk_glx_probe_info, NULL); + } @@ -748,7 +752,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, help = ctk_multisample_create_help(tag_table, CTK_MULTISAMPLE(child)); add_page(child, help, ctk_window, &iter, NULL, - "Antialiasing Settings", NULL, NULL, NULL); + _("Antialiasing Settings"), NULL, NULL, NULL); } @@ -756,7 +760,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, child = ctk_vdpau_new(screen_target, ctk_config, ctk_event); if (child) { help = ctk_vdpau_create_help(tag_table, CTK_VDPAU(child)); - add_page(child, help, ctk_window, &iter, NULL, "VDPAU Information", + add_page(child, help, ctk_window, &iter, NULL, _("VDPAU Information"), NULL, NULL, NULL); } @@ -768,7 +772,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, GtkTreeIter child_iter; help = ctk_gvo_create_help(tag_table); add_page(child, help, ctk_window, &iter, &child_iter, - "Graphics to Video Out", NULL, + _("Graphics to Video Out"), NULL, ctk_gvo_select, ctk_gvo_unselect); /* GVO Sync options */ @@ -780,7 +784,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, help = ctk_gvo_sync_create_help(tag_table, CTK_GVO_SYNC(child)); add_page(child, help, ctk_window, &child_iter, NULL, - "Synchronization Options", NULL, + _("Synchronization Options"), NULL, ctk_gvo_sync_select, ctk_gvo_sync_unselect); } @@ -791,7 +795,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, if (child) { help = ctk_gvo_csc_create_help(tag_table, CTK_GVO_CSC(child)); add_page(child, help, ctk_window, &child_iter, NULL, - "Color Space Conversion", NULL, + _("Color Space Conversion"), NULL, ctk_gvo_csc_select, ctk_gvo_csc_unselect); } } @@ -849,7 +853,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, child = ctk_thermal_new(gpu_target, ctk_config, ctk_event); if (child) { help = ctk_thermal_create_help(tag_table, CTK_THERMAL(child)); - add_page(child, help, ctk_window, &iter, NULL, "Thermal Settings", + add_page(child, help, ctk_window, &iter, NULL, _("Thermal Settings"), NULL, ctk_thermal_start_timer, ctk_thermal_stop_timer); } @@ -857,7 +861,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, child = ctk_powermizer_new(gpu_target, ctk_config, ctk_event); if (child) { help = ctk_powermizer_create_help(tag_table, CTK_POWERMIZER(child)); - add_page(child, help, ctk_window, &iter, NULL, "PowerMizer", + add_page(child, help, ctk_window, &iter, NULL, _("PowerMizer"), NULL, ctk_powermizer_start_timer, ctk_powermizer_stop_timer); } @@ -866,7 +870,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, child = ctk_ecc_new(gpu_target, ctk_config, ctk_event); if (child) { help = ctk_ecc_create_help(tag_table, CTK_ECC(child)); - add_page(child, help, ctk_window, &iter, NULL, "ECC Settings", + add_page(child, help, ctk_window, &iter, NULL, _("ECC Settings"), NULL, ctk_ecc_start_timer, ctk_ecc_stop_timer); } @@ -911,12 +915,12 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, NV_CTRL_STRING_VCSC_PRODUCT_NAME, &vcs_product_name); if (ret == NvCtrlSuccess && vcs_product_name) { - vcs_name = g_strdup_printf("VCS %d - (%s)", + vcs_name = g_strdup_printf(_("VCS %d - (%s)"), NvCtrlGetTargetId(vcs_target), vcs_product_name); free(vcs_product_name); } else { - vcs_name = g_strdup_printf("VCS %d - (Unknown)", + vcs_name = g_strdup_printf(_("VCS %d - (Unknown)"), NvCtrlGetTargetId(vcs_target)); } if (!vcs_name) continue; @@ -964,10 +968,10 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, /* create the gvi entry name */ if (node->next) { - gvi_name = g_strdup_printf("Graphics to Video In %d", + gvi_name = g_strdup_printf(_("Graphics to Video In %d"), NvCtrlGetTargetId(gvi_target)); } else { - gvi_name = g_strdup_printf("Graphics to Video In"); + gvi_name = g_strdup_printf(_("Graphics to Video In")); } if (!gvi_name) continue; @@ -1017,7 +1021,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, if (!widget) continue; add_page(widget, ctk_framelock_create_help(tag_table), - ctk_window, NULL, NULL, "Frame Lock", + ctk_window, NULL, NULL, _("Frame Lock"), ctk_framelock_config_file_attributes, ctk_framelock_select, ctk_framelock_unselect); @@ -1046,7 +1050,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, help = ctk_3d_vision_pro_create_help(tag_table); add_page(widget, help, ctk_window, NULL, NULL, - "NVIDIA 3D VisionPro", ctk_3d_vision_pro_config_file_attributes, + _("NVIDIA 3D VisionPro"), ctk_3d_vision_pro_config_file_attributes, ctk_3d_vision_pro_select, ctk_3d_vision_pro_unselect); } @@ -1054,7 +1058,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, widget = ctk_app_profile_new(server_target, ctk_config); if (widget) { add_page(widget, ctk_app_profile_create_help(CTK_APP_PROFILE(widget), tag_table), - ctk_window, NULL, NULL, "Application Profiles", + ctk_window, NULL, NULL, _("Application Profiles"), NULL, NULL, NULL); } @@ -1064,7 +1068,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, if (widget) { help = ctk_manage_grid_license_create_help(tag_table, CTK_MANAGE_GRID_LICENSE(widget)); - add_page(widget, help, ctk_window, NULL, NULL, "Manage License", + add_page(widget, help, ctk_window, NULL, NULL, _("Manage License"), NULL, ctk_manage_grid_license_start_timer, ctk_manage_grid_license_stop_timer); break; /* only add the page once */ @@ -1075,7 +1079,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, add_page(GTK_WIDGET(ctk_window->ctk_config), ctk_config_create_help(ctk_config, tag_table), - ctk_window, NULL, NULL, "nvidia-settings Configuration", + ctk_window, NULL, NULL, _("nvidia-settings Configuration"), NULL, NULL, NULL); /* @@ -1106,7 +1110,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, /* set the window title */ - gtk_window_set_title(GTK_WINDOW(object), "NVIDIA X Server Settings"); + gtk_window_set_title(GTK_WINDOW(object), _("NVIDIA X Server Settings")); gtk_widget_show_all(GTK_WIDGET(object)); @@ -1117,7 +1121,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, * window's initial width to not extent past this. */ - label = gtk_label_new("XXXXXX Server Display ConfigurationXXXX"); + label = gtk_label_new(_("XXXXXX Server Display ConfigurationXXXX")); gtk_widget_show(label); ctk_widget_get_preferred_size(label, &req); width = req.width; @@ -1293,7 +1297,7 @@ static GtkWidget *create_quit_dialog(CtkWindow *ctk_window) GtkWidget *alignment; GtkWidget *label; - dialog = gtk_dialog_new_with_buttons("Really quit?", + dialog = gtk_dialog_new_with_buttons(_("Really quit?"), GTK_WINDOW(ctk_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -1323,7 +1327,7 @@ static GtkWidget *create_quit_dialog(CtkWindow *ctk_window) gtk_container_add(GTK_CONTAINER(alignment), image); gtk_box_pack_start(GTK_BOX(hbox), alignment, FALSE, FALSE, 2); - label = gtk_label_new("Do you really want to quit?"); + label = gtk_label_new(_("Do you really want to quit?")); alignment = gtk_alignment_new(0.0, 0.0, 0, 0); gtk_container_add(GTK_CONTAINER(alignment), label); gtk_box_pack_start(GTK_BOX(hbox), alignment, FALSE, FALSE, 0); @@ -1527,7 +1531,7 @@ static void add_display_devices(CtkWindow *ctk_window, GtkTreeIter *iter, } if (!logName && !randrName) { - title = g_strdup_printf("DPY-%d - (Unknown)", display_id); + title = g_strdup_printf(_("DPY-%d - (Unknown)"), display_id); } else { title = g_strdup_printf("%s - (%s)", randrName, logName); } diff --git a/src/gtk+-2.x/ctkxvideo.c b/src/gtk+-2.x/ctkxvideo.c index 68ea0c35..3d39e8d6 100644 --- a/src/gtk+-2.x/ctkxvideo.c +++ b/src/gtk+-2.x/ctkxvideo.c @@ -19,6 +19,7 @@ #include #include +#include #include #include "NvCtrlAttributes.h" #include "NVCtrlLib.h" @@ -30,10 +31,12 @@ #include "ctkutils.h" #include "ctkhelp.h" +#define _(STRING) gettext(STRING) +#define N_(STRING) STRING static const char *__xv_sync_to_display_help = -"This controls which display device will be synched to when " -"XVideo Sync To VBlank is enabled."; +N_("This controls which display device will be synched to when " +"XVideo Sync To VBlank is enabled."); #define FRAME_PADDING 5 @@ -81,7 +84,7 @@ static void post_xv_sync_to_display_update(CtkXVideo *ctk_xvideo, label = gtk_button_get_label(GTK_BUTTON(active_button)); ctk_config_statusbar_message(ctk_xvideo->ctk_config, - "XVideo application syncing to %s.", + _("XVideo application syncing to %s."), label); } @@ -182,7 +185,7 @@ static gchar *xv_sync_to_display_radio_button_label(CtkXVideo *ctk_xvideo, label = g_strdup_printf("%s (%s)", name, randr); } else { label = g_strdup_printf("%s", - name ? name : (randr ? randr : "Unknown")); + name ? name : (randr ? randr : _("Unknown"))); } free(name); @@ -204,7 +207,7 @@ static GtkWidget *xv_sync_to_display_radio_button_add(CtkXVideo *ctk_xvideo, GSList *slist; if (display_id == NV_CTRL_XV_SYNC_TO_DISPLAY_ID_AUTO) { - label = g_strdup("Auto"); + label = g_strdup(_("Auto")); } else { label = xv_sync_to_display_radio_button_label(ctk_xvideo, display_id); } @@ -507,7 +510,7 @@ GtkWidget* ctk_xvideo_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Xvideo Settings"); + label = gtk_label_new(_("Xvideo Settings")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); @@ -522,7 +525,7 @@ GtkWidget* ctk_xvideo_new(CtrlTarget *ctrl_target, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 5); - label = gtk_label_new("Currently synced to display:"); + label = gtk_label_new(_("Currently synced to display:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); label = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); @@ -539,7 +542,7 @@ GtkWidget* ctk_xvideo_new(CtrlTarget *ctrl_target, /* Sync to display selection */ - frame = gtk_frame_new("Sync to this display device"); + frame = gtk_frame_new(_("Sync to this display device")); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 5); @@ -549,7 +552,7 @@ GtkWidget* ctk_xvideo_new(CtrlTarget *ctrl_target, ctk_config_set_tooltip(ctk_xvideo->ctk_config, ctk_xvideo->xv_sync_to_display_button_box, - __xv_sync_to_display_help); + _(__xv_sync_to_display_help)); xv_sync_to_display_rebuild_buttons(ctk_xvideo, FALSE); @@ -593,14 +596,14 @@ GtkTextBuffer *ctk_xvideo_create_help(GtkTextTagTable *table, gtk_text_buffer_get_iter_at_offset(b, &i, 0); - ctk_help_title(b, &i, "X Server XVideo Settings Help"); + ctk_help_title(b, &i, _("X Server XVideo Settings Help")); - ctk_help_para(b, &i, "The X Server XVideo Settings page uses the XVideo " - "X extension."); + ctk_help_para(b, &i, _("The X Server XVideo Settings page uses the XVideo " + "X extension.")); if (ctk_xvideo->active_attributes & __XV_SYNC_TO_DISPLAY) { - ctk_help_heading(b, &i, "Sync to this display device"); - ctk_help_para(b, &i, "%s", __xv_sync_to_display_help); + ctk_help_heading(b, &i, _("Sync to this display device")); + ctk_help_para(b, &i, "%s", _(__xv_sync_to_display_help)); } ctk_help_finish(b); diff --git a/src/nvidia-settings.c b/src/nvidia-settings.c index 417fc365..64e73de1 100644 --- a/src/nvidia-settings.c +++ b/src/nvidia-settings.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include static const char* library_names[] = { "libnvidia-gtk3.so." NVIDIA_VERSION, @@ -220,6 +222,12 @@ static void *load_ui_library(GtkLibraryData *libdata, Options *op) int main(int argc, char **argv) { + + setlocale (LC_CTYPE, ""); + setlocale (LC_MESSAGES, ""); + bindtextdomain(PROGRAM_NAME, LOCALEDIR); + textdomain(PROGRAM_NAME); + ConfigProperties conf; ParsedAttribute *p; CtrlSystem *system; diff --git a/utils.mk b/utils.mk index 8218e0c3..76fbb853 100644 --- a/utils.mk +++ b/utils.mk @@ -65,6 +65,7 @@ INSTALL ?= install INSTALL_BIN_ARGS ?= -m 755 INSTALL_LIB_ARGS ?= -m 644 INSTALL_DOC_ARGS ?= -m 644 +INSTALL_PO_ARGS ?= -m 644 M4 ?= m4 SED ?= sed @@ -79,6 +80,10 @@ DATE ?= date GZIP_CMD ?= gzip CHMOD ?= chmod OBJCOPY ?= objcopy +MSGFMT ?= msgfmt +MSGMERGE ?= msgmerge +XGETTEXT ?= xgettext +FIND ?= find NV_AUTO_DEPEND ?= 1 NV_VERBOSE ?= 0 @@ -185,6 +190,7 @@ PREFIX ?= /usr/local BINDIR = $(DESTDIR)$(PREFIX)/bin LIBDIR = $(DESTDIR)$(PREFIX)/lib MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1 +LCDIR = $(DESTDIR)$(PREFIX)/share/locale ##############################################################################