Gettext.cc
Go to the documentation of this file.00001
00002
00003
00004
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
00031
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 }
00062 }