Fwd: Preprocessor directives and gettext - patch for pidgin-mtn/pidgin/gtkmain.c

Luke Schierer lschiere at pidgin.im
Wed Sep 19 20:56:43 EDT 2007


Is there a better solution, as he suggests, or is his patch the best we
can do?

luke


----- Forwarded message from Bjoern Voigt <bjoern at cs.tu-berlin.de> -----

Date: Wed, 19 Sep 2007 22:38:01 +0200
From: Bjoern Voigt <bjoern at cs.tu-berlin.de>
To: Luke Schierer <lschiere at pidgin.im>
Subject: Preprocessor directives and gettext - patch for pidgin-mtn/pidgin/gtkmain.c

Hello Luke,

Gettext could not correctly handle preprocessor directives within i18n
strings. So, this string is not correctly translatable:

                text = g_strdup_printf(_("%s %s\n"
                       "Usage: %s [OPTION]...\n\n"
                       "  -c, --config=DIR    use DIR for config files\n"
                       "  -d, --debug         print debugging messages
to stdout
\n"
                       "  -h, --help          display this help and exit\n"
                       "  -m, --multiple      do not ensure single
instance\n"
                       "  -n, --nologin       don't automatically login\n"
                       "  -l, --login[=NAME]  automatically login
(optional argument NAME specifies\n"
                       "                      account(s) to use,
separated by commas)\n"
#ifndef WIN32
                       "  --display=DISPLAY   X display to use\n"
#endif
                       "  -v, --version       display the current
version and exit\n"), PIDGIN_NAME, VERSION, name);

My attached patch fixes this. May be, there are better solutions, e.g.
with g_string_append functions.

Greetings,
Björn

-- 
Björn Voigt <bjoern at cs.tu-berlin.de>
Telefon: (030) 6 36 66 27
WWW: http://user.cs.tu-berlin.de/~bjoern/


#
# old_revision [005c57c94d8542339f96a33cfed0fefbad65d68e]
#
# patch "pidgin/gtkmain.c"
#  from [97d40c4b161c5f8d586a5d75d5e397ace78ea1ba]
#    to [866fcee688cb339c5c113c4c48b7e5a855ae45f0]
#
============================================================
--- pidgin/gtkmain.c	97d40c4b161c5f8d586a5d75d5e397ace78ea1ba
+++ pidgin/gtkmain.c	866fcee688cb339c5c113c4c48b7e5a855ae45f0
@@ -394,10 +394,17 @@ show_usage(const char *name, gboolean te
 		       "  -n, --nologin       don't automatically login\n"
 		       "  -l, --login[=NAME]  automatically login (optional argument NAME specifies\n"
 		       "                      account(s) to use, separated by commas)\n"
+		       "%s"
+		       "  -v, --version       display the current version and exit\n"), PIDGIN_NAME, VERSION, name,
 #ifndef WIN32
-		       "  --display=DISPLAY   X display to use\n"
+		       _("  --display=DISPLAY   X display to use\n")
+#else
+		       ""
 #endif
-		       "  -v, --version       display the current version and exit\n"), PIDGIN_NAME, VERSION, name);
+			);
+
+
+);
 	}
 
 	purple_print_utf8_to_console(stdout, text);


----- End forwarded message -----




More information about the Devel mailing list