changeset 13089:b553326bc468

[gaim-migrate @ 15451] Various i18n improvements from Bj??rn Voigt committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 01 Feb 2006 06:07:53 +0000
parents a91a8a28f61f
children 0aa231ebbfd5
files plugins/gaimrc.c plugins/musicmessaging/musicmessaging.c plugins/timestamp_format.c po/POTFILES.in src/gtkmain.c src/util.c src/util.h
diffstat 7 files changed, 82 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/gaimrc.c	Wed Feb 01 06:04:22 2006 +0000
+++ b/plugins/gaimrc.c	Wed Feb 01 06:07:53 2006 +0000
@@ -412,7 +412,7 @@
 	labelsg  = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 	widgetsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
-	frame = gaim_gtk_make_frame(ret, "General");
+	frame = gaim_gtk_make_frame(ret, _("General"));
 	/* interface font */
 	hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
 	gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
@@ -472,7 +472,7 @@
 		                 widget_bool_widgets[i]);
 	}
 
-	frame = gaim_gtk_make_frame(ret, "Interface colors");
+	frame = gaim_gtk_make_frame(ret, _("Interface colors"));
 	/* imhtml stuff */
 	for (i = 0; i < G_N_ELEMENTS(color_prefs); i++) {
 		hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
@@ -496,7 +496,7 @@
 		                 GINT_TO_POINTER(i));
 	}
 
-	frame = gaim_gtk_make_frame(ret, "Widget Sizes");
+	frame = gaim_gtk_make_frame(ret, _("Widget Sizes"));
 	/* widget size stuff */
 	for (i = 0; i < G_N_ELEMENTS(widget_size_prefs); i++) {
 		hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
@@ -517,7 +517,7 @@
 		                 widget_size_widgets[i]);
 	}
 
-	frame = gaim_gtk_make_frame(ret, "Fonts");
+	frame = gaim_gtk_make_frame(ret, _("Fonts"));
 	/* imhtml font stuff */
 	for (i = 0; i < G_N_ELEMENTS(font_prefs); i++) {
 		hbox = gtk_hbox_new(FALSE, GAIM_HIG_CAT_SPACE);
--- a/plugins/musicmessaging/musicmessaging.c	Wed Feb 01 06:04:22 2006 +0000
+++ b/plugins/musicmessaging/musicmessaging.c	Wed Feb 01 06:07:53 2006 +0000
@@ -41,8 +41,8 @@
 
 #define MUSICMESSAGING_PLUGIN_ID "gtk-hazure-musicmessaging"
 #define MUSICMESSAGING_PREFIX "##MM##"
-#define MUSICMESSAGING_START_MSG "A music messaging session has been requested. Please click the MM icon to accept."
-#define MUSICMESSAGING_CONFIRM_MSG "Music messaging session confirmed."
+#define MUSICMESSAGING_START_MSG _("A music messaging session has been requested. Please click the MM icon to accept.")
+#define MUSICMESSAGING_CONFIRM_MSG _("Music messaging session confirmed.")
 
 typedef struct {
 	GaimConversation *conv; /* pointer to the conversation */
@@ -410,8 +410,9 @@
 				
 				if ((mmconv->conv)->name == id)
 				{
-					gaim_notify_message(plugin_pointer, GAIM_NOTIFY_MSG_ERROR, "Music Messaging",
-						"There was a conflict in running the command:", command, NULL, NULL);
+					gaim_notify_message(plugin_pointer, GAIM_NOTIFY_MSG_ERROR, 
+							    _("Music Messaging"),
+							    _("There was a conflict in running the command:"), command, NULL, NULL);
 				}
 			}
 		}
@@ -519,8 +520,8 @@
 	
 	if (!(g_spawn_async (".", args, NULL, 4, NULL, NULL, &(mmconv->pid), &spawn_error)))
 	{
-		gaim_notify_error(plugin_pointer, "Error Running Editor",
-						"The following error has occured:", spawn_error->message);
+		gaim_notify_error(plugin_pointer, _("Error Running Editor"),
+				  _("The following error has occured:"), spawn_error->message);
 		mmconv->started = FALSE;
 	}
 	else
@@ -623,7 +624,7 @@
 	
 	/* Path to the score editor */
 	editor_path = gtk_entry_new();
-	editor_path_label = gtk_label_new("Score Editor Path");
+	editor_path_label = gtk_label_new(_("Score Editor Path"));
 	editor_path_button = gtk_button_new_with_mnemonic(_("_Apply"));
 	
 	gtk_entry_set_text((GtkEntry*)editor_path, "/usr/local/bin/gscore");
@@ -650,24 +651,26 @@
     GAIM_PLUGIN_MAGIC,
     GAIM_MAJOR_VERSION,
     GAIM_MINOR_VERSION,
-    GAIM_PLUGIN_STANDARD,
-    GAIM_GTK_PLUGIN_TYPE,
-    0,
-    NULL,
-    GAIM_PRIORITY_DEFAULT,
+    GAIM_PLUGIN_STANDARD,                                /**< type           */
+    GAIM_GTK_PLUGIN_TYPE,                                /**< ui_requirement */
+    0,                                                   /**< flags          */
+    NULL,                                                /**< dependencies   */
+    GAIM_PRIORITY_DEFAULT,                               /**< priority       */
 
-    MUSICMESSAGING_PLUGIN_ID,
-    "Music Messaging",
-    VERSION,
-    "Music Messaging Plugin for collabrative composition.",
-    "The Music Messaging Plugin allows a number of users to simultaneously work on a piece of music by editting a common score in real-time.",
-    "Christian Muise <christian.muise@gmail.com>",
-    GAIM_WEBSITE,
-    plugin_load,
-    plugin_unload,
-    NULL,
-    &ui_info,
-    NULL,
+    MUSICMESSAGING_PLUGIN_ID,                            /**< id             */
+    "Music Messaging",	                                 /**< name           */
+    VERSION,                                             /**< version        */
+    N_("Music Messaging Plugin for collaborative composition."),
+                                                         /**  summary        */
+    N_("The Music Messaging Plugin allows a number of users to simultaneously work on a piece of music by editting a common score in real-time."),
+	                                                 /**  description    */
+    "Christian Muise <christian.muise@gmail.com>",       /**< author         */
+    GAIM_WEBSITE,                                        /**< homepage       */
+    plugin_load,                                         /**< load           */
+    plugin_unload,                                       /**< unload         */
+    NULL,                                                /**< destroy        */
+    &ui_info,                                            /**< ui_info        */
+    NULL,                                                /**< extra_info     */
     NULL,
     NULL
 };
--- a/plugins/timestamp_format.c	Wed Feb 01 06:04:22 2006 +0000
+++ b/plugins/timestamp_format.c	Wed Feb 01 06:07:53 2006 +0000
@@ -33,18 +33,18 @@
 			"/plugins/gtk/timestamp_format/use_dates/conversation",
 			_("Co_nversations:"));
         gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE);
-        gaim_plugin_pref_add_choice(ppref, "For delayed messages", "automatic");
-        gaim_plugin_pref_add_choice(ppref, "For delayed messages and in chats", "chats");
-        gaim_plugin_pref_add_choice(ppref, "Always", "always");
+        gaim_plugin_pref_add_choice(ppref, _("For delayed messages"), "automatic");
+        gaim_plugin_pref_add_choice(ppref, _("For delayed messages and in chats"), "chats");
+        gaim_plugin_pref_add_choice(ppref, _("Always"), "always");
 	gaim_plugin_pref_frame_add(frame, ppref);
 
 	ppref = gaim_plugin_pref_new_with_name_and_label(
 			"/plugins/gtk/timestamp_format/use_dates/log",
 			_("_Message Logs:"));
         gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE);
-        gaim_plugin_pref_add_choice(ppref, "For delayed messages", "automatic");
-        gaim_plugin_pref_add_choice(ppref, "For delayed messages and in chats", "chats");
-        gaim_plugin_pref_add_choice(ppref, "Always", "always");
+        gaim_plugin_pref_add_choice(ppref, _("For delayed messages"), "automatic");
+        gaim_plugin_pref_add_choice(ppref, _("For delayed messages and in chats"), "chats");
+        gaim_plugin_pref_add_choice(ppref, _("Always"), "always");
 	gaim_plugin_pref_frame_add(frame, ppref);
 
 	return frame;
--- a/po/POTFILES.in	Wed Feb 01 06:04:22 2006 +0000
+++ b/po/POTFILES.in	Wed Feb 01 06:07:53 2006 +0000
@@ -27,6 +27,7 @@
 plugins/musicmessaging/musicmessaging.c
 plugins/notify.c
 plugins/perl/perl.c
+plugins/psychic.c
 plugins/raw.c
 plugins/relnot.c
 plugins/signals-test.c
@@ -39,6 +40,7 @@
 plugins/tcl/tcl.c
 plugins/ticker/ticker.c
 plugins/timestamp.c
+plugins/timestamp_format.c
 plugins/win32/transparency/win2ktrans.c
 plugins/win32/winprefs/winprefs.c
 src/account.c
--- a/src/gtkmain.c	Wed Feb 01 06:04:22 2006 +0000
+++ b/src/gtkmain.c	Wed Feb 01 06:07:53 2006 +0000
@@ -172,7 +172,7 @@
 		gaim_connections_disconnect_all();
 		break;
 	case SIGSEGV:
-		fprintf(stderr, segfault_message);
+		gaim_print_utf8_to_console(stderr, segfault_message);
 		abort();
 		break;
 	case SIGCHLD:
@@ -307,13 +307,6 @@
 show_usage(const char *name, gboolean terse)
 {
 	char *text;
-	char *text_conv;
-	GError *error = NULL;
-
-#ifdef HAVE_SETLOCALE
-	/* Locale initialization is not complete here.  See gtk_init_check() */
-	setlocale(LC_ALL, "");
-#endif
 
 	if (terse) {
 		text = g_strdup_printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name);
@@ -329,18 +322,7 @@
 		       "  -v, --version       display the current version and exit\n"), VERSION, name);
 	}
 
-	/* tries to convert 'text' to users locale */
-	text_conv = g_locale_from_utf8(text, -1, NULL, NULL, &error);
-	if (text_conv != NULL) {
-		puts(text_conv);
-		g_free(text_conv);
-	}
-	/* use 'text' as a fallback */
-	else {
-		g_warning("%s\n", error->message);
-		g_error_free(error);
-		puts(text);
-	}
+	gaim_print_utf8_to_console(stdout, text);
 	g_free(text);
 }
 
@@ -489,27 +471,32 @@
 	textdomain(PACKAGE);
 #endif
 
+#ifdef HAVE_SETLOCALE
+	/* Locale initialization is not complete here.  See gtk_init_check() */
+	setlocale(LC_ALL, "");
+#endif
 
 #if HAVE_SIGNAL_H
 
 #ifndef DEBUG
 		/* We translate this here in case the crash breaks gettext. */
-		segfault_message = g_strdup(_(
+		segfault_message = g_strdup_printf(_(
 			"Gaim has segfaulted and attempted to dump a core file.\n"
 			"This is a bug in the software and has happened through\n"
 			"no fault of your own.\n\n"
 			"It is possible that this bug is already fixed in CVS.\n"
 			"If you can reproduce the crash, please notify the gaim\n"
 			"developers by reporting a bug at\n"
-			GAIM_WEBSITE "bug.php\n\n"
+			"%sbug.php\n\n"
 			"Please make sure to specify what you were doing at the time\n"
 			"and post the backtrace from the core file.  If you do not know\n"
 			"how to get the backtrace, please read the instructions at\n"
-			GAIM_WEBSITE "gdb.php.  If you need further\n"
+			"%sgdb.php.  If you need further\n"
 			"assistance, please IM either SeanEgn or LSchiere (via AIM).\n"
 			"Contact information for Sean and Luke on other protocols is at\n"
-			GAIM_WEBSITE "contactinfo.php.\n"
-		));
+			"%scontactinfo.php.\n"),
+			GAIM_WEBSITE, GAIM_WEBSITE, GAIM_WEBSITE
+		);
 #else
 		/* Don't mark this for translation. */
 		segfault_message = g_strdup(
--- a/src/util.c	Wed Feb 01 06:04:22 2006 +0000
+++ b/src/util.c	Wed Feb 01 06:07:53 2006 +0000
@@ -3593,6 +3593,27 @@
 	return ret;
 }
 
+void
+gaim_print_utf8_to_console(FILE *filestream, char *message)
+{
+	gchar *message_conv;
+	GError *error = NULL;
+
+	/* Try to convert 'message' to user's locale */
+	message_conv = g_locale_from_utf8(message, -1, NULL, NULL, &error);
+	if (message_conv != NULL) {
+		fputs(message_conv, filestream);
+		g_free(message_conv);
+	}
+	else
+	{
+		/* use 'message' as a fallback */
+		g_warning("%s\n", error->message);
+		g_error_free(error);
+		fputs(message, filestream);
+	}
+}
+
 gboolean gaim_message_meify(char *message, size_t len)
 {
 	char *c;
--- a/src/util.h	Wed Feb 01 06:04:22 2006 +0000
+++ b/src/util.h	Wed Feb 01 06:07:53 2006 +0000
@@ -887,6 +887,16 @@
 gboolean gaim_utf8_has_word(const char *haystack, const char *needle);
 
 /**
+ * Prints a UTF-8 message to the given file stream. The function
+ * tries to convert the UTF-8 message to user's locale. If this
+ * is not possible, the original UTF-8 text will be printed.
+ *
+ * @param filestream The file stream (e.g. STDOUT or STDERR)
+ * @param message    The message to print.
+ */
+void gaim_print_utf8_to_console(FILE *filestream, char *message);
+
+/**
  * Checks for messages starting with "/me "
  *
  * @param message The message to check