1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8)
9
10var xDcgettext func(uintptr, string, int) string
11
12// This is a variant of g_dgettext() that allows specifying a locale
13// category instead of always using `LC_MESSAGES`. See g_dgettext() for
14// more information about how this functions differs from calling
15// dcgettext() directly.
16func Dcgettext(DomainVar *string, MsgidVar string, CategoryVar int) string {
17
18 DomainVarPtr := core.GStrdupNullable(DomainVar)
19 defer core.GFreeNullable(DomainVarPtr)
20
21 cret := xDcgettext(DomainVarPtr, MsgidVar, CategoryVar)
22
23 return cret
24}
25
26var xDgettext func(uintptr, string) string
27
28// This function is a wrapper of dgettext() which does not translate
29// the message if the default domain as set with textdomain() has no
30// translations for the current locale.
31//
32// The advantage of using this function over dgettext() proper is that
33// libraries using this function (like GTK) will not use translations
34// if the application using the library does not have translations for
35// the current locale. This results in a consistent English-only
36// interface instead of one having partial translations. For this
37// feature to work, the call to textdomain() and setlocale() should
38// precede any g_dgettext() invocations. For GTK, it means calling
39// textdomain() before gtk_init or its variants.
40//
41// This function disables translations if and only if upon its first
42// call all the following conditions hold:
43//
44// - @domain is not %NULL
45//
46// - textdomain() has been called to set a default text domain
47//
48// - there is no translations available for the default text domain
49// and the current locale
50//
51// - current locale is not "C" or any English locales (those
52// starting with "en_")
53//
54// Note that this behavior may not be desired for example if an application
55// has its untranslated messages in a language other than English. In those
56// cases the application should call textdomain() after initializing GTK.
57//
58// Applications should normally not use this function directly,
59// but use the _() macro for translations.
60func Dgettext(DomainVar *string, MsgidVar string) string {
61
62 DomainVarPtr := core.GStrdupNullable(DomainVar)
63 defer core.GFreeNullable(DomainVarPtr)
64
65 cret := xDgettext(DomainVarPtr, MsgidVar)
66
67 return cret
68}
69
70var xDngettext func(uintptr, string, string, uint) string
71
72// This function is a wrapper of dngettext() which does not translate
73// the message if the default domain as set with textdomain() has no
74// translations for the current locale.
75//
76// See g_dgettext() for details of how this differs from dngettext()
77// proper.
78func Dngettext(DomainVar *string, MsgidVar string, MsgidPluralVar string, NVar uint) string {
79
80 DomainVarPtr := core.GStrdupNullable(DomainVar)
81 defer core.GFreeNullable(DomainVarPtr)
82
83 cret := xDngettext(DomainVarPtr, MsgidVar, MsgidPluralVar, NVar)
84
85 return cret
86}
87
88var xDpgettext func(uintptr, string, uint) string
89
90// This function is a variant of g_dgettext() which supports
91// a disambiguating message context. GNU gettext uses the
92// '\004' character to separate the message context and
93// message id in @msgctxtid.
94// If 0 is passed as @msgidoffset, this function will fall back to
95// trying to use the deprecated convention of using "|" as a separation
96// character.
97//
98// This uses g_dgettext() internally. See that functions for differences
99// with dgettext() proper.
100//
101// Applications should normally not use this function directly,
102// but use the C_() macro for translations with context.
103func Dpgettext(DomainVar *string, MsgctxtidVar string, MsgidoffsetVar uint) string {
104
105 DomainVarPtr := core.GStrdupNullable(DomainVar)
106 defer core.GFreeNullable(DomainVarPtr)
107
108 cret := xDpgettext(DomainVarPtr, MsgctxtidVar, MsgidoffsetVar)
109
110 return cret
111}
112
113var xDpgettext2 func(uintptr, string, string) string
114
115// This function is a variant of g_dgettext() which supports
116// a disambiguating message context. GNU gettext uses the
117// '\004' character to separate the message context and
118// message id in @msgctxtid.
119//
120// This uses g_dgettext() internally. See that functions for differences
121// with dgettext() proper.
122//
123// This function differs from C_() in that it is not a macro and
124// thus you may use non-string-literals as context and msgid arguments.
125func Dpgettext2(DomainVar *string, ContextVar string, MsgidVar string) string {
126
127 DomainVarPtr := core.GStrdupNullable(DomainVar)
128 defer core.GFreeNullable(DomainVarPtr)
129
130 cret := xDpgettext2(DomainVarPtr, ContextVar, MsgidVar)
131
132 return cret
133}
134
135var xStripContext func(string, string) string
136
137// An auxiliary function for gettext() support (see Q_()).
138func StripContext(MsgidVar string, MsgvalVar string) string {
139
140 cret := xStripContext(MsgidVar, MsgvalVar)
141
142 return cret
143}
144
145func init() {
146 core.SetPackageName("GLIB", "glib-2.0")
147 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
148 var libs []uintptr
149 for _, libPath := range core.GetPaths("GLIB") {
150 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
151 if err != nil {
152 panic(err)
153 }
154 libs = append(libs, lib)
155 }
156
157 core.PuregoSafeRegister(&xDcgettext, libs, "g_dcgettext")
158 core.PuregoSafeRegister(&xDgettext, libs, "g_dgettext")
159 core.PuregoSafeRegister(&xDngettext, libs, "g_dngettext")
160 core.PuregoSafeRegister(&xDpgettext, libs, "g_dpgettext")
161 core.PuregoSafeRegister(&xDpgettext2, libs, "g_dpgettext2")
162 core.PuregoSafeRegister(&xStripContext, libs, "g_strip_context")
163
164}