diff -Naur gkwebmon-0.2/gk.c gkwebmon-0.2.new/gk.c --- gkwebmon-0.2/gk.c 2003-11-10 17:30:55 +0200 +++ gkwebmon-0.2.new/gk.c 2003-12-02 20:55:32 +0200 @@ -302,25 +302,25 @@ gchar *help_text[] = { - "GKrellM Web Monitor Plugin\n", - "This plugin will monitor web pages for changes.\n", + N_("GKrellM Web Monitor Plugin\n"), + N_("This plugin will monitor web pages for changes.\n"), "\n", - "How it works\n", - "The plugin will fetch the web pages you tell it to and calculate\n", - "MD5. You specify how often it should grab new pages and compare\n", - "the new MD5 with the init MD5. If the new MD5 is not equal to the\n", - "init MD5 the icon decal will change apperance and the number of\n", - "pages that has changed will show. The results of which pages has\n", - "changed will be shown in a tool tip.\n", + N_("How it works\n"), + N_("The plugin will fetch the web pages you tell it to and calculate\n" \ + "MD5. You specify how often it should grab new pages and compare\n" \ + "the new MD5 with the init MD5. If the new MD5 is not equal to the\n" \ + "init MD5 the icon decal will change apperance and the number of\n" \ + "pages that has changed will show. The results of which pages has\n" \ + "changed will be shown in a tool tip.\n" \ + "\n" \ + "Once one or more pages has changed you will have to press the\n" \ + "right mouse button on the decal with the number to reset it. When\n" \ + "the plugin is not in an alarm state you may use the same button\n" \ + "to force a check.\n"), "\n", - "Once one or more pages has changed you will have to press the\n", - "right mouse button on the decal with the number to reset it. When\n", - "the plugin is not in an alarm state you may use the same button\n", - "to force a check.\n", - "\n", - "Settings\n", - "Hours between update:\n", - "This is how often you want the plugin to check for changes.\n" + N_("Settings\n"), + N_("Hours between update:\n" \ + "This is how often you want the plugin to check for changes.\n") }; @@ -330,16 +330,16 @@ gtk_box_pack_start(GTK_BOX(tab_vbox), tabs, TRUE, TRUE, 0); /* options tab */ - vbox_options = gkrellm_gtk_framed_notebook_page(tabs, "Options"); + vbox_options = gkrellm_gtk_framed_notebook_page(tabs, _("Options")); - update_label = g_strdup("Hours between updates"); + update_label = g_strdup(_("Hours between updates")); gkrellm_gtk_spin_button(vbox_options, &update_spin, 24, 1, 336, 1, 10, 0, 0, NULL, 0, FALSE, update_label); g_free(update_label); gtk_spin_button_set_value(GTK_SPIN_BUTTON(update_spin), updatetime); /* url tab1 */ - vbox_url1 = gkrellm_gtk_framed_notebook_page(tabs, "URL #1"); + vbox_url1 = gkrellm_gtk_framed_notebook_page(tabs, _("URL #1")); for (i = 0; i < 10; i++) { url_entry[i] = gtk_entry_new_with_max_length(900); @@ -352,7 +352,7 @@ } /* url tab2 */ - vbox_url2 = gkrellm_gtk_framed_notebook_page(tabs, "URL #2"); + vbox_url2 = gkrellm_gtk_framed_notebook_page(tabs, _("URL #2")); for (i = 10; i < 20; i++) { url_entry[i] = gtk_entry_new_with_max_length(900); if (wi[i].use == 1) { @@ -364,12 +364,12 @@ } /* help tab */ - vbox_help = gkrellm_gtk_framed_notebook_page(tabs, "Help"); + vbox_help = gkrellm_gtk_framed_notebook_page(tabs, _("Help")); text = gkrellm_gtk_scrolled_text_view(vbox_help, NULL, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gkrellm_gtk_text_view_append_strings(text, help_text, - sizeof(help_text) / sizeof(gchar *)); + for (i = 0; i < sizeof(help_text)/sizeof(gchar *); ++i) + gkrellm_gtk_text_view_append(text, _(help_text[i])); /* about tab */ about_text = g_strdup_printf("GKWebMon %s\n" @@ -381,7 +381,7 @@ "Released under the GNU Public License\n", VERSION); - vbox_about = gtk_label_new("About"); + vbox_about = gtk_label_new(_("About")); text = gtk_label_new(about_text); gtk_notebook_append_page(GTK_NOTEBOOK(tabs), text, vbox_about); g_free(about_text); @@ -475,6 +475,10 @@ style_id = gkrellm_add_meter_style(&webmon, STYLE_NAME); web_monitor = &webmon; +#ifdef ENABLE_NLS + bind_textdomain_codeset(PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ + hours_since_update = 0; checkmins = -1; number_of_changed = 0; @@ -537,7 +541,7 @@ static void default_tooltip(void) { g_free(tooltip_text); - tooltip_text = g_strdup_printf("GkWebMon %s", VERSION); + tooltip_text = g_strdup_printf(_("GkWebMon %s"), VERSION); gtk_tooltips_set_tip(tooltip, panel->drawing_area, tooltip_text, NULL); } diff -Naur gkwebmon-0.2/po/gkwebmon.pot gkwebmon-0.2.new/po/gkwebmon.pot --- gkwebmon-0.2/po/gkwebmon.pot 1970-01-01 03:00:00 +0300 +++ gkwebmon-0.2.new/po/gkwebmon.pot 2003-12-01 23:25:27 +0200 @@ -0,0 +1,82 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2003-12-01 23:25+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: gk.c:305 +msgid "GKrellM Web Monitor Plugin\n" +msgstr "" + +#: gk.c:306 +msgid "This plugin will monitor web pages for changes.\n" +msgstr "" + +#: gk.c:308 +msgid "How it works\n" +msgstr "" + +#: gk.c:309 +msgid "" +"The plugin will fetch the web pages you tell it to and calculate\n" +"MD5. You specify how often it should grab new pages and compare\n" +"the new MD5 with the init MD5. If the new MD5 is not equal to the\n" +"init MD5 the icon decal will change apperance and the number of\n" +"pages that has changed will show. The results of which pages has\n" +"changed will be shown in a tool tip.\n" +"\n" +"Once one or more pages has changed you will have to press the\n" +"right mouse button on the decal with the number to reset it. When\n" +"the plugin is not in an alarm state you may use the same button\n" +"to force a check.\n" +msgstr "" + +#: gk.c:321 +msgid "Settings\n" +msgstr "" + +#: gk.c:322 +msgid "" +"Hours between update:\n" +"This is how often you want the plugin to check for changes.\n" +msgstr "" + +#: gk.c:333 +msgid "Options" +msgstr "" + +#: gk.c:335 +msgid "Hours between updates" +msgstr "" + +#: gk.c:342 +msgid "URL #1" +msgstr "" + +#: gk.c:355 +msgid "URL #2" +msgstr "" + +#: gk.c:367 +msgid "Help" +msgstr "" + +#: gk.c:384 +msgid "About" +msgstr "" + +#: gk.c:540 +#, c-format +msgid "GkWebMon %s" +msgstr "" diff -Naur gkwebmon-0.2/po/Makefile gkwebmon-0.2.new/po/Makefile --- gkwebmon-0.2/po/Makefile 1970-01-01 03:00:00 +0300 +++ gkwebmon-0.2.new/po/Makefile 2003-12-01 23:25:17 +0200 @@ -0,0 +1,33 @@ +MSGFMT = msgfmt +SUB_DIRS = +FILES_PO:=$(wildcard *.po) +FILES_MO:=$(FILES_PO:.po=.mo) + +LOCALEDIR ?= /usr/share/locale +PACKAGE ?= gkwebmon + +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 gkwebmon-0.2/po/README gkwebmon-0.2.new/po/README --- gkwebmon-0.2/po/README 1970-01-01 03:00:00 +0300 +++ gkwebmon-0.2.new/po/README 2003-12-01 23:25:02 +0200 @@ -0,0 +1,92 @@ + Adding a translation to gkwebmon + -------------------------------------- +0) History +---------- + This document is taken from the gkrellm source tree and adapted for + gkwebmon + +1) Extract the strings from the source +-------------------------------------- +In the gkrellmkam top level directory, create the .po template (.pot): + + xgettext -k_ -kN_ *.c -o po/gkwebmon.pot + + +2) Update or create .po files +----------------------------- +If there are any existing translations, XX.po files, then merge them: + + cd po + msgmerge XX.po gkwebmon.pot > XX.po.new + mv XX.po.new XX.po + +Or, if this is a new translation, copy the template: + + cd po + cp gkwebmon.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 gkwebmon 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/gkwebmon.mo + +If there is no LOCALEDIR environment variable, then the default install +will be to: + + /usr/share/locale/XX/LC_MESSAGES/gkwebmon.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=gkwebmon + +============================================================================ +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