# HG changeset patch # User Stu Tomlinson # Date 1176302764 0 # Node ID fa8aeab4ca5adb5a9e2c8a0ffdd82b5393ab0f70 # Parent 07554cc5d09081eaea08bc165f3d57a0b74bebfe Hopefully prevent libpurple causing problems for 3rd party UIs if they also use gettext for i18n. Use dgettext & dngettext in libpurple to explicitly specify the text domain to use. Currently, with no split of strings for libpurple/pidgin/finch, we are using 'pidgin' as the gettext domain everywhere. Hopefully this didn't break anything. diff -r 07554cc5d090 -r fa8aeab4ca5a libpurple/core.c --- a/libpurple/core.c Wed Apr 11 13:38:05 2007 +0000 +++ b/libpurple/core.c Wed Apr 11 14:46:04 2007 +0000 @@ -70,6 +70,9 @@ g_return_val_if_fail(ui != NULL, FALSE); g_return_val_if_fail(purple_get_core() == NULL, FALSE); +#ifdef ENABLE_NLS + bindtextdomain(PACKAGE, LOCALEDIR); +#endif #ifdef _WIN32 wpurple_init(); #endif diff -r 07554cc5d090 -r fa8aeab4ca5a libpurple/internal.h --- a/libpurple/internal.h Wed Apr 11 13:38:05 2007 +0000 +++ b/libpurple/internal.h Wed Apr 11 14:46:04 2007 +0000 @@ -43,7 +43,7 @@ #ifdef ENABLE_NLS # include # include -# define _(String) ((const char *)gettext(String)) +# define _(String) ((const char *)dgettext(PACKAGE, String)) # ifdef gettext_noop # define N_(String) gettext_noop (String) # else @@ -56,6 +56,7 @@ # define _(String) ((const char *)String) # endif # define ngettext(Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural)) +# define dngettext(Domain, Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural)) #endif #ifdef HAVE_ENDIAN_H diff -r 07554cc5d090 -r fa8aeab4ca5a libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Wed Apr 11 13:38:05 2007 +0000 +++ b/libpurple/protocols/msn/notification.c Wed Apr 11 14:46:04 2007 +0000 @@ -1310,7 +1310,7 @@ { case 1: minutes = atoi(g_hash_table_lookup(table, "Arg1")); - g_snprintf(buf, sizeof(buf), ngettext( + g_snprintf(buf, sizeof(buf), dngettext(PACKAGE, "The MSN server will shut down for maintenance " "in %d minute. You will automatically be " "signed out at that time. Please finish any " diff -r 07554cc5d090 -r fa8aeab4ca5a libpurple/protocols/oscar/oscar.c --- a/libpurple/protocols/oscar/oscar.c Wed Apr 11 13:38:05 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.c Wed Apr 11 14:46:04 2007 +0000 @@ -2558,7 +2558,7 @@ switch(reason) { case 0: /* Invalid (0) */ buf = g_strdup_printf( - ngettext( + dngettext(PACKAGE, "You missed %hu message from %s because it was invalid.", "You missed %hu messages from %s because they were invalid.", nummissed), @@ -2567,7 +2567,7 @@ break; case 1: /* Message too large */ buf = g_strdup_printf( - ngettext( + dngettext(PACKAGE, "You missed %hu message from %s because it was too large.", "You missed %hu messages from %s because they were too large.", nummissed), @@ -2576,7 +2576,7 @@ break; case 2: /* Rate exceeded */ buf = g_strdup_printf( - ngettext( + dngettext(PACKAGE, "You missed %hu message from %s because the rate limit has been exceeded.", "You missed %hu messages from %s because the rate limit has been exceeded.", nummissed), @@ -2585,7 +2585,7 @@ break; case 3: /* Evil Sender */ buf = g_strdup_printf( - ngettext( + dngettext(PACKAGE, "You missed %hu message from %s because he/she was too evil.", "You missed %hu messages from %s because he/she was too evil.", nummissed), @@ -2594,7 +2594,7 @@ break; case 4: /* Evil Receiver */ buf = g_strdup_printf( - ngettext( + dngettext(PACKAGE, "You missed %hu message from %s because you are too evil.", "You missed %hu messages from %s because you are too evil.", nummissed), @@ -2603,7 +2603,7 @@ break; default: buf = g_strdup_printf( - ngettext( + dngettext(PACKAGE, "You missed %hu message from %s for an unknown reason.", "You missed %hu messages from %s for an unknown reason.", nummissed), @@ -3918,7 +3918,7 @@ } secondary = g_strdup_printf( - ngettext("The following screen name is associated with %s", + dngettext(PACKAGE, "The following screen name is associated with %s", "The following screen names are associated with %s", num), email); @@ -4476,7 +4476,7 @@ if (infolen > od->rights.maxsiglen) { gchar *errstr; - errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " + errstr = g_strdup_printf(dngettext(PACKAGE, "The maximum profile length of %d byte " "has been exceeded. It has been truncated it for you.", "The maximum profile length of %d bytes " "has been exceeded. It has been truncated it for you.", @@ -4526,7 +4526,7 @@ { gchar *errstr; - errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " + errstr = g_strdup_printf(dngettext(PACKAGE, "The maximum away message length of %d byte " "has been exceeded. It has been truncated for you.", "The maximum away message length of %d bytes " "has been exceeded. It has been truncated for you.", diff -r 07554cc5d090 -r fa8aeab4ca5a libpurple/protocols/toc/toc.c --- a/libpurple/protocols/toc/toc.c Wed Apr 11 13:38:05 2007 +0000 +++ b/libpurple/protocols/toc/toc.c Wed Apr 11 14:46:04 2007 +0000 @@ -2205,7 +2205,7 @@ index++; } g_snprintf(buf, sizeof(buf), - ngettext( + dngettext(PACKAGE, "%s requests %s to accept %d file: %s (%.2f %s)%s%s", "%s requests %s to accept %d files: %s (%.2f %s)%s%s", ft->files), diff -r 07554cc5d090 -r fa8aeab4ca5a libpurple/util.c --- a/libpurple/util.c Wed Apr 11 13:38:05 2007 +0000 +++ b/libpurple/util.c Wed Apr 11 14:46:04 2007 +0000 @@ -2932,7 +2932,7 @@ if (secs < 60) { - return g_strdup_printf(ngettext("%d second", "%d seconds", secs), secs); + return g_strdup_printf(dngettext(PACKAGE, "%d second", "%d seconds", secs), secs); } days = secs / (60 * 60 * 24); @@ -2944,7 +2944,7 @@ if (days > 0) { - ret = g_strdup_printf(ngettext("%d day", "%d days", days), days); + ret = g_strdup_printf(dngettext(PACKAGE, "%d day", "%d days", days), days); } if (hrs > 0) @@ -2952,13 +2952,13 @@ if (ret != NULL) { char *tmp = g_strdup_printf( - ngettext("%s, %d hour", "%s, %d hours", hrs), + dngettext(PACKAGE, "%s, %d hour", "%s, %d hours", hrs), ret, hrs); g_free(ret); ret = tmp; } else - ret = g_strdup_printf(ngettext("%d hour", "%d hours", hrs), hrs); + ret = g_strdup_printf(dngettext(PACKAGE, "%d hour", "%d hours", hrs), hrs); } if (mins > 0) @@ -2966,13 +2966,13 @@ if (ret != NULL) { char *tmp = g_strdup_printf( - ngettext("%s, %d minute", "%s, %d minutes", mins), + dngettext(PACKAGE, "%s, %d minute", "%s, %d minutes", mins), ret, mins); g_free(ret); ret = tmp; } else - ret = g_strdup_printf(ngettext("%d minute", "%d minutes", mins), mins); + ret = g_strdup_printf(dngettext(PACKAGE, "%d minute", "%d minutes", mins), mins); } return ret;