diff -Naur gkrellmlaunch-0.5/gkrellmlaunch.c gkrellmlaunch-0.5.new/gkrellmlaunch.c --- gkrellmlaunch-0.5/gkrellmlaunch.c 2002-09-26 16:56:06 +0300 +++ gkrellmlaunch-0.5.new/gkrellmlaunch.c 2003-03-30 14:39:15 +0300 @@ -53,28 +53,28 @@ static gchar *GKrellMLaunchInfo[] = { - "Usage\n\n", - "Label: ", - "This is the text that will appear on the button for the command.\n\n", - "Command: ", - "This is the binary name to run (e.g., mozilla).\n", - "Visible: ", - "Check box to allow buttons to be hidden if not used.\n\n", - "Use the \"Add\" button to create a new button.\n", - "Use the \"Replace\" button to update changes made for currently selected ", - "list entry.\n", - "Use the \"Delete\" button to delete the selected entry.\n", - "Use the /\\ & \\/ buttons to move selected entry up & down in position.\n", + N_("Usage\n\n"), + N_("Label: " \ + "This is the text that will appear on the button for the command.\n\n" \ + "Command: " \ + "This is the binary name to run (e.g., mozilla).\n" \ + "Visible: " \ + "Check box to allow buttons to be hidden if not used.\n\n" \ + "Use the \"Add\" button to create a new button.\n" \ + "Use the \"Replace\" button to update changes made for currently selected " \ + "list entry.\n" \ + "Use the \"Delete\" button to delete the selected entry.\n" \ + "Use the /\\ & \\/ buttons to move selected entry up & down in position.\n") }; static gchar GKrellMLaunchAbout[] = - "GKrellMLaunch Version 0.5 (GKrellm2)\n"\ + N_("GKrellMLaunch Version 0.5 (GKrellm2)\n"\ "GKrellM plugin to give one-click access to frequently used programs.\n\n"\ "Copyright (c) 2001-2002 by Lee Webb\n"\ "Release Date: 26/09/2002\n"\ "leewebb@users.sourceforge.net\n"\ "http://gkrellmlaunch.sourceforge.net\n\n"\ - "Released under the GNU Public License.\n"; + "Released under the GNU Public License.\n"); static GkrellmMonitor *monitor; @@ -308,7 +308,7 @@ * Fill the visible option. */ gtk_clist_get_text (GTK_CLIST (launcherCList), row, 0, &string); - launcher->visible = (strcmp (string, "No") ? 1 : 0); + launcher->visible = (strcmp (string, _("No")) ? 1 : 0); /* * Fill the label option. @@ -487,7 +487,7 @@ */ gtk_clist_get_text (GTK_CLIST (launcherCList), row, 0, &string); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggleButton), - strcmp (string, "No") ? TRUE : FALSE); + strcmp (string, _("No")) ? TRUE : FALSE); gtk_clist_get_text (GTK_CLIST (launcherCList), row, 1, &string); gtk_entry_set_text (GTK_ENTRY (cmdEntryLabel), string); @@ -529,7 +529,7 @@ } buffer[0] = gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON (toggleButton)) == TRUE ? "Yes" : "No"; + (GTK_TOGGLE_BUTTON (toggleButton)) == TRUE ? _("Yes") : _("No"); gtk_clist_append (GTK_CLIST (launcherCList), buffer); listModified = TRUE; @@ -571,7 +571,7 @@ selectedRow, 0, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggleButton)) - == TRUE ? "Yes" : "No"); + == TRUE ? _("Yes") : _("No")); gtk_clist_unselect_row (GTK_CLIST (launcherCList), selectedRow, 0); selectedRow = -1; listModified = TRUE; @@ -614,7 +614,7 @@ */ static void create_plugin_tab (GtkWidget *tab_vbox) { - gchar *titles[3] = {"Visible", "Label", "Command"}; + gchar *titles[3] = {_("Visible"), _("Label"), _("Command")}; gchar *buffer[3]; gchar visible[5]; gint i = 0; @@ -641,7 +641,7 @@ * Setup tab: give it some scroll bars to keep the config * window size compact. */ - vbox = gkrellm_gtk_notebook_page (tabs, "Setup"); + vbox = gkrellm_gtk_notebook_page (tabs, _("Setup")); vbox = gkrellm_gtk_scrolled_vbox (vbox, NULL, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -653,7 +653,7 @@ * Create text boxes to put Labels and Commands in */ - label = gtk_label_new ("Label: "); + label = gtk_label_new (_("Label: ")); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -663,7 +663,7 @@ gtk_entry_set_editable (GTK_ENTRY (cmdEntryLabel), TRUE); gtk_box_pack_start (GTK_BOX (vbox), cmdEntryLabel, FALSE, FALSE, 0) ; - label = gtk_label_new ("Command:"); + label = gtk_label_new (_("Command:")); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, i); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -673,7 +673,7 @@ gtk_entry_set_editable (GTK_ENTRY (cmdEntry), TRUE) ; gtk_box_pack_start (GTK_BOX (vbox), cmdEntry, FALSE, FALSE, 0) ; - toggleButton = gtk_check_button_new_with_label ("Visible?"); + toggleButton = gtk_check_button_new_with_label (_("Visible?")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggleButton), 0); gtk_box_pack_start (GTK_BOX (vbox), toggleButton, FALSE, TRUE, 0); @@ -687,18 +687,18 @@ /* * Add "Add", "Replace" & "Delete" buttons */ - button = gtk_button_new_with_label ("Add"); + button = gtk_button_new_with_label (_("Add")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) cbAdd, NULL); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); - button = gtk_button_new_with_label ("Replace"); + button = gtk_button_new_with_label (_("Replace")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) cbReplace, NULL); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); - button = gtk_button_new_with_label ("Delete"); + button = gtk_button_new_with_label (_("Delete")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) cbDelete, NULL); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); @@ -773,7 +773,7 @@ for (i = 0, list = launcherList; list; i += 1, list = list->next) { launcher = (GLauncher *) list->data; - sprintf (visible, "%s", (launcher->visible == 1 ? "Yes" : "No")); + sprintf (visible, "%s", (launcher->visible == 1 ? _("Yes") : _("No"))); buffer[0] = visible; buffer[1] = launcher->label; buffer[2] = launcher->cmd; @@ -784,18 +784,17 @@ /* * Info tab */ - vbox = gkrellm_gtk_notebook_page (tabs, "Info"); + vbox = gkrellm_gtk_notebook_page (tabs, _("Info")); text = gkrellm_gtk_scrolled_text_view (vbox, NULL, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gkrellm_gtk_text_view_append_strings (text, GKrellMLaunchInfo, - (sizeof (GKrellMLaunchInfo) - / sizeof (gchar *))); + for (i = 0; i < sizeof(GKrellMLaunchInfo) / sizeof(gchar *); ++i) + gkrellm_gtk_text_view_append(text, _(GKrellMLaunchInfo[i])); /* * About tab */ aboutText = gtk_label_new (GKrellMLaunchAbout); - aboutLabel = gtk_label_new ("About"); + aboutLabel = gtk_label_new (_("About")); gtk_notebook_append_page (GTK_NOTEBOOK (tabs), aboutText, aboutLabel); } @@ -920,6 +919,9 @@ selectedRow = -1; listModified = FALSE; +#ifdef ENABLE_NLS + bind_textdomain_codeset(PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ style_id = gkrellm_add_meter_style (&plugin_mon, STYLE_NAME); monitor = &plugin_mon; return &plugin_mon; diff -Naur gkrellmlaunch-0.5/Makefile gkrellmlaunch-0.5.new/Makefile --- gkrellmlaunch-0.5/Makefile 2002-09-26 16:56:06 +0300 +++ gkrellmlaunch-0.5.new/Makefile 2003-03-30 14:40:19 +0300 @@ -10,14 +10,26 @@ LFLAGS = -shared -W1 +LOCALEDIR := $(DESTDIR)/usr/share/locale +PACKAGE ?= gkrellmlaunch + +ifeq ($(enable_nls),1) + FLAGS += -DENABLE_NLS -DLOCALEDIR=\"$(LOCALEDIR)\" + export enable_nls +endif +FLAGS += -DPACKAGE="\"$(PACKAGE)\"" +export PACKAGE LOCALEDIR + CC = gcc $(CFLAGS) $(FLAGS) OBJS = gkrellmlaunch.o gkrellmlaunch.so: $(OBJS) + (cd po && ${MAKE} all ) $(CC) $(OBJS) -o gkrellmlaunch.so $(LFLAGS) $(LIBS) clean: + (cd po && ${MAKE} clean ) rm -f *.o core *.so* *.bak *~ gkrellmlaunch.o: gkrellmlaunch.c diff -Naur gkrellmlaunch-0.5/po/Makefile gkrellmlaunch-0.5.new/po/Makefile --- gkrellmlaunch-0.5/po/Makefile 1970-01-01 03:00:00 +0300 +++ gkrellmlaunch-0.5.new/po/Makefile 2003-03-30 14:40:37 +0300 @@ -0,0 +1,33 @@ +MSGFMT = msgfmt +SUB_DIRS = +FILES_PO:=$(wildcard *.po) +FILES_MO:=$(FILES_PO:.po=.mo) + +LOCALEDIR ?= /usr/share/locale +PACKAGE ?= gkrellmlaunch + +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 gkrellmlaunch-0.5/po/README gkrellmlaunch-0.5.new/po/README --- gkrellmlaunch-0.5/po/README 1970-01-01 03:00:00 +0300 +++ gkrellmlaunch-0.5.new/po/README 2003-03-30 14:23:12 +0300 @@ -0,0 +1,92 @@ + Adding a translation to gkrellmlaunch + -------------------------------------- +0) History +---------- + This document is taken from the gkrellm source tree and adapted for + gkrellmlaunch + +1) Extract the strings from the source +-------------------------------------- +In the gkrellmkam top level directory, create the .po template (.pot): + + xgettext -k_ -kN_ *.c -o po/gkrellmlaunch.pot + + +2) Update or create .po files +----------------------------- +If there are any existing translations, XX.po files, then merge them: + + cd po + msgmerge XX.po gkrellmlaunch.pot > XX.po.new + mv XX.po.new XX.po + +Or, if this is a new translation, copy the template: + + cd po + cp gkrellmlaunch.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 gkrellmlaunch 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/gkrellmlaunch.mo + +If there is no LOCALEDIR environment variable, then the default install +will be to: + + /usr/share/locale/XX/LC_MESSAGES/gkrellmlaunch.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=gkrellmlaunch + +============================================================================ +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