mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 21:16:15 +01:00
Change prototype to take msgctxtid + offset instead of two strings, to
2007-12-10 Matthias Clasen <mclasen@redhat.com> * glib/gstrfuncs.h: * glib/gstrfuncs.c (g_dpgettext): Change prototype to take msgctxtid + offset instead of two strings, to avoid duplication of string constants if the compiler/linker don't perform constant suffix merging. (#502590, Christian Persch) * glib/gi18n.h: * glib/gi18n-lib.h: Adapt the definitions of C_() and Q_(). svn path=/trunk/; revision=6081
This commit is contained in:
parent
d527cd5d9b
commit
d0d19f0dba
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-12-10 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gstrfuncs.h:
|
||||
* glib/gstrfuncs.c (g_dpgettext): Change prototype to take
|
||||
msgctxtid + offset instead of two strings, to avoid duplication
|
||||
of string constants if the compiler/linker don't perform constant
|
||||
suffix merging. (#502590, Christian Persch)
|
||||
|
||||
* glib/gi18n.h:
|
||||
* glib/gi18n-lib.h: Adapt the definitions of C_() and Q_().
|
||||
|
||||
2007-12-09 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* tests/gio-ls.c : (new file) a test program emulating some of 'ls'
|
||||
|
@ -28,9 +28,9 @@
|
||||
#endif
|
||||
|
||||
#define _(String) dgettext (GETTEXT_PACKAGE, String)
|
||||
#define Q_(String) g_dpgettext (GETTEXT_PACKAGE, String, NULL)
|
||||
#define Q_(String) g_dpgettext (GETTEXT_PACKAGE, String, 0)
|
||||
#define N_(String) (String)
|
||||
#define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE, Context "\004" String, String)
|
||||
#define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE, Context "\004" String, strlen (Context) + 1)
|
||||
|
||||
|
||||
#endif /* __G_I18N_LIB_H__ */
|
||||
|
@ -23,9 +23,9 @@
|
||||
#include <libintl.h>
|
||||
|
||||
#define _(String) gettext (String)
|
||||
#define Q_(String) g_dpgettext (NULL, String, NULL)
|
||||
#define Q_(String) g_dpgettext (NULL, String, 0)
|
||||
#define N_(String) (String)
|
||||
#define C_(Context,String) g_dpgettext (NULL, Context "\004" String, String)
|
||||
#define C_(Context,String) g_dpgettext (NULL, Context "\004" String, strlen (Context) + 1)
|
||||
|
||||
|
||||
#endif /* __G_I18N_H__ */
|
||||
|
@ -2849,19 +2849,20 @@ g_strv_length (gchar **str_array)
|
||||
* g_dpgettext:
|
||||
* @domain: the translation domain to use, or %NULL to use
|
||||
* the domain set with textdomain()
|
||||
* @msgctxtid: a combined message context and message id
|
||||
* @msgid: the message id, or %NULL
|
||||
* @msgctxtid: a combined message context and message id, separated
|
||||
* by a \004 character
|
||||
* @msgidoffset: the offset of the message id in @msgctxid
|
||||
*
|
||||
* This function is a variant of dgettext() which supports
|
||||
* a disambiguating message context. GNU gettext uses the
|
||||
* '\004' character to separate the message context and
|
||||
* message id in @msgctxtid. If %NULL is passed as @msgid,
|
||||
* this function also supports the older convention of using
|
||||
* '|' as a separator.
|
||||
* message id in @msgctxtid.
|
||||
* If 0 is passed as @msgidoffset, this function will fall back to
|
||||
* trying to use the deprecated convention of using "|" as a separation
|
||||
* character.
|
||||
*
|
||||
* Applications should normally not use this function directly,
|
||||
* but use the C_() or Q_() macros for translations with
|
||||
* context.
|
||||
* but use the C_() macro for translations with context.
|
||||
*
|
||||
* Returns: The translated string
|
||||
*
|
||||
@ -2870,7 +2871,7 @@ g_strv_length (gchar **str_array)
|
||||
const gchar *
|
||||
g_dpgettext (const gchar *domain,
|
||||
const gchar *msgctxtid,
|
||||
const gchar *msgid)
|
||||
gsize msgidoffset)
|
||||
{
|
||||
const gchar *translation;
|
||||
gchar *sep;
|
||||
@ -2879,8 +2880,8 @@ g_dpgettext (const gchar *domain,
|
||||
|
||||
if (translation == msgctxtid)
|
||||
{
|
||||
if (msgid)
|
||||
return msgid;
|
||||
if (msgidoffset > 0)
|
||||
return msgctxtid + msgidoffset;
|
||||
|
||||
sep = strchr (msgctxtid, '|');
|
||||
|
||||
|
@ -245,7 +245,7 @@ G_CONST_RETURN gchar *g_strip_context (const gchar *msgid,
|
||||
|
||||
G_CONST_RETURN gchar *g_dpgettext (const gchar *domain,
|
||||
const gchar *msgctxtid,
|
||||
const gchar *msgid);
|
||||
gsize msgidoffset);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user