gtk.cfg: Add internationalization macros / functions (#1623)

Found via Donate CPU / daca@home.
Reference: https://developer.gnome.org/glib/stable/glib-I18N.html
Update header comment in gtk.cfg since it is now only edited manually.
This commit is contained in:
Sebastian 2019-01-25 13:07:48 +01:00 committed by GitHub
parent 0791ed05ca
commit ce96ffd433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 1 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<!-- THIS FILE IS GENERATED AUTOMATICALLY. See https://github.com/scriptum/cppcheck-libs -->
<!-- This file once has been generated automatically. See https://github.com/scriptum/cppcheck-libs -->
<!-- Now it is maintained and extended manually. -->
<def format="2">
<define name="g_return_if_fail(expr)" value="do{if(!(expr)){return;}}while(0)"/>
<define name="g_return_val_if_fail(expr, val)" value="do{if(!(expr)){return val;}}while(0)"/>
@ -8,6 +9,13 @@
<define name="G_CALLBACK(cb)" value="cb"/>
<define name="G_LIKELY(expr)" value="(expr)"/>
<define name="G_UNLIKELY(expr)" value="(expr)"/>
<!-- https://developer.gnome.org/glib/stable/glib-I18N.html -->
<!-- Using something similar to the gi18n-lib.h macro value here to avoid dependencies to gettext() -->
<define name="_(string)" value="((char *) g_dgettext(NULL, string))"/>
<define name="Q_(string)" value="g_dpgettext(NULL, string, 0)"/>
<define name="N_(string)" value="(string)"/>
<define name="C_(context, string)" value="g_dpgettext (NULL, context &quot;\004&quot; string, strlen (context) + 1)"/>
<define name="NC_(context, string)" value="(string)"/>
<memory>
<alloc init="true">g_thread_new</alloc>
<alloc init="true">g_thread_try_new</alloc>
@ -1826,9 +1834,19 @@
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<!-- const gchar * g_dgettext (const gchar *domain, const gchar *msgid); -->
<function name="g_dgettext">
<leak-ignore/>
<noreturn>false</noreturn>
<returnValue type="const gchar *"/>
<use-retval/>
<arg nr="1">
</arg>
<arg nr="2">
<not-uninit/>
<strz/>
<not-bool/>
</arg>
</function>
<function name="g_direct_equal">
<leak-ignore/>
@ -1850,9 +1868,23 @@
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<!-- const gchar * g_dpgettext (const gchar *domain, const gchar *msgctxtid, gsize msgidoffset); -->
<function name="g_dpgettext">
<leak-ignore/>
<noreturn>false</noreturn>
<returnValue type="const gchar *"/>
<use-retval/>
<arg nr="1">
</arg>
<arg nr="2">
<not-uninit/>
<strz/>
</arg>
<arg nr="3">
<not-uninit/>
<valid>0:</valid>
<not-bool/>
</arg>
</function>
<function name="g_dpgettext2">
<leak-ignore/>

View File

@ -19,4 +19,8 @@ void validCode(int argInt)
if G_LIKELY(argInt == 0) {
} else if (G_LIKELY(argInt == -1)) {
}
printf("%s", _("test"));
printf("%s", Q_("a|test"));
printf("%s", N_("test"));
}