i18n.h

00001 // globals.h                -*-c++-*-
00002 //
00003 //   Copyright (C) 2007 Daniel Burrows
00004 //
00005 //   This program is free software; you can redistribute it and/or
00006 //   modify it under the terms of the GNU General Public License as
00007 //   published by the Free Software Foundation; either version 2 of
00008 //   the License, or (at your option) any later version.
00009 //
00010 //   This program is distributed in the hope that it will be useful,
00011 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 //   General Public License for more details.
00014 //
00015 //   You should have received a copy of the GNU General Public License
00016 //   along with this program; see the file COPYING.  If not, write to
00017 //   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018 //   Boston, MA 02111-1307, USA.
00019 
00020 #ifndef I18N_H
00021 #define I18N_H
00022 
00023 #include <config.h>
00024 
00025 // i18n definitions
00026 
00027 
00028 #ifdef HAVE_LOCALE_H
00029 # include <locale.h>
00030 #endif
00031 #ifndef HAVE_SETLOCALE
00032 inline void setlocale(int, const char *)
00033 {
00034 }
00035 #endif
00036 
00037 #if ENABLE_NLS
00038 # include <libintl.h>
00039 # include <string.h>
00040 # define _(Text) gettext (Text)
00041 # define W_(Text) transcode (gettext (Text) )
00042 # define N_(Text) Text
00043 
00047 #ifdef __GNUG__
00048 __attribute__ ((format_arg(1)))
00049 #endif
00050 inline const char *P_(const char *Text)
00051 {
00052   const char * const translation = gettext(Text);
00053   const char * const stripto = strchr(translation, '|');
00054 
00055   if(stripto == NULL)
00056     return translation;
00057   else
00058     return stripto+1;
00059 }
00060 
00061 #else
00062 # undef bindtextdomain
00063 # define bindtextdomain(Domain, Directory) /* empty */
00064 # undef textdomain
00065 # define textdomain(Domain) /* empty */
00066 # define _(Text) Text
00067 # define N_(Text) Text
00068 inline const char *P_(const char *Text)
00069 {
00070   const char * const stripto = strchr(Text, '|');
00071   return stripto+1;
00072 }
00073 # define gettext(Text) Text
00074 # define dgettext(Domain, Text) Text
00075 #endif
00076 
00077 
00078 #endif // GLOBALS_H

Generated on Thu Oct 22 19:15:31 2009 for cwidget by  doxygen 1.6.1