diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2008-07-18 18:14:04 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2008-07-18 18:14:04 +0000 |
commit | e417f54c28b8bc241391612009a2bab81699850a (patch) | |
tree | e2dfa0aa456a359c0c9473f27789193d6a3faf84 /docs | |
parent | adae2cf59bba32b7fdd0afb5b10056cd4105fddb (diff) |
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
Diffstat (limited to 'docs')
-rw-r--r-- | docs/reference/ChangeLog | 5 | ||||
-rw-r--r-- | docs/reference/glib/glib-sections.txt | 2 | ||||
-rw-r--r-- | docs/reference/glib/tmpl/i18n.sgml | 35 |
3 files changed, 42 insertions, 0 deletions
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 00690cf05..cc8f1afc7 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,5 +1,10 @@ 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 * gobject/*: Some updates to the tutorial. Patch by Emmanuele diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index 575e3f7a7..90f9899e5 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -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 diff --git a/docs/reference/glib/tmpl/i18n.sgml b/docs/reference/glib/tmpl/i18n.sgml index 4c1fe7980..b9ce778e1 100644 --- a/docs/reference/glib/tmpl/i18n.sgml +++ b/docs/reference/glib/tmpl/i18n.sgml @@ -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> |