From c5acd7cc43db6a08ae364fd9f9bc05c0455c4859 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 19 Aug 2001 01:27:33 +0000 Subject: [PATCH] gettextization of error messages --- lib/error.c | 20 ++++++++++---------- lib/libinternal.h | 11 ++++++++++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/error.c b/lib/error.c index 3d52c33..8d98de0 100644 --- a/lib/error.c +++ b/lib/error.c @@ -28,15 +28,15 @@ #include char *__comedilib_error_strings[]={ - "No error", - "Unknown error", - "Bad comedi_t structure", - "Invalid subdevice", - "Invalid channel", - "Buffer overflow", - "Buffer underflow", - "Command not supported", - "Not supported", + _s("No error"), + _s("Unknown error"), + _s("Bad comedi_t structure"), + _s("Invalid subdevice"), + _s("Invalid channel"), + _s("Buffer overflow"), + _s("Buffer underflow"), + _s("Command not supported"), + _s("Not supported"), }; #define n_errors (sizeof(__comedilib_error_strings)/sizeof(void *)) @@ -62,7 +62,7 @@ char *comedi_strerror(int errnum) if(errnum=COMEDI_NOERROR+n_errors) return strerror(errnum); - return __comedilib_error_strings[errnum-COMEDI_NOERROR]; + return _(__comedilib_error_strings[errnum-COMEDI_NOERROR]); } void comedi_perror(const char *s) diff --git a/lib/libinternal.h b/lib/libinternal.h index 718f67a..6010984 100644 --- a/lib/libinternal.h +++ b/lib/libinternal.h @@ -31,14 +31,23 @@ #include #include #include +#include #include - /* This indicates a symbol that should not be exported as part of * the library. But I don't know how to make it useful yet. */ #define INTERNAL +/* gettext()ization */ + +#ifdef I18N +#define _(a) gettext((a)) +#else +#define _(a) (a) +#endif +#define _s(a) (a) + #define debug_ptr(a) if(!(a))fprintf(stderr," ** NULL pointer: " __FILE__ ", line %d\n",__LINE__); #define debug_int(a) if((a)<0)fprintf(stderr," ** error: " __FILE__ ", line %d\n",__LINE__); -- 2.26.2