Репозитории ALT
Группа :: Мониторинг
Пакет: gkrellm-timers
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: gkrellm_timers-1.2-alt-i18n.patch
Скачать
Скачать
diff -Naur gkrellm_timers-1.2/gkrellm_timers.c gkrellm_timers-1.2.new/gkrellm_timers.c
--- gkrellm_timers-1.2/gkrellm_timers.c 2003-02-07 19:29:54 +0200
+++ gkrellm_timers-1.2.new/gkrellm_timers.c 2003-03-30 13:57:58 +0300
@@ -57,12 +57,12 @@
#define CONFIG_NAME "Timers" /* Name in the configuration window */
#define STYLE_NAME "timers" /* Theme subdirectory name and gkrellmrc */
/* style name. */
-#define YES "yes"
-#define NO "no"
-#define STOPWATCH "Stopwatch"
-#define NOT_STOPWATCH "Timer"
-#define ACTIVE "Running"
-#define NOT_ACTIVE "Stopped"
+#define YES _("yes")
+#define NO _("no")
+#define STOPWATCH _("Stopwatch")
+#define NOT_STOPWATCH _("Timer")
+#define ACTIVE _("Running")
+#define NOT_ACTIVE _("Stopped")
/* the whole formating stuff is from clock.c */
typedef struct
@@ -181,11 +181,11 @@
strftime(timebuf, sizeof(timebuf), "%k:%M:%S", t);
- text = g_strdup_printf("The %s %s set to %s just went off!",
+ text = g_strdup_printf(_("The %s %s set to %s just went off!"),
timer->stopwatch ? STOPWATCH : NOT_STOPWATCH,
timer->label, timebuf);
- gkrellm_message_window("Alarm!", text,
+ gkrellm_message_window(_("Alarm!"), text,
timer->panel->drawing_area);
g_free(text);
}
@@ -241,7 +241,7 @@
strftime(timebuf, sizeof(timebuf), "%k:%M:%S", t);
- text = g_strdup_printf("%s: %s %s is set to %s",
+ text = g_strdup_printf(_("%s: %s %s is set to %s"),
timer->active ? ACTIVE : NOT_ACTIVE,
timer->stopwatch ? STOPWATCH : NOT_STOPWATCH,
timer->label, timebuf);
@@ -880,47 +880,9 @@
}
-static gchar *plugin_info_text =
-"This configuration tab is for the Timer/Stopwatch plugin.\n"
-"\n"
-"Adding new timers (count-down) or stopwatches (count-up) should be fairly easy.\n"
-"A descriptive label is optional. It will only show up in the tooltip.\n"
-"\n"
-"Timer:\n"
-" The timer will count down from the given value until zero is reached.\n"
-"\n"
-"Stopwatch:\n"
-" The Stopwatch will count up starting at zero until the given value is reached.\n"
-"\n"
-"Restart:\n"
-" If set the timer will start counting down from the set value once it hits zero.\n"
-"\n"
-"Popup:\n"
-" Display a message window once the timer hits zero.\n"
-"\n"
-"You can use the following mouse clicks as shortcuts:\n"
-"Left button:\n"
-" Start/Stop timer;\n"
-"Middle button:\n"
-" Reset timer;\n"
-"Right button:\n"
-" Open the configuration dialog.\n"
-"\n"
-"Please drop me a mail if you encounter problems or have questions.\n"
-;
-
-static gchar *plugin_about_text =
- "Timer plugin 1.2\n"
- "GKrellM Timer Plugin\n\n"
- "Copyright (C) 2003 Christian W. Zuckschwerdt\n"
- "zany@triq.net\n\n"
- "http://triq.net/gkrellm.html\n\n"
- "Released under the GNU Public Licence"
-;
-
static gchar *timer_title[CLIST_WIDTH] =
-{ "ID", "Label", "Hours", "Minutes", "Seconds",
- "Up/Down", "Restart", "Popup", "Command" };
+{ N_("ID"), N_("Label"), N_("Hours"), N_("Minutes"), N_("Seconds"),
+ N_("Up/Down"), N_("Restart"), N_("Popup"), N_("Command") };
static void
create_plugin_tab(GtkWidget *tab_vbox)
@@ -950,12 +912,12 @@
/* --- Setup tab */
// vbox = gkrellm_create_tab(tabs, "Setup");
- vbox = gkrellm_gtk_framed_notebook_page(tabs, "Setup");
+ vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Setup"));
hbox = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(vbox), hbox);
- frame = gtk_frame_new ("Label");
+ frame = gtk_frame_new (_("Label"));
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 2);
gtk_widget_show (frame);
@@ -964,7 +926,7 @@
gtk_container_add(GTK_CONTAINER(frame), label_entry);
- frame = gtk_frame_new ("Time");
+ frame = gtk_frame_new (_("Time"));
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 2);
gtk_widget_show (frame);
@@ -989,26 +951,26 @@
hbox = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(vbox), hbox);
- frame = gtk_frame_new ("Options");
+ frame = gtk_frame_new (_("Options"));
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 2);
gtk_widget_show (frame);
hbox2 = gtk_hbox_new(FALSE, 3);
gtk_container_add(GTK_CONTAINER(frame), hbox2);
- timer_radio = gtk_radio_button_new_with_label(NULL, "Timer");
+ timer_radio = gtk_radio_button_new_with_label(NULL, _("Timer"));
stopwatch_radio = gtk_radio_button_new_with_label_from_widget(
- GTK_RADIO_BUTTON(timer_radio), "Stopwatch");
+ GTK_RADIO_BUTTON(timer_radio), _("Stopwatch"));
gtk_box_pack_start(GTK_BOX(hbox2), timer_radio, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox2), stopwatch_radio, FALSE, FALSE, 0);
- restart_toggle = gtk_check_button_new_with_label("Restart (Continuous)");
+ restart_toggle = gtk_check_button_new_with_label(_("Restart (Continuous)"));
gtk_box_pack_start(GTK_BOX(hbox2), restart_toggle, FALSE, FALSE, 0);
- popup_toggle = gtk_check_button_new_with_label("Popup");
+ popup_toggle = gtk_check_button_new_with_label(_("Popup"));
gtk_box_pack_start(GTK_BOX(hbox2), popup_toggle, FALSE, FALSE, 0);
- frame = gtk_frame_new ("Alarm command");
+ frame = gtk_frame_new (_("Alarm command"));
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 2);
gtk_widget_show (frame);
@@ -1020,15 +982,15 @@
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
- start_button = gtk_button_new_with_label("Start");
+ start_button = gtk_button_new_with_label(_("Start"));
gtk_signal_connect(GTK_OBJECT(GTK_BUTTON(start_button)), "clicked",
GTK_SIGNAL_FUNC (cb_start), NULL);
gtk_box_pack_start(GTK_BOX(hbox), start_button, TRUE, TRUE, 4);
- stop_button = gtk_button_new_with_label("Stop");
+ stop_button = gtk_button_new_with_label(_("Stop"));
gtk_signal_connect(GTK_OBJECT(GTK_BUTTON(stop_button)), "clicked",
GTK_SIGNAL_FUNC (cb_stop), NULL);
gtk_box_pack_start(GTK_BOX(hbox), stop_button, TRUE, TRUE, 4);
- reset_button = gtk_button_new_with_label("Reset");
+ reset_button = gtk_button_new_with_label(_("Reset"));
gtk_signal_connect(GTK_OBJECT(GTK_BUTTON(reset_button)), "clicked",
GTK_SIGNAL_FUNC (cb_reset), NULL);
gtk_box_pack_start(GTK_BOX(hbox), reset_button, TRUE, TRUE, 4);
@@ -1047,12 +1009,12 @@
(GtkSignalFunc) cb_clist_down, NULL);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 4);
- button = gtk_button_new_with_label("Enter");
+ button = gtk_button_new_with_label(_("Enter"));
gtk_signal_connect(GTK_OBJECT(button), "clicked",
(GtkSignalFunc) cb_enter, NULL);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 4);
- button = gtk_button_new_with_label("Delete");
+ button = gtk_button_new_with_label(_("Delete"));
gtk_signal_connect(GTK_OBJECT(button), "clicked",
(GtkSignalFunc) cb_delete, NULL);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 4);
@@ -1064,7 +1026,7 @@
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0);
- timer_clist = gtk_clist_new_with_titles(CLIST_WIDTH, timer_title);
+ timer_clist = gtk_clist_new_with_titles(CLIST_WIDTH, timer_title);
gtk_clist_set_shadow_type (GTK_CLIST(timer_clist), GTK_SHADOW_OUT);
gtk_clist_set_column_width (GTK_CLIST(timer_clist), 1, 100);
gtk_clist_set_column_width (GTK_CLIST(timer_clist), 8, 200);
@@ -1094,7 +1056,7 @@
/* --- Info tab */
//vbox = gkrellm_create_tab(tabs, "Info");
- vbox = gkrellm_gtk_framed_notebook_page(tabs, "Info");
+ vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Info"));
// scrolled = gtk_scrolled_window_new(NULL, NULL);
// gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
// GTK_POLICY_AUTOMATIC,
@@ -1103,16 +1065,58 @@
// text = gtk_text_new(NULL, NULL);
text = gkrellm_gtk_scrolled_text_view(vbox, NULL, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
// gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL, plugin_info_text, -1);
- gkrellm_gtk_text_view_append(text, plugin_info_text);
+ {
+ gchar *plugin_info_text;
+ plugin_info_text =
+ _("This configuration tab is for the Timer/Stopwatch plugin.\n" \
+ "\n" \
+ "Adding new timers (count-down) or stopwatches (count-up) should be fairly easy.\n" \
+ "A descriptive label is optional. It will only show up in the tooltip.\n" \
+ "\n" \
+ "Timer:\n" \
+ " The timer will count down from the given value until zero is reached.\n" \
+ "\n" \
+ "Stopwatch:\n" \
+ " The Stopwatch will count up starting at zero until the given value is reached.\n" \
+ "\n" \
+ "Restart:\n" \
+ " If set the timer will start counting down from the set value once it hits zero.\n" \
+ "\n" \
+ "Popup:\n" \
+ " Display a message window once the timer hits zero.\n" \
+ "\n" \
+ "You can use the following mouse clicks as shortcuts:\n" \
+ "Left button:\n" \
+ " Start/Stop timer;\n" \
+ "Middle button:\n" \
+ " Reset timer;\n" \
+ "Right button:\n" \
+ " Open the configuration dialog.\n" \
+ "\n" \
+ "Please drop me a mail if you encounter problems or have questions.\n");
+ gkrellm_gtk_text_view_append(text, plugin_info_text);
+ }
// gtk_text_set_editable(GTK_TEXT_VIEW(text), FALSE);
// gtk_container_add(GTK_CONTAINER(scrolled), text);
/* --- about text */
- text = gtk_label_new(plugin_about_text);
- gtk_notebook_append_page(GTK_NOTEBOOK(tabs), text,
- gtk_label_new("About"));
+ {
+ gchar *plugin_about_text;
+ plugin_about_text =
+ _("Timer plugin 1.2\n"
+ "GKrellM Timer Plugin\n\n"
+ "Copyright (C) 2003 Christian W. Zuckschwerdt\n"
+ "zany@triq.net\n\n"
+ "http://triq.net/gkrellm.html\n\n"
+ "Released under the GNU Public Licence");
+
+ text = gtk_label_new(plugin_about_text);
+
+ }
+ gtk_notebook_append_page(GTK_NOTEBOOK(tabs), text,
+ gtk_label_new(_("About")));
}
@@ -1152,6 +1156,9 @@
pwin32GK = calls->GK;
#endif
+#ifdef ENABLE_NLS
+ bind_textdomain_codeset(PACKAGE, "UTF-8");
+#endif /* ENABLE_NLS */
pGK = gkrellm_ticks();
timers = NULL;
diff -Naur gkrellm_timers-1.2/Makefile gkrellm_timers-1.2.new/Makefile
--- gkrellm_timers-1.2/Makefile 2003-02-07 19:29:54 +0200
+++ gkrellm_timers-1.2.new/Makefile 2003-03-30 13:59:57 +0300
@@ -20,6 +20,16 @@
LIBS = $(GTK_LIB)
LFLAGS = -shared
+PACKAGE ?= gkrellm_timers
+LOCALEDIR ?= /usr/local/share/locale
+
+ifeq ($(enable_nls),1)
+ FLAGS += -DENABLE_NLS -DLOCALEDIR=\"$(LOCALEDIR)\"
+ export enable_nls
+endif
+FLAGS += -DPACKAGE="\"$(PACKAGE)\""
+export PACKAGE LOCALEDIR
+
CC = gcc $(CFLAGS) $(FLAGS)
INSTALL = install -c
@@ -33,15 +43,18 @@
make GTK_CONFIG=gtk12-config PLUGIN_DIR=/usr/X11R6/libexec/gkrellm/plugins
gkrellm_timers.so: $(OBJS)
+ (cd po && ${MAKE} all )
$(CC) $(OBJS) -o gkrellm_timers.so $(LFLAGS) $(LIBS)
clean:
+ (cd po && ${MAKE} clean )
rm -f *.o core *.so* *.bak *~
install-user: gkrellm_timers.so
make PLUGIN_DIR=$(USER_PLUGIN_DIR) install
install: gkrellm_timers.so
+ (cd po && ${MAKE} install )
$(INSTALL) -m 755 -d $(PLUGIN_DIR)
$(INSTALL_PROGRAM) -m 755 gkrellm_timers.so $(PLUGIN_DIR)
diff -Naur gkrellm_timers-1.2/po/Makefile gkrellm_timers-1.2.new/po/Makefile
--- gkrellm_timers-1.2/po/Makefile 1970-01-01 03:00:00 +0300
+++ gkrellm_timers-1.2.new/po/Makefile 2003-03-30 13:45:53 +0300
@@ -0,0 +1,33 @@
+MSGFMT = msgfmt
+SUB_DIRS =
+FILES_PO:=$(wildcard *.po)
+FILES_MO:=$(FILES_PO:.po=.mo)
+
+LOCALEDIR ?= /usr/share/locale
+PACKAGE ?= gkrellm_timers
+
+ifeq ($(enable_nls),1)
+all: mo-files
+
+mo-files: $(FILES_MO)
+
+install:
+ $(MAKE) all
+ for f in *.mo ; do mkdir -p \
+ $(INSTALL_PREFIX)$(LOCALEDIR)/`basename $$f .mo`/LC_MESSAGES ; \
+ cp $$f $(INSTALL_PREFIX)$(LOCALEDIR)/`basename $$f .mo`/LC_MESSAGES/$(PACKAGE).mo ; done
+
+%.mo: %.po
+ $(MSGFMT) -f -v -o $@ $<
+
+else
+
+all:
+
+install:
+
+endif
+
+clean:
+ $(RM) $(FILES_MO)
+
diff -Naur gkrellm_timers-1.2/po/README gkrellm_timers-1.2.new/po/README
--- gkrellm_timers-1.2/po/README 1970-01-01 03:00:00 +0300
+++ gkrellm_timers-1.2.new/po/README 2003-03-30 13:45:36 +0300
@@ -0,0 +1,92 @@
+ Adding a translation to gkrellm_timers
+ --------------------------------------
+0) History
+----------
+ This document is taken from the gkrellm source tree and adapted for
+ gkrellm_timers
+
+1) Extract the strings from the source
+--------------------------------------
+In the gkrellmkam top level directory, create the .po template (.pot):
+
+ xgettext -k_ -kN_ *.c -o po/gkrellm_timers.pot
+
+
+2) Update or create .po files
+-----------------------------
+If there are any existing translations, XX.po files, then merge them:
+
+ cd po
+ msgmerge XX.po gkrellm_timers.pot > XX.po.new
+ mv XX.po.new XX.po
+
+Or, if this is a new translation, copy the template:
+
+ cd po
+ cp gkrellm_timers.pot XX.po
+
+
+3) Add translations
+-------------------
+Edit XX.po to add translations for new strings, fix broken translations,
+and touch up fuzzy translations.
+
+
+4) Make and install gkrellm_timers with i18n enabled
+----------------------------------------------------
+If make is run from this directory instead of the top level dir, you must
+explicitely enable i18n in all the below examples by adding enable_nls=1
+to the make command:
+
+ make enable_nls=1
+
+And for the install step:
+
+ make install enable_nls=1
+
+i18n will be automatically enabled when make is run from the top level dir.
+
+
+In either case, a make install will for each XX.po file create a XX.mo file
+and copy it to:
+
+ $LOCALEDIR/XX/LC_MESSAGES/gkrellm_timers.mo
+
+If there is no LOCALEDIR environment variable, then the default install
+will be to:
+
+ /usr/share/locale/XX/LC_MESSAGES/gkrellm_timers.mo
+
+
+
+But, if you want a different explicit install directory, do for example:
+
+ make install LOCALEDIR=/usr/local/share/locale
+
+or (for bash)
+ export LOCALEDIR=/usr/local/share/locale
+ make install
+
+Other export lines:
+ sh: export LOCALEDIR; LOCALEDIR=/usr/local/share/locale
+ csh: setenv LOCALEDIR /usr/local/share/locale
+
+You can also specify the textdomain package name. From bash:
+ make install PACKAGE=gkrellm_timers
+
+============================================================================
+Using a translation
+-------------------
+
+A user must have localizations enabled for a translation to be used.
+To enable a localization, the LANG environment variable should be set
+via the command line or the shell login startup files.
+
+For example, to see the French translation, a user should be able to:
+
+From bash:
+ export LANG=fr_FR
+or from csh
+ setenv LANG fr_FR
+
+If fr_FR does not work, try fr_FR.ISO_8859-1