1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = glib-I18N.html
27  * outPack = glib
28  * outFile = Internationalization
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Internationalization
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module glib.Internationalization;
54 
55 public  import gtkc.glibtypes;
56 
57 private import gtkc.glib;
58 private import glib.ConstructionException;
59 
60 
61 private import glib.Str;
62 
63 
64 
65 
66 /**
67  * Description
68  * GLib doesn't force any particular localization method upon its users.
69  * But since GLib itself is localized using the gettext() mechanism, it seems
70  * natural to offer the de-facto standard gettext() support macros in an
71  * easy-to-use form.
72  * In order to use these macros in an application, you must include
73  * glib/gi18n.h. For use in a library, must include
74  * glib/gi18n-lib.h after defining
75  * the GETTEXT_PACKAGE macro suitably for your library:
76  * $(DDOC_COMMENT example)
77  * Note that you also have to call setlocale() and textdomain() (as well as
78  * bindtextdomain() and bind_textdomain_codeset()) early on in your main()
79  * to make gettext() work.
80  * The gettext manual covers details of how to set up message extraction
81  * with xgettext.
82  */
83 public class Internationalization
84 {
85 	
86 	/**
87 	 */
88 	
89 	/**
90 	 * This function is a wrapper of dgettext() which does not translate
91 	 * the message if the default domain as set with textdomain() has no
92 	 * translations for the current locale.
93 	 * The advantage of using this function over dgettext() proper is that
94 	 * libraries using this function (like GTK+) will not use translations
95 	 * if the application using the library does not have translations for
96 	 * the current locale. This results in a consistent English-only
97 	 * interface instead of one having partial translations. For this
98 	 * feature to work, the call to textdomain() and setlocale() should
99 	 * precede any g_dgettext() invocations. For GTK+, it means calling
100 	 * textdomain() before gtk_init or its variants.
101 	 * This function disables translations if and only if upon its first
102 	 * Since 2.18
103 	 * Params:
104 	 * domain = the translation domain to use, or NULL to use
105 	 * the domain set with textdomain()
106 	 * msgid = message to translate
107 	 * Returns: The translated string
108 	 */
109 	public static string dgettext(string domain, string msgid)
110 	{
111 		// const gchar * g_dgettext (const gchar *domain,  const gchar *msgid);
112 		return Str.toString(g_dgettext(Str.toStringz(domain), Str.toStringz(msgid)));
113 	}
114 	
115 	/**
116 	 * This is a variant of g_dgettext() that allows specifying a locale
117 	 * category instead of always using LC_MESSAGES. See g_dgettext() for
118 	 * more information about how this functions differs from calling
119 	 * dcgettext() directly.
120 	 * Since 2.26
121 	 * Params:
122 	 * domain = the translation domain to use, or NULL to use
123 	 * the domain set with textdomain(). [allow-none]
124 	 * msgid = message to translate
125 	 * category = a locale category
126 	 * Returns: the translated string for the given locale category
127 	 */
128 	public static string dcgettext(string domain, string msgid, int category)
129 	{
130 		// const gchar * g_dcgettext (const gchar *domain,  const gchar *msgid,  int category);
131 		return Str.toString(g_dcgettext(Str.toStringz(domain), Str.toStringz(msgid), category));
132 	}
133 	
134 	/**
135 	 * This function is a wrapper of dngettext() which does not translate
136 	 * the message if the default domain as set with textdomain() has no
137 	 * translations for the current locale.
138 	 * See g_dgettext() for details of how this differs from dngettext()
139 	 * proper.
140 	 * Since 2.18
141 	 * Params:
142 	 * domain = the translation domain to use, or NULL to use
143 	 * the domain set with textdomain()
144 	 * msgid = message to translate
145 	 * msgidPlural = plural form of the message
146 	 * n = the quantity for which translation is needed
147 	 * Returns: The translated string
148 	 */
149 	public static string dngettext(string domain, string msgid, string msgidPlural, gulong n)
150 	{
151 		// const gchar * g_dngettext (const gchar *domain,  const gchar *msgid,  const gchar *msgid_plural,  gulong n);
152 		return Str.toString(g_dngettext(Str.toStringz(domain), Str.toStringz(msgid), Str.toStringz(msgidPlural), n));
153 	}
154 	
155 	/**
156 	 * This function is a variant of g_dgettext() which supports
157 	 * a disambiguating message context. GNU gettext uses the
158 	 * '\004' character to separate the message context and
159 	 * message id in msgctxtid.
160 	 * If 0 is passed as msgidoffset, this function will fall back to
161 	 * trying to use the deprecated convention of using "|" as a separation
162 	 * character.
163 	 * This uses g_dgettext() internally. See that functions for differences
164 	 * with dgettext() proper.
165 	 * Applications should normally not use this function directly,
166 	 * but use the C_() macro for translations with context.
167 	 * Since 2.16
168 	 * Params:
169 	 * domain = the translation domain to use, or NULL to use
170 	 * the domain set with textdomain()
171 	 * msgctxtid = a combined message context and message id, separated
172 	 * by a \004 character
173 	 * msgidoffset = the offset of the message id in msgctxid
174 	 * Returns: The translated string
175 	 */
176 	public static string dpgettext(string domain, string msgctxtid, gsize msgidoffset)
177 	{
178 		// const gchar * g_dpgettext (const gchar *domain,  const gchar *msgctxtid,  gsize msgidoffset);
179 		return Str.toString(g_dpgettext(Str.toStringz(domain), Str.toStringz(msgctxtid), msgidoffset));
180 	}
181 	
182 	/**
183 	 * This function is a variant of g_dgettext() which supports
184 	 * a disambiguating message context. GNU gettext uses the
185 	 * '\004' character to separate the message context and
186 	 * message id in msgctxtid.
187 	 * This uses g_dgettext() internally. See that functions for differences
188 	 * with dgettext() proper.
189 	 * This function differs from C_() in that it is not a macro and
190 	 * thus you may use non-string-literals as context and msgid arguments.
191 	 * Since 2.18
192 	 * Params:
193 	 * domain = the translation domain to use, or NULL to use
194 	 * the domain set with textdomain()
195 	 * context = the message context
196 	 * msgid = the message
197 	 * Returns: The translated string
198 	 */
199 	public static string dpgettext2(string domain, string context, string msgid)
200 	{
201 		// const gchar * g_dpgettext2 (const gchar *domain,  const gchar *context,  const gchar *msgid);
202 		return Str.toString(g_dpgettext2(Str.toStringz(domain), Str.toStringz(context), Str.toStringz(msgid)));
203 	}
204 	
205 	/**
206 	 * An auxiliary function for gettext() support (see Q_()).
207 	 * Since 2.4
208 	 * Params:
209 	 * msgid = a string
210 	 * msgval = another string
211 	 * Returns: msgval, unless msgval is identical to msgid and contains a '|' character, in which case a pointer to the substring of msgid after the first '|' character is returned.
212 	 */
213 	public static string stripContext(string msgid, string msgval)
214 	{
215 		// const gchar * g_strip_context (const gchar *msgid,  const gchar *msgval);
216 		return Str.toString(g_strip_context(Str.toStringz(msgid), Str.toStringz(msgval)));
217 	}
218 	
219 	/**
220 	 * Computes a list of applicable locale names, which can be used to
221 	 * e.g. construct locale-dependent filenames or search paths. The returned
222 	 * list is sorted from most desirable to least desirable and always contains
223 	 * the default locale "C".
224 	 * For example, if LANGUAGE=de:en_US, then the returned list is
225 	 * "de", "en_US", "en", "C".
226 	 * This function consults the environment variables LANGUAGE,
227 	 * LC_ALL, LC_MESSAGES and LANG
228 	 * to find the list of locales specified by the user.
229 	 * Since 2.6
230 	 * Returns: a NULL-terminated array of strings owned by GLib that must not be modified or freed.
231 	 */
232 	public static string[] getLanguageNames()
233 	{
234 		// const gchar * const * g_get_language_names (void);
235 		return Str.toStringArray(g_get_language_names());
236 	}
237 	
238 	/**
239 	 * Returns a list of derived variants of locale, which can be used to
240 	 * e.g. construct locale-dependent filenames or search paths. The returned
241 	 * list is sorted from most desirable to least desirable.
242 	 * This function handles territory, charset and extra locale modifiers.
243 	 * For example, if locale is "fr_BE", then the returned list
244 	 * is "fr_BE", "fr".
245 	 * If you need the list of variants for the current locale,
246 	 * use g_get_language_names().
247 	 * Since 2.28
248 	 * Params:
249 	 * locale = a locale identifier
250 	 * Returns: a newly allocated array of newly allocated strings with the locale variants. Free with g_strfreev(). [transfer full][array zero-terminated="1"][element-type utf8]
251 	 */
252 	public static string[] getLocaleVariants(string locale)
253 	{
254 		// gchar ** g_get_locale_variants (const gchar *locale);
255 		return Str.toStringArray(g_get_locale_variants(Str.toStringz(locale)));
256 	}
257 }