mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-23 10:27:51 +02:00
Define a two-argument macro C_() for marking translatable strings with
2007-11-23 Matthias Clasen <mclasen@redhat.com> * glib/gi18n-lib.h: * glib/gi18n.h: Define a two-argument macro C_() for marking translatable strings with context and implement C_() and Q_() using g_dpgettext(). (#142676, Morten Welinder) * glib/glib.symbols: * glib/gstrfuncs.[hc]: Implement g_dpgettext(). svn path=/trunk/; revision=5917
This commit is contained in:
committed by
Matthias Clasen
parent
0d723a240e
commit
a1ac3c0e23
@@ -1,3 +1,8 @@
|
||||
2007-11-23 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/tmpl/i18n.sgml:
|
||||
* glib/glib-sections.txt: Add g_dpgettext(), C_()
|
||||
|
||||
2007-11-18 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/tmpl/option.sgml: Update the example to demonstrate
|
||||
|
@@ -2483,8 +2483,10 @@ g_unichar_to_utf8
|
||||
<INCLUDE>glib.h,glib/gi18n.h</INCLUDE>
|
||||
_
|
||||
Q_
|
||||
C_
|
||||
N_
|
||||
g_strip_context
|
||||
g_dpgettext
|
||||
<SUBSECTION>
|
||||
g_get_language_names
|
||||
</SECTION>
|
||||
|
@@ -44,9 +44,9 @@ at runtime.
|
||||
|
||||
<!-- ##### MACRO Q_ ##### -->
|
||||
<para>
|
||||
Like _(), but applies g_strip_context() to the translation. This has the
|
||||
advantage that the string can be adorned with a prefix to guarantee
|
||||
uniqueness and provide context to the translator.
|
||||
Like _(), but handles context in message ids. This has the advantage that
|
||||
the string can be adorned with a prefix to guarantee uniqueness and provide
|
||||
context to the translator.
|
||||
</para>
|
||||
<para>
|
||||
One use case given in the gettext manual is GUI translation, where one could
|
||||
@@ -56,16 +56,48 @@ differently depending on whether it's the name of a character set or a
|
||||
language. This could be solved by using "charset|Russian" and
|
||||
"language|Russian".
|
||||
</para>
|
||||
<para>
|
||||
See the C_() macro for a different way to mark up translatable strings
|
||||
with context.
|
||||
</para>
|
||||
<note><para>
|
||||
If you are using the Q_() macro, you need to make sure that you
|
||||
pass <option>--keyword=Q_</option> to xgettext when extracting messages.
|
||||
If you are using GNU gettext >= 0.15, you can also use
|
||||
<option>--keyword=Q_:1g</option> to let xgettext split the context
|
||||
string off into a msgctxt line in the po file.
|
||||
</para></note>
|
||||
|
||||
@String: the string to be translated, with a '|'-separated prefix which
|
||||
must not be translated
|
||||
@Returns: the translated message
|
||||
@Since: 2.4
|
||||
|
||||
|
||||
<!-- ##### MACRO C_ ##### -->
|
||||
<para>
|
||||
Uses gettext to get the translation for @msgid. @msgctxt is
|
||||
used as a context. This is mainly useful for short strings which
|
||||
may need different translations, depending on the context in which
|
||||
they are used.
|
||||
<informalexample><programlisting>
|
||||
label1 = C_("Navigation", "Back");
|
||||
label2 = C_("Body part", "Back");
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
|
||||
<note><para>
|
||||
If you are using the C_() macro, you need to make sure that you
|
||||
pass <option>--keyword=C_:1c,2</option> to xgettext when extracting
|
||||
messages. Note that this only works with GNU gettext >= 0.15.
|
||||
</para></note>
|
||||
|
||||
@msgctxt: a message context, must be a string literal
|
||||
@msgid: a message id, must be a string literal
|
||||
@Returns: the translated message
|
||||
@Since: 2.16
|
||||
|
||||
|
||||
<!-- ##### MACRO N_ ##### -->
|
||||
<para>
|
||||
Marks a string for translation, gets replaced with the untranslated string
|
||||
@@ -92,6 +124,7 @@ be directly used, e.g. in string array initializers.
|
||||
@Since: 2.4
|
||||
|
||||
|
||||
|
||||
<!-- ##### FUNCTION g_strip_context ##### -->
|
||||
<para>
|
||||
|
||||
|
Reference in New Issue
Block a user