1 /* $Id$ */
2 /*-
3  * Copyright (c) 2003-2006 Benedikt Meurer <benny@xfce.org>
4  * Copyright (c) 2004      Jasper Huijsman <jasper@xfce.org>
5  * All rights reserved.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301 USA
21  */
22 
23 #if !defined(LIBXFCE4UTIL_INSIDE_LIBXFCE4UTIL_H) && !defined(LIBXFCE4UTIL_COMPILATION)
24 #error "Only <libxfce4util/libxfce4util.h> can be included directly, this file may disappear or change contents"
25 #endif
26 
27 #ifndef __XFCE_I18N_H__
28 #define __XFCE_I18N_H__
29 
30 #include <glib.h>
31 
32 #if defined(GETTEXT_PACKAGE)
33 #include <glib/gi18n-lib.h>
34 #else
35 #include <glib/gi18n.h>
36 #endif
37 
38 #if !defined(GETTEXT_PACKAGE)
39 
40 #ifdef gettext
41 #undef gettext
42 #endif
43 #ifdef dgettext
44 #undef dgettext
45 #endif
46 #ifdef dcgettext
47 #undef dcgettext
48 #endif
49 #ifdef ngettext
50 #undef ngettext
51 #endif
52 #ifdef dngettext
53 #undef dngettext
54 #endif
55 #ifdef dcngettext
56 #undef dcngettext
57 #endif
58 
59 #define gettext(s)                                            (s)
60 #define dgettext(domain,s)                                    (s)
61 #define dcgettext(domain,s,type)                              (s)
62 #define ngettext(msgid, msgid_plural, n)                      (((n) > 0) ? (msgid) : (msgid_plural))
63 #define dngettext(domainname, msgid, msgid_plural, n)         (((n) > 0) ? (msgid) : (msgid_plural))
64 #define dcngettext(domainname, msgid, msgid_plural, n, type)  (((n) > 0) ? (msgid) : (msgid_plural))
65 
66 #endif /* !defined(GETTEXT_PACKAGE) */
67 
68 void                  xfce_textdomain           (const gchar *package,
69                                                  const gchar *localedir,
70                                                  const gchar *encoding);
71 
72 gchar*                xfce_get_file_localized   (const gchar *filename) G_GNUC_MALLOC;
73 gchar*                xfce_get_file_localized_r (gchar       *buffer,
74                                                  gsize        length,
75                                                  const gchar *filename);
76 
77 gchar*                xfce_get_dir_localized    (const gchar *directory) G_GNUC_MALLOC;
78 gchar*                xfce_get_dir_localized_r  (gchar       *buffer,
79                                                  gsize        length,
80                                                  const gchar *directory);
81 
82 gchar*                xfce_get_path_localized   (gchar       *dst,
83                                                  gsize        size,
84                                                  const gchar *paths,
85                                                  const gchar *filename,
86                                                  GFileTest    test);
87 
88 #define XFCE_LOCALE_FULL_MATCH 50
89 #define XFCE_LOCALE_NO_MATCH    0
90 
91 guint                 xfce_locale_match         (const gchar *locale1,
92                                                  const gchar *locale2);
93 
94 #endif  /* !__XFCE_I18N_H__ */
95