From cc8367f974cc1c3b8d8f301c7916231135414d63 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 5 Nov 2011 10:24:42 +0100 Subject: gettext is in i18n now, has nothing to do with porting --- include/wolf/i18n/gettext.h | 93 +++++++++++++++++++++++++++++++++++++++++++++ include/wolf/port/gettext.h | 93 --------------------------------------------- 2 files changed, 93 insertions(+), 93 deletions(-) create mode 100644 include/wolf/i18n/gettext.h delete mode 100644 include/wolf/port/gettext.h (limited to 'include') diff --git a/include/wolf/i18n/gettext.h b/include/wolf/i18n/gettext.h new file mode 100644 index 0000000..3d4a4f9 --- /dev/null +++ b/include/wolf/i18n/gettext.h @@ -0,0 +1,93 @@ +/* + Copyright (C) 2008 Andreas Baumann + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef WOLF_GETTEXT_H +#define WOLF_GETTEXT_H + +/** + * @addtogroup wolf_port Porting + * @{ + */ + +/** + * @file gettext.h + * @brief localization header, nivelating some problems in gettext/libintl + * @author Andreas Baumann + */ + +/* some distributors like to disable NLS */ +#if ENABLE_NLS + +/* Some older versions of libintl.h make tests for the value __APPLE_CC though + * this macro can be undefined! Nice, defining it here as 0. + * (Noticed on OpenBSD 4.3) + */ +#if !defined( __APPLE_CC ) +#define __APPLE_CC__ 0 +#endif + +/* define a proper prototype with format_arg so that gcc doesn't croak. This + * is a problem on systems which have an onlder libintl.h where the declarations + * are missing. So we define a first prototype here and hope the compiler survives + * the redefiniton in libintl.h but for a format_arg (urgh!). Experienced only + * on NetBSD 4.1 + */ +#if defined __GNUC__ +#if defined GETTEXT_NEEDS_FORMAT_ARG +char *gettext( const char *__msgid ) __attribute__ ( ( format_arg ( 1 ) ) ); +char *libintl_gettext( const char *__msgid ) __attribute__ ( ( format_arg ( 1 ) ) ); +char *dgettext( const char *__domainname, const char *__msgid ) __attribute__ ( ( format_arg ( 2 ) ) ); +char *libintl_dgettext( const char *__domainname, const char *__msgid ) __attribute__ ( ( format_arg ( 2 ) ) ); +#endif +#endif + +#include /* for gettext, bindtextdomain */ + +#include /* for setlocale */ + +/** It's much easier to define a DEFAULT_TEXT_DOMAIN and map gettext to a + * dgettext, so that we don't have to call 'textdomain' anywhere in the + * library. Define this before including gettext.h + */ +#if defined DEFAULT_TEXT_DOMAIN +#undef gettext +#define gettext( msgid ) dgettext( DEFAULT_TEXT_DOMAIN, msgid ) +#endif /* defined DEFAULT_TEXT_DOMAIN */ + +#else /* ENABLE_NLS */ + +#define gettext( msgid ) ( (const char *)( msgid ) ) +#define LC_ALL 1 +#define setlocale( category, loc ) ( NULL ) +#define bindtextdomain( domain, directory ) ( NULL ) +#define textdomain( domain )( NULL ) + +#endif /* ENABLE_NLS */ + +/* a noop marker which let's xgettext extract the message but doesn't + * call the gettext() function if NLS is enabled. + */ +#define gettext_noop( s ) s + +/* shorthand macro for lazy people */ +#define _( s ) gettext( s ) + +void wolf_port_initialize_i18n( const char *argv0, const char *app ); + +/** @} */ /* @addtogroup wolf_port */ + +#endif /* ifndef WOLF_GETTEXT_H */ diff --git a/include/wolf/port/gettext.h b/include/wolf/port/gettext.h deleted file mode 100644 index 3d4a4f9..0000000 --- a/include/wolf/port/gettext.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2008 Andreas Baumann - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef WOLF_GETTEXT_H -#define WOLF_GETTEXT_H - -/** - * @addtogroup wolf_port Porting - * @{ - */ - -/** - * @file gettext.h - * @brief localization header, nivelating some problems in gettext/libintl - * @author Andreas Baumann - */ - -/* some distributors like to disable NLS */ -#if ENABLE_NLS - -/* Some older versions of libintl.h make tests for the value __APPLE_CC though - * this macro can be undefined! Nice, defining it here as 0. - * (Noticed on OpenBSD 4.3) - */ -#if !defined( __APPLE_CC ) -#define __APPLE_CC__ 0 -#endif - -/* define a proper prototype with format_arg so that gcc doesn't croak. This - * is a problem on systems which have an onlder libintl.h where the declarations - * are missing. So we define a first prototype here and hope the compiler survives - * the redefiniton in libintl.h but for a format_arg (urgh!). Experienced only - * on NetBSD 4.1 - */ -#if defined __GNUC__ -#if defined GETTEXT_NEEDS_FORMAT_ARG -char *gettext( const char *__msgid ) __attribute__ ( ( format_arg ( 1 ) ) ); -char *libintl_gettext( const char *__msgid ) __attribute__ ( ( format_arg ( 1 ) ) ); -char *dgettext( const char *__domainname, const char *__msgid ) __attribute__ ( ( format_arg ( 2 ) ) ); -char *libintl_dgettext( const char *__domainname, const char *__msgid ) __attribute__ ( ( format_arg ( 2 ) ) ); -#endif -#endif - -#include /* for gettext, bindtextdomain */ - -#include /* for setlocale */ - -/** It's much easier to define a DEFAULT_TEXT_DOMAIN and map gettext to a - * dgettext, so that we don't have to call 'textdomain' anywhere in the - * library. Define this before including gettext.h - */ -#if defined DEFAULT_TEXT_DOMAIN -#undef gettext -#define gettext( msgid ) dgettext( DEFAULT_TEXT_DOMAIN, msgid ) -#endif /* defined DEFAULT_TEXT_DOMAIN */ - -#else /* ENABLE_NLS */ - -#define gettext( msgid ) ( (const char *)( msgid ) ) -#define LC_ALL 1 -#define setlocale( category, loc ) ( NULL ) -#define bindtextdomain( domain, directory ) ( NULL ) -#define textdomain( domain )( NULL ) - -#endif /* ENABLE_NLS */ - -/* a noop marker which let's xgettext extract the message but doesn't - * call the gettext() function if NLS is enabled. - */ -#define gettext_noop( s ) s - -/* shorthand macro for lazy people */ -#define _( s ) gettext( s ) - -void wolf_port_initialize_i18n( const char *argv0, const char *app ); - -/** @} */ /* @addtogroup wolf_port */ - -#endif /* ifndef WOLF_GETTEXT_H */ -- cgit v1.2.3-54-g00ecf