Imported Upstream version 17.14.0
[platform/upstream/libzypp.git] / zypp / base / Gettext.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/base/Gettext.h
10  *
11  * Interface to gettext.
12  *
13 */
14 #ifndef ZYPP_BASE_GETTEXT_H
15 #define ZYPP_BASE_GETTEXT_H
16
17 #ifdef ZYPP_DLL //defined if zypp is compiled as DLL
18
19 /** Just tag text for translation. */
20 #undef N_
21 #define N_(MSG) MSG
22
23 /** Return translated text. */
24 #undef _
25 #define _(MSG) ::zypp::gettext::dgettext( MSG )
26
27 /** Return translated text (plural form). */
28 #undef PL_
29 #define PL_(MSG1,MSG2,N) ::zypp::gettext::dngettext( MSG1, MSG2, N )
30
31 #else
32
33 #ifndef N_
34 #define N_(MSG) MSG
35 #endif
36 #ifndef _
37 #define _(MSG) ::gettext( MSG )
38 #endif
39 #ifndef PL_
40 #define PL_(MSG1,MSG2,N) ::ngettext( MSG1, MSG2, N )
41 #endif
42
43 #endif
44
45 ///////////////////////////////////////////////////////////////////
46 namespace zypp
47 { /////////////////////////////////////////////////////////////////
48   ///////////////////////////////////////////////////////////////////
49   namespace gettext
50   { /////////////////////////////////////////////////////////////////
51
52     /** Return translated text. */
53     const char * dgettext( const char * msgid );
54
55     /** Return translated text (plural form). */
56     const char * dngettext( const char * msgid1, const char * msgid2,
57                             unsigned long n );
58
59     /////////////////////////////////////////////////////////////////
60   } // namespace gettext
61   ///////////////////////////////////////////////////////////////////
62   /////////////////////////////////////////////////////////////////
63 } // namespace zypp
64 ///////////////////////////////////////////////////////////////////
65 #endif // ZYPP_BASE_GETTEXT_H