diff -Naur gkrellAclock-0.3.2/gkrellaclock.c gkrellAclock-0.3.2.new/gkrellaclock.c --- gkrellAclock-0.3.2/gkrellaclock.c 2002-08-13 19:25:29 +0300 +++ gkrellAclock-0.3.2.new/gkrellaclock.c 2003-03-30 17:35:26 +0300 @@ -46,14 +46,14 @@ #define GRAY 6 #define L_PINK 7 -#define N_WHITE "White" -#define N_ORANGE "Orange" -#define N_GREEN "Green" -#define N_YELLOW "Yellow" -#define N_CYAN "Cyan" -#define N_RED "Red" -#define N_GRAY "Gray" -#define N_L_PINK "Light Pink" +#define N_WHITE N_("White") +#define N_ORANGE N_("Orange") +#define N_GREEN N_("Green") +#define N_YELLOW N_("Yellow") +#define N_CYAN N_("Cyan") +#define N_RED N_("Red") +#define N_GRAY N_("Gray") +#define N_L_PINK N_("Light Pink") static GkrellmMonitor *mon; static GkrellmChart *chart; @@ -578,13 +578,13 @@ static gchar *help_text[] = { "" CONFIG_NAME " " GKRELLACLOCK_VER "\n\n" , - "Simple Analog Clock \n\n" , - "Left-click will change dial color, Middle-click will change seconds color\n", - "and right-click opens configuration windws.\n\n", - " Options \n\n" , - "Cycle Dial Color - when checked will change dial color every hour.\n\n", - "Select Dial Color from drop down .\n", - "Select Seconds Color from drop down .\n", + N_("Simple Analog Clock \n\n" \ + "Left-click will change dial color, Middle-click will change seconds color\n" \ + "and right-click opens configuration windws.\n\n"), + N_(" Options \n\n"), + N_("Cycle Dial Color - when checked will change dial color every hour.\n\n" \ + "Select Dial Color from drop down .\n" \ + "Select Seconds Color from drop down .\n"), }; @@ -603,7 +603,7 @@ hbox = gtk_hbox_new(FALSE, 0); - cycle_option = gtk_check_button_new_with_label( "Cycle Dial Color" ); + cycle_option = gtk_check_button_new_with_label( _("Cycle Dial Color") ); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cycle_option), cycle ); @@ -613,7 +613,7 @@ gtk_box_pack_start(GTK_BOX(vbox), cycle_option, FALSE, FALSE, 0); - label = gtk_label_new("Dial Color " ); + label = gtk_label_new(_("Dial Color ") ); for ( i = 0; i < MAX_COLORS; i++ ) { @@ -635,7 +635,7 @@ hbox = gtk_hbox_new(FALSE, 0); - s_label = gtk_label_new("Seconds Color " ); + s_label = gtk_label_new(_("Seconds Color ") ); for ( i = 0; i < MAX_COLORS; i++ ) { @@ -653,7 +653,7 @@ gtk_container_add(GTK_CONTAINER(vbox), hbox); - label = gtk_label_new("Options"); + label = gtk_label_new(_("Options")); gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_notebook_append_page(GTK_NOTEBOOK(laptop), frame, label); @@ -667,16 +667,17 @@ text = gtk_text_view_new(); - 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])); gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE); gtk_container_add(GTK_CONTAINER(info_window), text); - label = gtk_label_new("Help"); + label = gtk_label_new(_("Help")); gtk_notebook_append_page(GTK_NOTEBOOK(laptop), frame, label); /* about */ about_text = g_strdup_printf( - "GKrellAclock %s\n" \ + _("GKrellAclock %s\n" \ "GKrellM Aclock Plugin\n" \ "\n" \ "Copyright (C) 2002 M.R.Muthu Kumar\n" \ @@ -684,11 +685,11 @@ "\n" \ "Released under the GNU Public License\n" \ "GkrellAclock comes with ABSOLUTELY NO WARRANTY\n" \ - , GKRELLACLOCK_VER + ), GKRELLACLOCK_VER ); about_label = gtk_label_new(about_text); g_free(about_text); - label = gtk_label_new("About"); + label = gtk_label_new(_("About")); gtk_notebook_append_page(GTK_NOTEBOOK(laptop), about_label, label); } @@ -732,7 +733,10 @@ pwin32GK = calls->GK; #endif - /* If this call is made, the background and krell images for this plugin +#ifdef ENABLE_NLS + bind_textdomain_codeset(PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ + /* If this call is made, the background and krell images for this plugin | can be custom themed by putting bg_meter.png or krell.png in the | subdirectory STYLE_NAME of the theme directory. Text colors (and | other things) can also be specified for the plugin with gkrellmrc diff -Naur gkrellAclock-0.3.2/Makefile gkrellAclock-0.3.2.new/Makefile --- gkrellAclock-0.3.2/Makefile 2002-08-13 19:29:08 +0300 +++ gkrellAclock-0.3.2.new/Makefile 2003-03-30 17:27:37 +0300 @@ -5,19 +5,32 @@ LIBS = $(GTK_LIB) LFLAGS = -shared +LOCALEDIR := $(DESTDIR)/usr/share/locale +PACKAGE ?= gkrellaclock + +ifeq ($(enable_nls),1) + CFLAGS += -DENABLE_NLS -DLOCALEDIR=\"$(LOCALEDIR)\" + export enable_nls +endif +CFLAGS += -DPACKAGE="\"$(PACKAGE)\"" +export PACKAGE LOCALEDIR + CC = gcc $(CFLAGS) $(FLAGS) OBJS = gkrellaclock.o gkrellaclock.so: $(OBJS) + (cd po && ${MAKE}) $(CC) $(OBJS) -o gkrellaclock.so $(LFLAGS) $(LIBS) clean: rm -f *.o core *.so* *.bak *~ + (cd po && ${MAKE} clean ) gkrellaclock.o: gkrellaclock.c install: + (cd po && ${MAKE} install ) if [ -d /usr/local/lib/gkrellm2/plugins/ ] ; then \ install -c -s -m 644 gkrellaclock.so /usr/local/lib/gkrellm2/plugins/ ; \ elif [ -d /usr/lib/gkrellm2/plugins/ ] ; then \ diff -Naur gkrellAclock-0.3.2/po/Makefile gkrellAclock-0.3.2.new/po/Makefile --- gkrellAclock-0.3.2/po/Makefile 1970-01-01 03:00:00 +0300 +++ gkrellAclock-0.3.2.new/po/Makefile 2003-03-30 17:36:22 +0300 @@ -0,0 +1,33 @@ +MSGFMT = msgfmt +SUB_DIRS = +FILES_PO:=$(wildcard *.po) +FILES_MO:=$(FILES_PO:.po=.mo) + +LOCALEDIR ?= /usr/share/locale +PACKAGE ?= gkrellaclock + +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 gkrellAclock-0.3.2/po/README gkrellAclock-0.3.2.new/po/README --- gkrellAclock-0.3.2/po/README 1970-01-01 03:00:00 +0300 +++ gkrellAclock-0.3.2.new/po/README 2003-03-30 17:36:12 +0300 @@ -0,0 +1,92 @@ + Adding a translation to gkrellaclock + -------------------------------------- +0) History +---------- + This document is taken from the gkrellm source tree and adapted for + gkrellaclock + +1) Extract the strings from the source +-------------------------------------- +In the gkrellmkam top level directory, create the .po template (.pot): + + xgettext -k_ -kN_ *.c -o po/gkrellaclock.pot + + +2) Update or create .po files +----------------------------- +If there are any existing translations, XX.po files, then merge them: + + cd po + msgmerge XX.po gkrellaclock.pot > XX.po.new + mv XX.po.new XX.po + +Or, if this is a new translation, copy the template: + + cd po + cp gkrellaclock.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 gkrellaclock 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/gkrellaclock.mo + +If there is no LOCALEDIR environment variable, then the default install +will be to: + + /usr/share/locale/XX/LC_MESSAGES/gkrellaclock.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=gkrellaclock + +============================================================================ +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