File: gsm_nls.h

package info (click to toggle)
gsmlib 1.10+20120414.gita5e5ae9a-0.3
  • links: PTS
  • area: main
  • in suites: buster, sid, stretch
  • size: 3,468 kB
  • ctags: 1,907
  • sloc: cpp: 12,315; sh: 11,376; ansic: 2,366; makefile: 263; sed: 93
file content (71 lines) | stat: -rw-r--r-- 1,417 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// *************************************************************************
// * GSM TA/ME library
// *
// * File:    gsm_nls.h
// *
// * Purpose: Groups macros, initialization and includes
// *          for National Language Support (NLS)
// *
// * Warning: Only include this header from gsmlib .cc-files
// *
// * Author:  Peter Hofmann (software@pxh.de)
// *
// * Created: 3.11.1999
// *************************************************************************

#ifndef GSM_NLS_H
#define GSM_NLS_H

#ifdef HAVE_CONFIG_H
#include <gsm_config.h>
#endif

#ifdef ENABLE_NLS

#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#else
#include "../intl/libintl.h"
#endif
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif

#define _(String) dgettext(PACKAGE, String)

// this causes automatic NLS initialization if one file of the library
// includes gsm_nls.h

namespace gsmlib
{
  const class InitNLS
  {
    static bool initialized;

  public:
    InitNLS()
      {
        if (! initialized)      // do only once
	  {
	    //          setlocale(LC_ALL, ""); /// FIXME LC_ALL deprecated not found but seems to be optional.
#ifdef LOCAL_TRANSLATIONS
	    bindtextdomain(PACKAGE, "../po");
#else
	    bindtextdomain(PACKAGE, LOCALEDIR);
#endif
	    textdomain(PACKAGE);
	    initialized = true;
	  }
      }
  } initNLS;
};

#else

#define _(String) (String)

#endif // ENABLE_NLS

#define N_(String) (String)

#endif // GSM_NLS_H