LiVES  3.2.0
support.c
Go to the documentation of this file.
1 // support.c
2 // LiVES
3 // portions of this file were auto-generated by glade, the remainder is (c) G. Finch (salsaman)
4 
5 // released under the GNU GPL 3 or later
6 // see file ../COPYING or www.gnu.org for licensing details
7 
8 #ifndef IS_SOLARIS
9 #define LIVES_INLINE static inline
10 #define LIVES_GLOBAL_INLINE inline
11 #else
12 #define LIVES_INLINE static
13 #define LIVES_GLOBAL_INLINE
14 #define LIVES_LOCAL_INLINE
15 #endif
16 
17 #include <stdlib.h> // for free()
18 
19 #include "support.h"
20 
21 #ifndef NO_GTK
22 #ifndef lives_locale_to_utf8
23 #include <gtk/gtk.h>
24 #define lives_locale_to_utf8(a, b, c, d, e) g_locale_to_utf8(a, b, c, d, e)
25 #endif
26 #ifndef lives_strdup_printf
27 #define lives_strdup_printf(fmt, ...) g_strdup_printf(fmt, __VA_ARGS__)
28 #endif
29 #endif
30 
31 LIVES_GLOBAL_INLINE char *translate(const char *String) {
32  return lives_locale_to_utf8(dgettext(PACKAGE, String), -1, NULL, NULL, NULL);
33 }
34 
35 LIVES_GLOBAL_INLINE char *translate_with_hash(const char *String) {
36  char *tmp = lives_locale_to_utf8(dgettext(PACKAGE, String), -1, NULL, NULL, NULL);
37  char *txt = lives_strdup_printf("#%s", tmp);
38  free(tmp);
39  return txt;
40 }
41 
42 LIVES_GLOBAL_INLINE char *translate_with_plural(const char *String, const char *StringPlural, unsigned long int n) {
43  return lives_locale_to_utf8(dngettext(PACKAGE, String, StringPlural, n), -1, NULL, NULL, NULL);
44 }
45 
46 LIVES_GLOBAL_INLINE char *translate_with_plural_hash(const char *String, const char *StringPlural, unsigned long int n) {
47  char *tmp = lives_locale_to_utf8(dngettext(PACKAGE, String, StringPlural, n), -1, NULL, NULL, NULL);
48  char *txt = lives_strdup_printf("#%s", tmp);
49  free(tmp);
50  return txt;
51 }
52 
lives_locale_to_utf8
#define lives_locale_to_utf8(a, b, c, d, e)
Definition: support.c:24
translate_with_plural_hash
LIVES_GLOBAL_INLINE char * translate_with_plural_hash(const char *String, const char *StringPlural, unsigned long int n)
Definition: support.c:46
LIVES_GLOBAL_INLINE
#define LIVES_GLOBAL_INLINE
Definition: support.c:10
support.h
dgettext
#define dgettext(Domain, Message)
Definition: support.h:40
translate_with_plural
LIVES_GLOBAL_INLINE char * translate_with_plural(const char *String, const char *StringPlural, unsigned long int n)
Definition: support.c:42
dngettext
#define dngettext(Domain, Message, MsgPlur, n)
Definition: support.h:41
lives_strdup_printf
#define lives_strdup_printf(fmt,...)
Definition: support.c:27
translate_with_hash
LIVES_GLOBAL_INLINE char * translate_with_hash(const char *String)
Definition: support.c:35
translate
LIVES_GLOBAL_INLINE char * translate(const char *String)
Definition: support.c:31