source: trunk/debathena/third/schroot/sbuild/sbuild-i18n.h @ 24167

Revision 24167, 2.4 KB checked in by broder, 15 years ago (diff)
Import schroot upstream into subversion.
RevLine 
[24167]1/* Copyright © 2005-2007  Roger Leigh <rleigh@debian.org>
2 *
3 * schroot is free software: you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * schroot is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program.  If not, see
15 * <http://www.gnu.org/licenses/>.
16 *
17 *********************************************************************/
18
19/**
20 * @file sbuild-i18n.h Internationalisation functions.  This header
21 * defines the functions used to mark up and translate strings.
22 */
23
24#ifndef SBUILD_I18N_H
25#define SBUILD_I18N_H
26
27#include <sbuild/sbuild-config.h>
28
29#include <libintl.h>
30
31// Undefine macros which would interfere with our functions.
32#ifdef gettext
33#undef gettext
34#endif
35#ifdef _
36#undef _
37#endif
38#ifdef gettext_noop
39#undef gettext_noop
40#endif
41#ifdef N_
42#undef N_
43#endif
44
45namespace sbuild
46{
47  /**
48   * Get a translated message.
49   *
50   * @param message the message to translate.
51   * @returns the translated message.
52   */
53  inline const char *
54  gettext (const char *message)
55  {
56    return dgettext (SBUILD_MESSAGE_CATALOGUE, message);
57  }
58
59  /**
60   * Get a translated message.  This function is a shorthand for
61   * gettext, which also marks up the string for translation.
62   *
63   * @param message the message to translate.
64   * @returns the translated message.
65   */
66  inline const char *
67  _ (const char *message)
68  {
69    return gettext (message);
70  }
71
72  /**
73   * Get a message with no translation.
74   *
75   * @param message the message to not translate.
76   * @returns the message.
77   */
78  inline const char *
79  gettext_noop (const char *message)
80  {
81    return message;
82  }
83
84  /**
85   * Get a message with no translation.  This macro is a shorthand for
86   * gettext_noop, which also marks up the string for translation.
87   *
88   * @param message the message to not translate.
89   * @returns the message.
90   */
91  inline const char *
92  N_ (const char *message)
93  {
94    return gettext_noop (message);
95  }
96
97}
98
99#endif /* SBUILD_I18N_H */
100
101/*
102 * Local Variables:
103 * mode:C++
104 * End:
105 */
Note: See TracBrowser for help on using the repository browser.