mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
Bug 536996 – Missing noop i18n macro equivalent to C_
* glib/glib.symbols: * glib/gstrfuncs.[hc]: Add g_dpgettext2() which is a variant of g_dpgettext() taking context and id as separate arguments. * glib/gi18n-lib.h: * glib/gi18n.h: Add an NC_() macro that is to C_() as N_() is to _(). svn path=/trunk/; revision=7202
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2008-07-18 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/glib-sections.txt:
|
||||
* glib/tmpl/i18n.sgml: Add new gettext stuff
|
||||
|
||||
2008-07-18 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Bug 530759 – update the gobject tutorial to the XXI century
|
||||
|
@@ -2503,9 +2503,11 @@ g_unichar_to_utf8
|
||||
Q_
|
||||
C_
|
||||
N_
|
||||
NC_
|
||||
g_dgettext
|
||||
g_dngettext
|
||||
g_dpgettext
|
||||
g_dpgettext2
|
||||
g_strip_context
|
||||
<SUBSECTION>
|
||||
g_get_language_names
|
||||
|
@@ -148,6 +148,41 @@ To get the translated string, call gettext() at runtime.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### MACRO NC_ ##### -->
|
||||
<para>
|
||||
Only marks a string for translation, with context.
|
||||
This is useful in situations where the translated strings can't
|
||||
be directly used, e.g. in string array initializers.
|
||||
To get the translated string, you should call g_dpgettext2() at runtime.
|
||||
</para>
|
||||
|[
|
||||
{
|
||||
static const char *messages[] = {
|
||||
NC_("some context", "some very meaningful message"),
|
||||
NC_("some context", "and another one")
|
||||
};
|
||||
const char *string;
|
||||
...
|
||||
string
|
||||
= index > 1 ? g_dpgettext2 (NULL, "some context", "a default message") : g_dpgettext2 (NULL, "some context", messages[index]);
|
||||
<!-- -->
|
||||
fputs (string);
|
||||
...
|
||||
}
|
||||
]|
|
||||
|
||||
<note><para>
|
||||
If you are using the NC_() macro, you need to make sure that you
|
||||
pass <option>--keyword=NC_:1c,2</option> to xgettext when extracting
|
||||
messages. Note that this only works with GNU gettext >= 0.15.
|
||||
</para></note>
|
||||
|
||||
|
||||
@Context: a message context, must be a string literal
|
||||
@String: a message id, must be a string literal
|
||||
@Since: 2.18
|
||||
|
||||
|
||||
<!-- ##### FUNCTION g_strip_context ##### -->
|
||||
<para>
|
||||
|
||||
|
Reference in New Issue
Block a user