libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifdef HAVE_CONFIG_H 00013 #include "config.h" 00014 #endif 00015 00016 extern "C" { 00017 #include <libintl.h> 00018 } 00019 00020 #include "zypp/base/Gettext.h" 00021 00023 namespace zypp 00024 { 00025 00026 namespace gettext 00027 { 00028 00030 // TEXTDOMAIN and LOCALEDIR must be provided via config.h 00031 // or at compile time using -D. 00033 00034 inline void assertInit() 00035 { 00036 static bool initialized = false; 00037 if ( ! initialized ) 00038 { 00039 ::bindtextdomain( TEXTDOMAIN, LOCALEDIR ); 00040 ::bind_textdomain_codeset( TEXTDOMAIN, "UTF-8" ); 00041 initialized = true; 00042 } 00043 } 00044 00045 const char * dgettext( const char * msgid ) 00046 { 00047 assertInit(); 00048 return ::dgettext( TEXTDOMAIN, msgid ); 00049 } 00050 00051 const char * dngettext( const char * msgid1, const char * msgid2, 00052 unsigned long n ) 00053 { 00054 assertInit(); 00055 return ::dngettext( TEXTDOMAIN, msgid1, msgid2, n ); 00056 } 00057 00059 } // namespace gettext 00062 } // namespace zypp