Ticket #144: rrdtool-6662646-g11n-i18n-ui.diff

File rrdtool-6662646-g11n-i18n-ui.diff, 16.6 KB (added by human, 4 years ago)

Patch for Makefile.am, configure.ac, po/LINGUAS, po/POTFILES.in, rrdtool.spec, src/Makefile.am, src/getopt.c, src/rrd_i18n.h, src/rrd_tool.c

  • rrdtool-1.2.19/Makefile.am

    old new  
    22RSYNC = rsync --rsh=ssh 
    33 
    44# build the following subdirectories 
    5 SUBDIRS = src bindings doc examples 
     5SUBDIRS = po src bindings doc examples 
    66 
    77  # the following files are not mentioned in any other Makefile 
    88EXTRA_DIST = COPYRIGHT CHANGES WIN32-BUILD-TIPS.txt TODO CONTRIBUTORS THREADS \ 
  • rrdtool-1.2.19/configure.ac

    old new char *strchr (), *strrchr (); 
    155155dnl Process Special Options 
    156156dnl ----------------------------------- 
    157157 
     158dnl gettext 
     159GETTEXT_PACKAGE=rrdtool 
     160AC_SUBST(GETTEXT_PACKAGE) 
     161AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package]) 
     162IT_PROG_INTLTOOL([0.35.0]) 
     163 
     164AM_GLIB_GNU_GETTEXT 
     165 
    158166dnl How the vertical axis label is printed 
    159167AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE,  
    160168 [Vertical label angle: 90.0 (default) or 270.0]) 
    CONFIGURE_PART(Checking for Header Files 
    218226dnl Checks for header files. 
    219227AC_HEADER_STDC 
    220228AC_HEADER_DIRENT 
    221 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) 
     229AC_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) 
    222230 
    223231dnl Checks for typedefs, structures, and compiler characteristics. 
    224232AC_C_CONST 
    AC_CONFIG_FILES([examples/4charts.pl]) 
    605614AC_CONFIG_FILES([examples/perftest.pl]) 
    606615AC_CONFIG_FILES([examples/Makefile]) 
    607616AC_CONFIG_FILES([doc/Makefile]) 
     617AC_CONFIG_FILES([po/Makefile.in]) 
    608618AC_CONFIG_FILES([src/Makefile]) 
    609619AC_CONFIG_FILES([bindings/Makefile]) 
    610620AC_CONFIG_FILES([bindings/tcl/Makefile]) 
  • rrdtool-1.2.19/po/LINGUAS

    old new  
     1# 
  • rrdtool-1.2.19/po/POTFILES.in

    old new  
     1src/getopt.c 
     2src/rrd_tool.c 
  • rrdtool-1.2.19/rrdtool.spec

    old new Python RRDtool bindings. 
    7777    configure Makefile.in 
    7878 
    7979%build 
     80intltoolize --automake -c -f 
     81aclocal 
     82autoheader 
     83autoconf 
     84automake -a -c -f 
    8085%configure \ 
    8186    --program-prefix="%{?_program_prefix}" \ 
    8287    --libdir=%{_libdir} \ 
  • rrdtool-1.2.19/src/Makefile.am

    old new fonts_DATA = DejaVuSansMono-Roman.ttf 
    99 
    1010#INCLUDES = $(FREETYPE_INCLUDES) $(ART_INCLUDES) \ 
    1111#           $(PNG_INCLUDES) $(ZLIB_INCLUDES) 
     12INCLUDES = -DLOCALEDIR="\"$(datadir)/locale\"" 
    1213RRD_DEFAULT_FONT=@RRD_DEFAULT_FONT@ 
    1314AM_CPPFLAGS = -DRRD_DEFAULT_FONT=\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=@NUMVERS@ 
    1415 
    noinst_HEADERS = \ 
    5253        unused.h \ 
    5354        rrd_gfx.h \ 
    5455        getopt.h parsetime.h \ 
     56        rrd_i18n.h \ 
    5557        rrd_format.h rrd_tool.h rrd_xport.h rrd.h rrd_hw.h rrd_rpncalc.h \ 
    5658        rrd_nan_inf.h fnv.h rrd_graph.h rrd_afm.h rrd_afm_data.h \ 
    5759        rrd_is_thread_safe.h 
  • rrdtool-1.2.19/src/getopt.c

    old new  
    3434#include "../rrd_config.h" 
    3535#endif 
    3636 
     37#include "rrd_i18n.h" 
     38 
    3739#if !defined (__STDC__) || !__STDC__ 
    3840/* This is a separate conditional since some stdc systems 
    3941   reject `defined (const)'.  */ 
     
    8587#define getpid() GetCurrentProcessId() 
    8688#endif 
    8789 
    88 #ifndef _ 
    89 /* This is for other GNU distributions with internationalized messages. 
    90    When compiling libc, the _ macro is predefined.  */ 
    91 #ifdef HAVE_LIBINTL_H 
    92 # include <libintl.h> 
    93 # define _(msgid)       gettext (msgid) 
    94 #else 
    95 # define _(msgid)       (msgid) 
    96 #endif 
    97 #endif 
    98  
    9990/* This version of `getopt' appears to the caller like standard Unix `getopt' 
    10091   but it behaves differently for the user, since it allows the user 
    10192   to intersperse the options with the other arguments. 
  • rrdtool-1.2.19/src/rrd_i18n.h

    old new  
     1/***************************************************************************** 
     2 * RRDtool 1.2.19  Copyright by Takao Fujiwara, 2008 
     3 ***************************************************************************** 
     4 * rrd_i18n.h   Common Header File 
     5 *****************************************************************************/ 
     6#ifdef  __cplusplus 
     7extern "C" { 
     8#endif 
     9 
     10 
     11#ifndef _RRD_I18N_H 
     12#define _RRD_I18N_H 
     13 
     14#ifndef _ 
     15/* This is for other GNU distributions with internationalized messages. 
     16   When compiling libc, the _ macro is predefined.  */ 
     17#ifdef HAVE_LIBINTL_H 
     18#  include <libintl.h> 
     19#define _(String) gettext (String) 
     20#else 
     21#define _(String) (String) 
     22#endif 
     23#define N_(String) (String) 
     24#endif 
     25 
     26 
     27#endif 
     28 
     29#ifdef  __cplusplus 
     30} 
     31#endif 
  • rrdtool-1.2.19/src/rrd_tool.c

    old new  
    44 * rrd_tool.c  Startup wrapper 
    55 *****************************************************************************/ 
    66 
     7#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H) 
     8#include "../win32/config.h" 
     9#else 
     10#ifdef HAVE_CONFIG_H 
     11#include "../rrd_config.h" 
     12#endif 
     13#endif 
     14 
    715#include "rrd_tool.h" 
    816#include "rrd_xport.h" 
     17#include "rrd_i18n.h" 
     18 
     19#ifdef HAVE_LOCALE_H 
     20#include <locale.h> 
     21#endif 
    922 
    1023void PrintUsage(char *cmd); 
    1124int CountArgs(char *aLine); 
    void PrintUsage(char *cmd) 
    2235{ 
    2336 
    2437    char help_main[] = 
    25            "RRDtool " PACKAGE_VERSION "  Copyright 1997-2007 by Tobias Oetiker <tobi@oetiker.ch>\n" 
    26            "               Compiled " __DATE__ " " __TIME__ "\n\n" 
    27            "Usage: rrdtool [options] command command_options\n\n"; 
     38           N_("RRDtool %s  Copyright 1997-2007 by Tobias Oetiker <tobi@oetiker.ch>\n" 
     39           "               Compiled %s %s\n\n" 
     40           "Usage: rrdtool [options] command command_options\n\n"); 
    2841 
    2942    char help_list[] = 
    30            "Valid commands: create, update, updatev, graph, dump, restore,\n" 
     43           N_("Valid commands: create, update, updatev, graph, dump, restore,\n" 
    3144           "\t\tlast, lastupdate, first, info, fetch, tune,\n" 
    32            " resize, xport\n\n"; 
     45           " resize, xport\n\n"); 
    3346 
    3447    char help_listremote[] = 
    35            "Valid remote commands: quit, ls, cd, mkdir, pwd\n\n"; 
     48           N_("Valid remote commands: quit, ls, cd, mkdir, pwd\n\n"); 
    3649 
    3750 
    3851    char help_create[] = 
    39            "* create - create a new RRD\n\n" 
     52           N_("* create - create a new RRD\n\n" 
    4053           "\trrdtool create filename [--start|-b start time]\n" 
    4154           "\t\t[--step|-s step]\n" 
    4255           "\t\t[DS:ds-name:DST:dst arguments]\n"  
    43            "\t\t[RRA:CF:cf arguments]\n\n"; 
     56           "\t\t[RRA:CF:cf arguments]\n\n"); 
    4457 
    4558    char help_dump[] = 
    46            "* dump - dump an RRD to XML\n\n" 
    47            "\trrdtool dump filename.rrd >filename.xml\n\n"; 
     59           N_("* dump - dump an RRD to XML\n\n" 
     60           "\trrdtool dump filename.rrd >filename.xml\n\n"); 
    4861 
    4962    char help_info[] = 
    50            "* info - returns the configuration and status of the RRD\n\n" 
    51            "\trrdtool info filename.rrd\n\n"; 
     63           N_("* info - returns the configuration and status of the RRD\n\n" 
     64           "\trrdtool info filename.rrd\n\n"); 
    5265 
    5366    char help_restore[] = 
    54            "* restore - restore an RRD file from its XML form\n\n" 
    55            "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n"; 
     67           N_("* restore - restore an RRD file from its XML form\n\n" 
     68           "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n"); 
    5669 
    5770    char help_last[] = 
    58            "* last - show last update time for RRD\n\n" 
    59            "\trrdtool last filename.rrd\n\n"; 
     71           N_("* last - show last update time for RRD\n\n" 
     72           "\trrdtool last filename.rrd\n\n"); 
    6073 
    6174    char help_lastupdate[] = 
    62           "* lastupdate - returns the most recent datum stored for\n" 
     75          N_("* lastupdate - returns the most recent datum stored for\n" 
    6376          "  each DS in an RRD\n\n" 
    64           "\trrdtool lastupdate filename.rrd\n\n";  
     77          "\trrdtool lastupdate filename.rrd\n\n"); 
    6578 
    6679    char help_first[] = 
    67            "* first - show first update time for RRA within an RRD\n\n" 
    68            "\trrdtool first filename.rrd [--rraindex number]\n\n"; 
     80           N_("* first - show first update time for RRA within an RRD\n\n" 
     81           "\trrdtool first filename.rrd [--rraindex number]\n\n"); 
    6982 
    7083    char help_update[] = 
    71            "* update - update an RRD\n\n" 
     84           N_("* update - update an RRD\n\n" 
    7285           "\trrdtool update filename\n" 
    7386           "\t\t--template|-t ds-name:ds-name:...\n" 
    7487           "\t\ttime|N:value[:value...]\n\n" 
    7588           "\t\tat-time@value[:value...]\n\n" 
    76            "\t\t[ time:value[:value...] ..]\n\n"; 
     89           "\t\t[ time:value[:value...] ..]\n\n"); 
    7790     
    7891        char help_updatev[] = 
    79            "* updatev - a verbose version of update\n" 
     92           N_("* updatev - a verbose version of update\n" 
    8093           "\treturns information about values, RRAs, and datasources updated\n\n" 
    8194           "\trrdtool updatev filename\n" 
    8295           "\t\t--template|-t ds-name:ds-name:...\n" 
    8396           "\t\ttime|N:value[:value...]\n\n" 
    8497           "\t\tat-time@value[:value...]\n\n" 
    85            "\t\t[ time:value[:value...] ..]\n\n"; 
     98           "\t\t[ time:value[:value...] ..]\n\n"); 
    8699  
    87100    char help_fetch[] = 
    88            "* fetch - fetch data out of an RRD\n\n" 
     101           N_("* fetch - fetch data out of an RRD\n\n" 
    89102           "\trrdtool fetch filename.rrd CF\n" 
    90103           "\t\t[-r|--resolution resolution]\n" 
    91            "\t\t[-s|--start start] [-e|--end end]\n\n"; 
     104           "\t\t[-s|--start start] [-e|--end end]\n\n"); 
    92105 
    93106/* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/ 
    94107 
    95108    char help_graph1[] = 
    96            "* graph - generate a graph from one or several RRD\n\n" 
     109           N_("* graph - generate a graph from one or several RRD\n\n" 
    97110           "\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n" 
    98111           "\t\t[-x|--x-grid x-axis grid and label]\n" 
    99112           "\t\t[-Y|--alt-y-grid]\n" 
    void PrintUsage(char *cmd) 
    104117           "\t\t[-l|--lower-limit value] [-r|--rigid]\n" 
    105118           "\t\t[-g|--no-legend]\n" 
    106119           "\t\t[-F|--force-rules-legend]\n" 
    107            "\t\t[-j|--only-graph]\n"; 
     120           "\t\t[-j|--only-graph]\n"); 
    108121    char help_graph2[] = 
    109122           "\t\t[-n|--font FONTTAG:size:font]\n" 
    110123           "\t\t[-m|--zoom factor]\n"        
    void PrintUsage(char *cmd) 
    139152           "\t\t[STACK:vname[#rrggbb[aa][:legend]]] (deprecated)\n\n"; 
    140153 
    141154    char help_tune1[] = 
    142            " * tune -  Modify some basic properties of an RRD\n\n" 
     155           N_(" * tune -  Modify some basic properties of an RRD\n\n" 
    143156           "\trrdtool tune filename\n" 
    144157           "\t\t[--heartbeat|-h ds-name:heartbeat]\n" 
    145158           "\t\t[--data-source-type|-d ds-name:DST]\n" 
    void PrintUsage(char *cmd) 
    148161           "\t\t[--deltapos scale-value] [--deltaneg scale-value]\n" 
    149162           "\t\t[--failure-threshold integer]\n" 
    150163           "\t\t[--window-length integer]\n" 
    151            "\t\t[--alpha adaptation-parameter]\n"; 
     164           "\t\t[--alpha adaptation-parameter]\n"); 
    152165    char help_tune2[] = 
    153            " * tune -  Modify some basic properties of an RRD\n\n" 
     166           N_(" * tune -  Modify some basic properties of an RRD\n\n" 
    154167           "\t\t[--beta adaptation-parameter]\n" 
    155168           "\t\t[--gamma adaptation-parameter]\n" 
    156169           "\t\t[--gamma-deviation adaptation-parameter]\n" 
    157            "\t\t[--aberrant-reset ds-name]\n\n"; 
     170           "\t\t[--aberrant-reset ds-name]\n\n"); 
    158171 
    159172    char help_resize[] = 
    160            " * resize - alter the length of one of the RRAs in an RRD\n\n" 
    161            "\trrdtool resize filename rranum GROW|SHRINK rows\n\n"; 
     173           N_(" * resize - alter the length of one of the RRAs in an RRD\n\n" 
     174           "\trrdtool resize filename rranum GROW|SHRINK rows\n\n"); 
    162175 
    163176    char help_xport[] = 
    164            "* xport - generate XML dump from one or several RRD\n\n" 
     177           N_("* xport - generate XML dump from one or several RRD\n\n" 
    165178           "\trrdtool xport [-s|--start seconds] [-e|--end seconds]\n" 
    166179           "\t\t[-m|--maxrows rows]\n" 
    167180           "\t\t[--step seconds]\n"         
    168181           "\t\t[--enumds]\n"       
    169182           "\t\t[DEF:vname=rrd:ds-name:CF]\n" 
    170183           "\t\t[CDEF:vname=rpn-expression]\n" 
    171            "\t\t[XPORT:vname:legend]\n\n"; 
     184           "\t\t[XPORT:vname:legend]\n\n"); 
    172185 
    173186    char help_quit[] = 
    174            " * quit - closing a session in remote mode\n\n" 
    175            "\trrdtool quit\n\n"; 
     187           N_(" * quit - closing a session in remote mode\n\n" 
     188           "\trrdtool quit\n\n"); 
    176189 
    177190    char help_ls[] = 
    178            " * ls - lists all *.rrd files in current directory\n\n" 
    179            "\trrdtool ls\n\n"; 
     191           N_(" * ls - lists all *.rrd files in current directory\n\n" 
     192           "\trrdtool ls\n\n"); 
    180193 
    181194    char help_cd[] = 
    182            " * cd - changes the current directory\n\n" 
    183            "\trrdtool cd new directory\n\n"; 
     195           N_(" * cd - changes the current directory\n\n" 
     196           "\trrdtool cd new directory\n\n"); 
    184197 
    185198    char help_mkdir[] = 
    186            " * mkdir - creates a new directory\n\n" 
    187            "\trrdtool mkdir newdirectoryname\n\n"; 
     199           N_(" * mkdir - creates a new directory\n\n" 
     200           "\trrdtool mkdir newdirectoryname\n\n"); 
    188201 
    189202    char help_pwd[] = 
    190            " * pwd - returns the current working directory\n\n" 
    191            "\trrdtool pwd\n\n"; 
     203           N_(" * pwd - returns the current working directory\n\n" 
     204           "\trrdtool pwd\n\n"); 
    192205 
    193206    char help_lic[] = 
    194            "RRDtool is distributed under the Terms of the GNU General\n" 
     207           N_("RRDtool is distributed under the Terms of the GNU General\n" 
    195208           "Public License Version 2. (www.gnu.org/copyleft/gpl.html)\n\n" 
    196209 
    197            "For more information read the RRD manpages\n\n"; 
     210           "For more information read the RRD manpages\n\n"); 
    198211 
    199212    enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST, 
    200213           C_LASTUPDATE, C_FIRST, C_UPDATE, C_FETCH, C_GRAPH, C_TUNE, 
    void PrintUsage(char *cmd) 
    244257            else if (!strcmp(cmd,"pwd")) 
    245258                help_cmd = C_PWD; 
    246259        } 
    247     fputs(help_main, stdout); 
     260    fprintf(stdout, _(help_main), PACKAGE_VERSION, __DATE__, __TIME__); 
     261    fflush (stdout); 
    248262    switch (help_cmd) 
    249263        { 
    250264            case C_NONE: 
    251                 fputs(help_list, stdout); 
     265                fputs(_(help_list), stdout); 
    252266                if (RemoteMode){ 
    253                    fputs(help_listremote, stdout); 
     267                   fputs(_(help_listremote), stdout); 
    254268                } 
    255269                break; 
    256270            case C_CREATE: 
    257                 fputs(help_create, stdout); 
     271                fputs(_(help_create), stdout); 
    258272                break; 
    259273            case C_DUMP: 
    260                 fputs(help_dump, stdout); 
     274                fputs(_(help_dump), stdout); 
    261275                break; 
    262276            case C_INFO: 
    263                 fputs(help_info, stdout); 
     277                fputs(_(help_info), stdout); 
    264278                break; 
    265279            case C_RESTORE: 
    266                 fputs(help_restore, stdout); 
     280                fputs(_(help_restore), stdout); 
    267281                break; 
    268282            case C_LAST: 
    269                 fputs(help_last, stdout); 
     283                fputs(_(help_last), stdout); 
    270284                break; 
    271285            case C_LASTUPDATE: 
    272                 fputs(help_lastupdate, stdout); 
     286                fputs(_(help_lastupdate), stdout); 
    273287                break; 
    274288            case C_FIRST: 
    275                 fputs(help_first, stdout); 
     289                fputs(_(help_first), stdout); 
    276290                break; 
    277291            case C_UPDATE: 
    278                 fputs(help_update, stdout); 
     292                fputs(_(help_update), stdout); 
    279293                break; 
    280294            case C_UPDATEV: 
    281                 fputs(help_updatev, stdout); 
     295                fputs(_(help_updatev), stdout); 
    282296                break; 
    283297            case C_FETCH: 
    284                 fputs(help_fetch, stdout); 
     298                fputs(_(help_fetch), stdout); 
    285299                break; 
    286300            case C_GRAPH: 
    287                 fputs(help_graph1, stdout); 
     301                fputs(_(help_graph1), stdout); 
    288302                fputs(help_graph2, stdout); 
    289303                fputs(help_graph3, stdout); 
    290304                break; 
    291305            case C_TUNE: 
    292                 fputs(help_tune1, stdout); 
    293                 fputs(help_tune2, stdout); 
     306                fputs(_(help_tune1), stdout); 
     307                fputs(_(help_tune2), stdout); 
    294308                break; 
    295309            case C_RESIZE: 
    296                 fputs(help_resize, stdout); 
     310                fputs(_(help_resize), stdout); 
    297311                break; 
    298312            case C_XPORT: 
    299                 fputs(help_xport, stdout); 
     313                fputs(_(help_xport), stdout); 
    300314                break; 
    301315            case C_QUIT: 
    302                 fputs(help_quit, stdout); 
     316                fputs(_(help_quit), stdout); 
    303317                break; 
    304318            case C_LS: 
    305                 fputs(help_ls, stdout); 
     319                fputs(_(help_ls), stdout); 
    306320                break; 
    307321            case C_CD: 
    308                 fputs(help_cd, stdout); 
     322                fputs(_(help_cd), stdout); 
    309323                break; 
    310324            case C_MKDIR: 
    311                 fputs(help_mkdir, stdout); 
     325                fputs(_(help_mkdir), stdout); 
    312326                break; 
    313327            case C_PWD: 
    314                 fputs(help_pwd, stdout); 
     328                fputs(_(help_pwd), stdout); 
    315329                break; 
    316330        } 
    317     fputs(help_lic, stdout); 
     331    fputs(_(help_lic), stdout); 
    318332} 
    319333 
    320334static char *fgetslong(char **aLinePtr, FILE *stream) 
    int main(int argc, char *argv[]) 
    352366#ifdef MUST_DISABLE_FPMASK 
    353367    fpsetmask(0); 
    354368#endif 
     369#ifdef HAVE_LOCALE_H 
     370    setlocale (LC_ALL, ""); 
     371#endif 
     372 
     373    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); 
     374    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); 
     375    textdomain (GETTEXT_PACKAGE); 
     376 
     377    fpsetmask(0); 
    355378    if (argc == 1) 
    356379        { 
    357380            PrintUsage(""); 

NOTE: The content of this website is accessible with any browser. The graphical design though relies completely on CSS2 styles. If you see this text, this means that your browser does not support CSS2. Consider upgrading to a standard conformant browser like Mozilla Firefox or Opera but also Apple's Safari or KDE's Konqueror for example. It may also be that you are looking at a mirror page which did not copy the CSS for this page. Or if some pictu res are missing, then the mirror may not have picked up the contents of the inc directory.