--- rrdtool-1.2.19/Makefile.am.orig	2008-02-13 23:18:16.330233000 +0900
+++ rrdtool-1.2.19/Makefile.am	2008-02-13 23:18:27.349266000 +0900
@@ -2,7 +2,7 @@
 RSYNC = rsync --rsh=ssh
 
 # build the following subdirectories
-SUBDIRS = src bindings doc examples
+SUBDIRS = po src bindings doc examples
 
   # the following files are not mentioned in any other Makefile
 EXTRA_DIST = COPYRIGHT CHANGES WIN32-BUILD-TIPS.txt TODO CONTRIBUTORS THREADS \
--- rrdtool-1.2.19/configure.ac.orig	2008-02-13 21:48:56.931647000 +0900
+++ rrdtool-1.2.19/configure.ac	2008-02-14 11:45:47.349184000 +0900
@@ -155,6 +155,14 @@ char *strchr (), *strrchr ();
 dnl Process Special Options
 dnl -----------------------------------
 
+dnl gettext
+GETTEXT_PACKAGE=rrdtool
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package])
+IT_PROG_INTLTOOL([0.35.0])
+
+AM_GLIB_GNU_GETTEXT
+
 dnl How the vertical axis label is printed
 AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE, 
  [Vertical label angle: 90.0 (default) or 270.0])
@@ -218,7 +226,7 @@ CONFIGURE_PART(Checking for Header Files
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_DIRENT
-AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h time.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h float.h)
+AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h time.h libintl.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h float.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -605,6 +614,7 @@ AC_CONFIG_FILES([examples/4charts.pl])
 AC_CONFIG_FILES([examples/perftest.pl])
 AC_CONFIG_FILES([examples/Makefile])
 AC_CONFIG_FILES([doc/Makefile])
+AC_CONFIG_FILES([po/Makefile.in])
 AC_CONFIG_FILES([src/Makefile])
 AC_CONFIG_FILES([bindings/Makefile])
 AC_CONFIG_FILES([bindings/tcl/Makefile])
--- rrdtool-1.2.19/po/LINGUAS.orig	2008-02-13 23:07:18.921276000 +0900
+++ rrdtool-1.2.19/po/LINGUAS	2008-02-13 23:07:22.455816000 +0900
@@ -0,0 +1 @@
+#
--- rrdtool-1.2.19/po/POTFILES.in.orig	2008-02-13 23:02:41.312095000 +0900
+++ rrdtool-1.2.19/po/POTFILES.in	2008-02-13 23:02:52.584333000 +0900
@@ -0,0 +1,2 @@
+src/getopt.c
+src/rrd_tool.c
--- rrdtool-1.2.19/rrdtool.spec.orig	2008-02-13 23:22:39.609947000 +0900
+++ rrdtool-1.2.19/rrdtool.spec	2008-02-13 23:23:06.290823000 +0900
@@ -77,6 +77,11 @@ Python RRDtool bindings.
     configure Makefile.in
 
 %build
+intltoolize --automake -c -f
+aclocal
+autoheader
+autoconf
+automake -a -c -f
 %configure \
     --program-prefix="%{?_program_prefix}" \
     --libdir=%{_libdir} \
--- rrdtool-1.2.19/src/Makefile.am.orig	2008-02-13 22:42:51.602594000 +0900
+++ rrdtool-1.2.19/src/Makefile.am	2008-02-13 23:09:29.126553000 +0900
@@ -9,6 +9,7 @@ fonts_DATA = DejaVuSansMono-Roman.ttf
 
 #INCLUDES = $(FREETYPE_INCLUDES) $(ART_INCLUDES) \
 #           $(PNG_INCLUDES) $(ZLIB_INCLUDES)
+INCLUDES = -DLOCALEDIR="\"$(datadir)/locale\""
 RRD_DEFAULT_FONT=@RRD_DEFAULT_FONT@
 AM_CPPFLAGS = -DRRD_DEFAULT_FONT=\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=@NUMVERS@
 
@@ -52,6 +53,7 @@ noinst_HEADERS = \
 	unused.h \
 	rrd_gfx.h \
 	getopt.h parsetime.h \
+	rrd_i18n.h \
 	rrd_format.h rrd_tool.h rrd_xport.h rrd.h rrd_hw.h rrd_rpncalc.h \
 	rrd_nan_inf.h fnv.h rrd_graph.h rrd_afm.h rrd_afm_data.h \
 	rrd_is_thread_safe.h
--- rrdtool-1.2.19/src/getopt.c.orig	2008-02-13 23:04:42.025664000 +0900
+++ rrdtool-1.2.19/src/getopt.c	2008-02-13 23:05:21.324026000 +0900
@@ -34,6 +34,8 @@
 #include "../rrd_config.h"
 #endif
 
+#include "rrd_i18n.h"
+
 #if !defined (__STDC__) || !__STDC__
 /* This is a separate conditional since some stdc systems
    reject `defined (const)'.  */
@@ -85,17 +87,6 @@
 #define getpid() GetCurrentProcessId()
 #endif
 
-#ifndef _
-/* This is for other GNU distributions with internationalized messages.
-   When compiling libc, the _ macro is predefined.  */
-#ifdef HAVE_LIBINTL_H
-# include <libintl.h>
-# define _(msgid)	gettext (msgid)
-#else
-# define _(msgid)	(msgid)
-#endif
-#endif
-
 /* This version of `getopt' appears to the caller like standard Unix `getopt'
    but it behaves differently for the user, since it allows the user
    to intersperse the options with the other arguments.
--- rrdtool-1.2.19/src/rrd_i18n.h.orig	2008-02-13 22:42:42.158868000 +0900
+++ rrdtool-1.2.19/src/rrd_i18n.h	2008-02-15 13:40:23.210680000 +0900
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * RRDtool 1.2.19  Copyright by Takao Fujiwara, 2008
+ *****************************************************************************
+ * rrd_i18n.h   Common Header File
+ *****************************************************************************/
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+
+#ifndef _RRD_I18N_H
+#define _RRD_I18N_H
+
+#ifndef _
+/* This is for other GNU distributions with internationalized messages.
+   When compiling libc, the _ macro is predefined.  */
+#ifdef HAVE_LIBINTL_H
+#  include <libintl.h>
+#define _(String) gettext (String)
+#else
+#define _(String) (String)
+#endif
+#define N_(String) (String)
+#endif
+
+
+#endif
+
+#ifdef  __cplusplus
+}
+#endif
--- rrdtool-1.2.19/src/rrd_tool.c.orig	2008-02-13 22:21:19.602495000 +0900
+++ rrdtool-1.2.19/src/rrd_tool.c	2008-02-15 13:41:48.361092000 +0900
@@ -4,8 +4,21 @@
  * rrd_tool.c  Startup wrapper
  *****************************************************************************/
 
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H)
+#include "../win32/config.h"
+#else
+#ifdef HAVE_CONFIG_H
+#include "../rrd_config.h"
+#endif
+#endif
+
 #include "rrd_tool.h"
 #include "rrd_xport.h"
+#include "rrd_i18n.h"
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
 
 void PrintUsage(char *cmd);
 int CountArgs(char *aLine);
@@ -22,78 +35,78 @@ void PrintUsage(char *cmd)
 {
 
     char help_main[] =
-	   "RRDtool " PACKAGE_VERSION "  Copyright 1997-2007 by Tobias Oetiker <tobi@oetiker.ch>\n"
-           "               Compiled " __DATE__ " " __TIME__ "\n\n"
-	   "Usage: rrdtool [options] command command_options\n\n";
+	   N_("RRDtool %s  Copyright 1997-2007 by Tobias Oetiker <tobi@oetiker.ch>\n"
+           "               Compiled %s %s\n\n"
+	   "Usage: rrdtool [options] command command_options\n\n");
 
     char help_list[] =
-	   "Valid commands: create, update, updatev, graph, dump, restore,\n"
+	   N_("Valid commands: create, update, updatev, graph, dump, restore,\n"
 	   "\t\tlast, lastupdate, first, info, fetch, tune,\n"
-	   " resize, xport\n\n";
+	   " resize, xport\n\n");
 
     char help_listremote[] =
-           "Valid remote commands: quit, ls, cd, mkdir, pwd\n\n";
+           N_("Valid remote commands: quit, ls, cd, mkdir, pwd\n\n");
 
 
     char help_create[] =
-	   "* create - create a new RRD\n\n"
+	   N_("* create - create a new RRD\n\n"
 	   "\trrdtool create filename [--start|-b start time]\n"
 	   "\t\t[--step|-s step]\n"
 	   "\t\t[DS:ds-name:DST:dst arguments]\n" 
-	   "\t\t[RRA:CF:cf arguments]\n\n";
+	   "\t\t[RRA:CF:cf arguments]\n\n");
 
     char help_dump[] =
-	   "* dump - dump an RRD to XML\n\n"
-	   "\trrdtool dump filename.rrd >filename.xml\n\n";
+	   N_("* dump - dump an RRD to XML\n\n"
+	   "\trrdtool dump filename.rrd >filename.xml\n\n");
 
     char help_info[] =
-	   "* info - returns the configuration and status of the RRD\n\n"
-	   "\trrdtool info filename.rrd\n\n";
+	   N_("* info - returns the configuration and status of the RRD\n\n"
+	   "\trrdtool info filename.rrd\n\n");
 
     char help_restore[] =
-	   "* restore - restore an RRD file from its XML form\n\n"
-	   "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n";
+	   N_("* restore - restore an RRD file from its XML form\n\n"
+	   "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n");
 
     char help_last[] =
-           "* last - show last update time for RRD\n\n"
-           "\trrdtool last filename.rrd\n\n";
+           N_("* last - show last update time for RRD\n\n"
+           "\trrdtool last filename.rrd\n\n");
 
     char help_lastupdate[] =
-          "* lastupdate - returns the most recent datum stored for\n"
+          N_("* lastupdate - returns the most recent datum stored for\n"
           "  each DS in an RRD\n\n"
-          "\trrdtool lastupdate filename.rrd\n\n"; 
+          "\trrdtool lastupdate filename.rrd\n\n");
 
     char help_first[] =
-           "* first - show first update time for RRA within an RRD\n\n"
-           "\trrdtool first filename.rrd [--rraindex number]\n\n";
+           N_("* first - show first update time for RRA within an RRD\n\n"
+           "\trrdtool first filename.rrd [--rraindex number]\n\n");
 
     char help_update[] =
-	   "* update - update an RRD\n\n"
+	   N_("* update - update an RRD\n\n"
 	   "\trrdtool update filename\n"
 	   "\t\t--template|-t ds-name:ds-name:...\n"
 	   "\t\ttime|N:value[:value...]\n\n"
            "\t\tat-time@value[:value...]\n\n"
- 	   "\t\t[ time:value[:value...] ..]\n\n";
+ 	   "\t\t[ time:value[:value...] ..]\n\n");
     
 	char help_updatev[] =
-	   "* updatev - a verbose version of update\n"
+	   N_("* updatev - a verbose version of update\n"
 	   "\treturns information about values, RRAs, and datasources updated\n\n"
 	   "\trrdtool updatev filename\n"
 	   "\t\t--template|-t ds-name:ds-name:...\n"
 	   "\t\ttime|N:value[:value...]\n\n"
            "\t\tat-time@value[:value...]\n\n"
- 	   "\t\t[ time:value[:value...] ..]\n\n";
+ 	   "\t\t[ time:value[:value...] ..]\n\n");
  
     char help_fetch[] =
-	   "* fetch - fetch data out of an RRD\n\n"
+	   N_("* fetch - fetch data out of an RRD\n\n"
 	   "\trrdtool fetch filename.rrd CF\n"
 	   "\t\t[-r|--resolution resolution]\n"
-	   "\t\t[-s|--start start] [-e|--end end]\n\n";
+	   "\t\t[-s|--start start] [-e|--end end]\n\n");
 
 /* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/
 
     char help_graph1[] =
-	   "* graph - generate a graph from one or several RRD\n\n"
+	   N_("* graph - generate a graph from one or several RRD\n\n"
 	   "\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n"
 	   "\t\t[-x|--x-grid x-axis grid and label]\n"
 	   "\t\t[-Y|--alt-y-grid]\n"
@@ -104,7 +117,7 @@ void PrintUsage(char *cmd)
 	   "\t\t[-l|--lower-limit value] [-r|--rigid]\n"
            "\t\t[-g|--no-legend]\n"
     	   "\t\t[-F|--force-rules-legend]\n"
-           "\t\t[-j|--only-graph]\n";
+           "\t\t[-j|--only-graph]\n");
     char help_graph2[] =
 	   "\t\t[-n|--font FONTTAG:size:font]\n"
            "\t\t[-m|--zoom factor]\n"       
@@ -139,7 +152,7 @@ void PrintUsage(char *cmd)
 	   "\t\t[STACK:vname[#rrggbb[aa][:legend]]] (deprecated)\n\n";
 
     char help_tune1[] =
-	   " * tune -  Modify some basic properties of an RRD\n\n"
+	   N_(" * tune -  Modify some basic properties of an RRD\n\n"
 	   "\trrdtool tune filename\n"
 	   "\t\t[--heartbeat|-h ds-name:heartbeat]\n"
 	   "\t\t[--data-source-type|-d ds-name:DST]\n"
@@ -148,53 +161,53 @@ void PrintUsage(char *cmd)
 	   "\t\t[--deltapos scale-value] [--deltaneg scale-value]\n"
 	   "\t\t[--failure-threshold integer]\n"
 	   "\t\t[--window-length integer]\n"
-	   "\t\t[--alpha adaptation-parameter]\n";
+	   "\t\t[--alpha adaptation-parameter]\n");
     char help_tune2[] =
-	   " * tune -  Modify some basic properties of an RRD\n\n"
+	   N_(" * tune -  Modify some basic properties of an RRD\n\n"
 	   "\t\t[--beta adaptation-parameter]\n"
 	   "\t\t[--gamma adaptation-parameter]\n"
 	   "\t\t[--gamma-deviation adaptation-parameter]\n"
-	   "\t\t[--aberrant-reset ds-name]\n\n";
+	   "\t\t[--aberrant-reset ds-name]\n\n");
 
     char help_resize[] =
-	   " * resize - alter the length of one of the RRAs in an RRD\n\n"
-	   "\trrdtool resize filename rranum GROW|SHRINK rows\n\n";
+	   N_(" * resize - alter the length of one of the RRAs in an RRD\n\n"
+	   "\trrdtool resize filename rranum GROW|SHRINK rows\n\n");
 
     char help_xport[] =
-	   "* xport - generate XML dump from one or several RRD\n\n"
+	   N_("* xport - generate XML dump from one or several RRD\n\n"
 	   "\trrdtool xport [-s|--start seconds] [-e|--end seconds]\n"
 	   "\t\t[-m|--maxrows rows]\n"
 	   "\t\t[--step seconds]\n"	   
 	   "\t\t[--enumds]\n"	   
 	   "\t\t[DEF:vname=rrd:ds-name:CF]\n"
 	   "\t\t[CDEF:vname=rpn-expression]\n"
-           "\t\t[XPORT:vname:legend]\n\n";
+           "\t\t[XPORT:vname:legend]\n\n");
 
     char help_quit[] =
-	   " * quit - closing a session in remote mode\n\n"
-	   "\trrdtool quit\n\n";
+	   N_(" * quit - closing a session in remote mode\n\n"
+	   "\trrdtool quit\n\n");
 
     char help_ls[] =
-	   " * ls - lists all *.rrd files in current directory\n\n"
-	   "\trrdtool ls\n\n";
+	   N_(" * ls - lists all *.rrd files in current directory\n\n"
+	   "\trrdtool ls\n\n");
 
     char help_cd[] =
-	   " * cd - changes the current directory\n\n"
-	   "\trrdtool cd new directory\n\n";
+	   N_(" * cd - changes the current directory\n\n"
+	   "\trrdtool cd new directory\n\n");
 
     char help_mkdir[] =
-	   " * mkdir - creates a new directory\n\n"
-	   "\trrdtool mkdir newdirectoryname\n\n";
+	   N_(" * mkdir - creates a new directory\n\n"
+	   "\trrdtool mkdir newdirectoryname\n\n");
 
     char help_pwd[] =
-	   " * pwd - returns the current working directory\n\n"
-	   "\trrdtool pwd\n\n";
+	   N_(" * pwd - returns the current working directory\n\n"
+	   "\trrdtool pwd\n\n");
 
     char help_lic[] =
-	   "RRDtool is distributed under the Terms of the GNU General\n"
+	   N_("RRDtool is distributed under the Terms of the GNU General\n"
 	   "Public License Version 2. (www.gnu.org/copyleft/gpl.html)\n\n"
 
-	   "For more information read the RRD manpages\n\n";
+	   "For more information read the RRD manpages\n\n");
 
     enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST,
     	   C_LASTUPDATE, C_FIRST, C_UPDATE, C_FETCH, C_GRAPH, C_TUNE,
@@ -244,77 +257,78 @@ void PrintUsage(char *cmd)
             else if (!strcmp(cmd,"pwd"))
                 help_cmd = C_PWD;
 	}
-    fputs(help_main, stdout);
+    fprintf(stdout, _(help_main), PACKAGE_VERSION, __DATE__, __TIME__);
+    fflush (stdout);
     switch (help_cmd)
 	{
 	    case C_NONE:
-		fputs(help_list, stdout);
+		fputs(_(help_list), stdout);
                 if (RemoteMode){
-                   fputs(help_listremote, stdout);
+                   fputs(_(help_listremote), stdout);
                 }
 		break;
 	    case C_CREATE:
-		fputs(help_create, stdout);
+		fputs(_(help_create), stdout);
 		break;
 	    case C_DUMP:
-		fputs(help_dump, stdout);
+		fputs(_(help_dump), stdout);
 		break;
 	    case C_INFO:
-		fputs(help_info, stdout);
+		fputs(_(help_info), stdout);
 		break;
 	    case C_RESTORE:
-		fputs(help_restore, stdout);
+		fputs(_(help_restore), stdout);
 		break;
 	    case C_LAST:
-		fputs(help_last, stdout);
+		fputs(_(help_last), stdout);
 		break;
 	    case C_LASTUPDATE:
-		fputs(help_lastupdate, stdout);
+		fputs(_(help_lastupdate), stdout);
 		break;
 	    case C_FIRST:
-		fputs(help_first, stdout);
+		fputs(_(help_first), stdout);
 		break;
 	    case C_UPDATE:
-		fputs(help_update, stdout);
+		fputs(_(help_update), stdout);
 		break;
 	    case C_UPDATEV:
-		fputs(help_updatev, stdout);
+		fputs(_(help_updatev), stdout);
 		break;
 	    case C_FETCH:
-		fputs(help_fetch, stdout);
+		fputs(_(help_fetch), stdout);
 		break;
 	    case C_GRAPH:
-		fputs(help_graph1, stdout);
+		fputs(_(help_graph1), stdout);
 		fputs(help_graph2, stdout);
 		fputs(help_graph3, stdout);
 		break;
 	    case C_TUNE:
-		fputs(help_tune1, stdout);
-		fputs(help_tune2, stdout);
+		fputs(_(help_tune1), stdout);
+		fputs(_(help_tune2), stdout);
 		break;
 	    case C_RESIZE:
-		fputs(help_resize, stdout);
+		fputs(_(help_resize), stdout);
 		break;
 	    case C_XPORT:
-		fputs(help_xport, stdout);
+		fputs(_(help_xport), stdout);
 		break;
 	    case C_QUIT:
-		fputs(help_quit, stdout);
+		fputs(_(help_quit), stdout);
 		break;
 	    case C_LS:
-		fputs(help_ls, stdout);
+		fputs(_(help_ls), stdout);
 		break;
 	    case C_CD:
-		fputs(help_cd, stdout);
+		fputs(_(help_cd), stdout);
 		break;
 	    case C_MKDIR:
-		fputs(help_mkdir, stdout);
+		fputs(_(help_mkdir), stdout);
 		break;
 	    case C_PWD:
-		fputs(help_pwd, stdout);
+		fputs(_(help_pwd), stdout);
 		break;
 	}
-    fputs(help_lic, stdout);
+    fputs(_(help_lic), stdout);
 }
 
 static char *fgetslong(char **aLinePtr, FILE *stream)
@@ -352,6 +366,15 @@ int main(int argc, char *argv[])
 #ifdef MUST_DISABLE_FPMASK
     fpsetmask(0);
 #endif
+#ifdef HAVE_LOCALE_H
+    setlocale (LC_ALL, "");
+#endif
+
+    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+    textdomain (GETTEXT_PACKAGE);
+
+    fpsetmask(0);
     if (argc == 1)
 	{
 	    PrintUsage("");

