pidgin: f1504a57: Mark a bunch of mxit strings for transla...

markdoliner at pidgin.im markdoliner at pidgin.im
Sun Nov 22 14:25:38 EST 2009


-----------------------------------------------------------------
Revision: f1504a57f6518466cd61deb44389178f44d729f7
Ancestor: efa9e9f485d998244d637d1ff62dbb333ef8abd4
Author: markdoliner at pidgin.im
Date: 2009-11-22T19:21:20
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f1504a57f6518466cd61deb44389178f44d729f7

Modified files:
        libpurple/protocols/mxit/actions.c
        libpurple/protocols/mxit/formcmds.c
        libpurple/protocols/mxit/login.c
        libpurple/protocols/mxit/markup.c
        libpurple/protocols/mxit/multimx.c
        libpurple/protocols/mxit/mxit.c
        libpurple/protocols/mxit/protocol.c
        libpurple/protocols/mxit/roster.c

ChangeLog: 

Mark a bunch of mxit strings for translation

-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/actions.c	7e9b6b4bb972d5e8448270e14362d1b5e906adf9
+++ libpurple/protocols/mxit/actions.c	dcef5386cf3266a9a96559776b96b1be117842cf
@@ -150,37 +150,37 @@ static void mxit_cb_set_profile( PurpleC
 	/* validate pin */
 	pin = purple_request_fields_get_string( fields, "pin" );
 	if ( !pin ) {
-		err = "The PIN you entered is invalid.";
+		err = _("The PIN you entered is invalid.");
 		goto out;
 	}
 	len = strlen( pin );
 	if ( ( len < 4 ) || ( len > 10 ) ) {
-		err = "The PIN you entered has an invalid length [4-10].";
+		err = _("The PIN you entered has an invalid length [4-10].");
 		goto out;
 	}
 	for ( i = 0; i < len; i++ ) {
 		if ( !g_ascii_isdigit( pin[i] ) ) {
-			err = "The PIN is invalid. It should only consist of digits [0-9].";
+			err = _("The PIN is invalid. It should only consist of digits [0-9].");
 			goto out;
 		}
 	}
 	pin2 = purple_request_fields_get_string( fields, "pin2" );
 	if ( ( !pin2 ) || ( strcmp( pin, pin2 ) != 0 ) ) {
-		err = "The two PINs you entered does not match.";
+		err = _("The two PINs you entered do not match.");
 		goto out;
 	}
 
 	/* validate name */
 	name = purple_request_fields_get_string( fields, "name" );
 	if ( ( !name ) || ( strlen( name ) < 3 ) ) {
-		err = "The name you entered is invalid.";
+		err = _("The name you entered is invalid.");
 		goto out;
 	}
 
 	/* validate birthdate */
 	bday = purple_request_fields_get_string( fields, "bday" );
 	if ( ( !bday ) || ( strlen( bday ) < 10 ) || ( !validateDate( bday ) ) ) {
-		err = "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'.";
+		err = _("The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'.");
 		goto out;
 	}
 
@@ -218,10 +218,7 @@ out:
 		acount++;
 
 		/* update gender */
-		if ( purple_request_fields_get_choice( fields, "male" ) == 0 )
-			profile->male = FALSE;
-		else
-			profile->male = TRUE;
+		profile->male = ( purple_request_fields_get_choice( fields, "male" ) == 0 );
 		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_GENDER, CP_PROF_TYPE_BOOL, ( profile->male ) ? "1" : "0" );
 		g_string_append( attributes, attrib );
 		acount++;
============================================================
--- libpurple/protocols/mxit/formcmds.c	39c556d1ef29971dd0080e17000f1c5baf53e028
+++ libpurple/protocols/mxit/formcmds.c	309b831584156b864558a261e92fb8fae23ac13b
@@ -216,7 +216,7 @@ static void command_clearscreen(struct M
 
     conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, session->acc);
     if (conv == NULL) {
-        purple_debug_error(MXIT_PLUGIN_ID, "Conversation with '%s' not found\n", from);
+        purple_debug_error(MXIT_PLUGIN_ID, _( "Conversation with '%s' not found\n" ), from);
         return;
     }
 
@@ -268,7 +268,7 @@ static void command_platformreq(GHashTab
 
 	dest = g_hash_table_lookup(hash, "dest");				/* find the destination */
 	if (dest) {
-		g_string_append_printf(msg, "<a href=\"%s\">%s</a>", purple_url_decode(dest), (text) ? text : "Download");		/* add link to display message */
+		g_string_append_printf(msg, "<a href=\"%s\">%s</a>", purple_url_decode(dest), (text) ? text : _( "Download" ));		/* add link to display message */
 	}
 
 	if (text)
@@ -333,7 +333,7 @@ static void command_image(struct RXMsgDa
 	reply = g_hash_table_lookup(hash, "replymsg");
 	if (reply) {
 		g_string_append_printf(msg, "\n");
-		mxit_add_html_link(mx, reply, "click here");
+		mxit_add_html_link(mx, reply, _( "click here" ));
 	}
 }
 
============================================================
--- libpurple/protocols/mxit/login.c	0d0b5bd00861c8e7e39919e7325736574ceaf13a
+++ libpurple/protocols/mxit/login.c	0fa54f325318e2e34cc89441d94021093486982a
@@ -226,7 +226,7 @@ static void mxit_cb_register_ok( PurpleC
 	struct MXitProfile*		profile		= session->profile;
 	const char*				str;
 	const char*				pin;
-	char*					err			= NULL;
+	const char*				err			= NULL;
 	int						len;
 	int						i;
 
@@ -240,7 +240,7 @@ static void mxit_cb_register_ok( PurpleC
 	/* nickname */
 	str = purple_request_fields_get_string( fields, "nickname" );
 	if ( ( !str ) || ( strlen( str ) < 3 ) ) {
-		err = "The nick name you entered is invalid.";
+		err = _( "The nick name you entered is invalid." );
 		goto out;
 	}
 	g_strlcpy( profile->nickname, str, sizeof( profile->nickname ) );
@@ -248,37 +248,34 @@ static void mxit_cb_register_ok( PurpleC
 	/* birthdate */
 	str = purple_request_fields_get_string( fields, "bday" );
 	if ( ( !str ) || ( strlen( str ) < 10 ) || ( !validateDate( str ) ) ) {
-		err = "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'.";
+		err = _( "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." );
 		goto out;
 	}
 	g_strlcpy( profile->birthday, str, sizeof( profile->birthday ) );
 
 	/* gender */
-	if ( purple_request_fields_get_choice( fields, "male" ) == 0 )
-		profile->male = FALSE;
-	else
-		profile->male = TRUE;
+	profile->male = ( purple_request_fields_get_choice( fields, "male" ) == 0 );
 
 	/* pin */
 	pin = purple_request_fields_get_string( fields, "pin" );
 	if ( !pin ) {
-		err = "The PIN you entered is invalid.";
+		err = _( "The PIN you entered is invalid." );
 		goto out;
 	}
 	len = strlen( pin );
 	if ( ( len < 7 ) || ( len > 10 ) ) {
-		err = "The PIN you entered has an invalid length [7-10].";
+		err = _( "The PIN you entered has an invalid length [7-10]." );
 		goto out;
 	}
 	for ( i = 0; i < len; i++ ) {
 		if ( !g_ascii_isdigit( pin[i] ) ) {
-			err = "The PIN is invalid. It should only consist of digits [0-9].";
+			err = _( "The PIN is invalid. It should only consist of digits [0-9]." );
 			goto out;
 		}
 	}
 	str = purple_request_fields_get_string( fields, "pin2" );
 	if ( ( !str ) || ( strcmp( pin, str ) != 0 ) ) {
-		err = "The two PINs you entered does not match.";
+		err = _( "The two PINs you entered do not match." );
 		goto out;
 	}
 	g_strlcpy( profile->pin, pin, sizeof( profile->pin ) );
============================================================
--- libpurple/protocols/mxit/markup.c	61d4f8a207fb9b13eda7bde7a3e4985843df5f55
+++ libpurple/protocols/mxit/markup.c	5a0ff9401003fb598b836c3a09548984d2f888cc
@@ -66,16 +66,16 @@ static const char*	vibes[] = {
 
 /* vibes */
 static const char*	vibes[] = {
-	/* 0 */		"Cool Vibrations",
-	/* 1 */		"Purple Rain",
-	/* 2 */		"Polite",
-	/* 3 */		"Rock n Roll",
-	/* 4 */		"Summer Slumber",
-	/* 5 */		"Electric Razor",
-	/* 6 */		"S.O.S",
-	/* 7 */		"Jack Hammer",
-	/* 8 */		"Bumble Bee",
-	/* 9 */		"Ripple"
+	/* 0 */		N_( "Cool Vibrations" ),
+	/* 1 */		N_( "Purple Rain" ),
+	/* 2 */		N_( "Polite" ),
+	/* 3 */		N_( "Rock n Roll" ),
+	/* 4 */		N_( "Summer Slumber" ),
+	/* 5 */		N_( "Electric Razor" ),
+	/* 6 */		N_( "S.O.S" ),
+	/* 7 */		N_( "Jack Hammer" ),
+	/* 8 */		N_( "Bumble Bee" ),
+	/* 9 */		N_( "Ripple" )
 };
 
 
@@ -653,7 +653,7 @@ static int mxit_parse_vibe( struct RXMsg
 		return 0;
 	}
 
-	g_string_append_printf( mx->msg, "<font color=\"%s\"><i>%s Vibe...</i></font>", MXIT_VIBE_MSG_COLOR, vibes[vibeid] );
+	g_string_append_printf( mx->msg, "<font color=\"%s\"><i>%s Vibe...</i></font>", MXIT_VIBE_MSG_COLOR, _( vibes[vibeid] ) );
 	return 2;
 }
 
============================================================
--- libpurple/protocols/mxit/multimx.c	659a6a649cac7bce22de93782552be7c50969f80
+++ libpurple/protocols/mxit/multimx.c	dc8d63a9236f142c5a5f9f284a9b02d75aaefa47
@@ -408,7 +408,7 @@ GList* mxit_chat_info(PurpleConnection *
 
 	/* Configuration option: Room Name */
 	pce = g_new0(struct proto_chat_entry, 1);
-	pce->label = "_Room Name:";
+	pce->label = _( "_Room Name:" );
 	pce->identifier = "room";
 	pce->required = TRUE;
 	m = g_list_append(m, pce);
============================================================
--- libpurple/protocols/mxit/mxit.c	6570c0a6c1d176764ea35b1a750145910eeac6cf
+++ libpurple/protocols/mxit/mxit.c	2ffda78ddb853fa5934002321c985e9bb9ffc0d9
@@ -63,7 +63,7 @@ static void* mxit_link_click( const char
 	PurpleConnection*	con;
 	gchar**				parts	= NULL;
 	gchar*				link	= NULL;
-	unsigned int		len;
+	gsize				len;
 
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_link_click (%s)\n", link64 );
 
@@ -170,6 +170,7 @@ static void mxit_cb_chat_created( Purple
 	struct contact*		contact;
 	PurpleBuddy*		buddy;
 	const char*			who;
+	const char*			tmp;
 
 	gc = purple_conversation_get_gc( conv );
 	if ( session->con != gc ) {
@@ -204,6 +205,8 @@ static void mxit_cb_chat_created( Purple
 		case MXIT_TYPE_CHATROOM :
 		case MXIT_TYPE_GALLERY :
 		case MXIT_TYPE_INFO :
+				/* TODO: Allow "Loading menu..." to be localized (but not the HTML markup) */
+				tmp = _("Loading menu...");
 				serv_got_im( session->con, who, "<font color=\"#999999\">Loading menu...</font>\n", PURPLE_MESSAGE_NOTIFY, time( NULL ) );
 				mxit_send_message( session, who, " ", FALSE );
 		default :
@@ -343,7 +346,7 @@ static void mxit_tooltip( PurpleBuddy* b
 
 	/* hidden number */
 	if ( contact->flags & MXIT_CFLAG_HIDDEN )
-		purple_notify_user_info_add_pair( info, _( "Hidden Number" ), "Yes" );
+		purple_notify_user_info_add_pair( info, _( "Hidden Number" ), _( "Yes" ) );
 }
 
 
============================================================
--- libpurple/protocols/mxit/protocol.c	31ebea27f7e865e35eb1a9dbfa2e4dfb8b681846
+++ libpurple/protocols/mxit/protocol.c	ba0571fee728731252e2ad012874e7a950835755
@@ -1345,8 +1345,8 @@ static void mxit_parse_cmd_message( stru
 			name = purple_buddy_get_alias( buddy );
 		else
 			name = records[0]->fields[0]->data;
-		g_snprintf( msg, sizeof( msg ), "%s sent you an encrypted message, but it is not supported on this client.", name );
-		mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Error" ), _( msg ) );
+		g_snprintf( msg, sizeof( msg ), _( "%s sent you an encrypted message, but it is not supported on this client." ), name );
+		mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Error" ), msg );
 		return;
 	}
 
@@ -1938,7 +1938,7 @@ static int process_error_response( struc
 	if ( packet->errmsg )
 		errdesc = packet->errmsg;
 	else
-		errdesc = "An internal MXit server error occurred.";
+		errdesc = _( "An internal MXit server error occurred." );
 
 	purple_debug_info( MXIT_PLUGIN_ID, "Error Reply %i:%s\n", packet->errcode, errdesc );
 
@@ -1957,12 +1957,12 @@ static int process_error_response( struc
 					return 0;
 				}
 				else {
-					sprintf( errmsg, "Login error: %s (%i)", errdesc, packet->errcode );
+					sprintf( errmsg, _( "Login error: %s (%i)" ), errdesc, packet->errcode );
 					purple_connection_error( session->con, _( errmsg ) );
 					return -1;
 				}
 		case CP_CMD_LOGOUT :
-				sprintf( errmsg, "Logout error: %s (%i)", errdesc, packet->errcode );
+				sprintf( errmsg, _( "Logout error: %s (%i)" ), errdesc, packet->errcode );
 				purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _( errmsg ) );
 				return -1;
 		case CP_CMD_CONTACT :
============================================================
--- libpurple/protocols/mxit/roster.c	c966118a68bfffb28ec2649c7e0e2389f57ac486
+++ libpurple/protocols/mxit/roster.c	4cd7094c50231501e703b9984f0aa5e0e4101d77
@@ -53,11 +53,11 @@ static struct status
 	const char*				name;
 } const mxit_statuses[] = {
 		/*	primative,						no,							id,			name					*/
-		{	PURPLE_STATUS_OFFLINE,			MXIT_PRESENCE_OFFLINE,		"offline",	"Offline"			},	/* 0 */
-		{	PURPLE_STATUS_AVAILABLE,		MXIT_PRESENCE_ONLINE,		"online",	"Available"			},	/* 1 */
-		{	PURPLE_STATUS_AWAY,				MXIT_PRESENCE_AWAY,			"away",		"Away"				},	/* 2 */
-		{	PURPLE_STATUS_AVAILABLE,		MXIT_PRESENCE_AVAILABLE,	"chat",		"Chatty"			},	/* 3 */
-		{	PURPLE_STATUS_UNAVAILABLE,		MXIT_PRESENCE_DND,			"dnd",		"Do Not Disturb"	}	/* 4 */
+		{	PURPLE_STATUS_OFFLINE,			MXIT_PRESENCE_OFFLINE,		"offline",	NULL				},	/* 0 */
+		{	PURPLE_STATUS_AVAILABLE,		MXIT_PRESENCE_ONLINE,		"online",	NULL				},	/* 1 */
+		{	PURPLE_STATUS_AWAY,				MXIT_PRESENCE_AWAY,			"away",		NULL				},	/* 2 */
+		{	PURPLE_STATUS_AVAILABLE,		MXIT_PRESENCE_AVAILABLE,	"chat",		N_( "Chatty" )		},	/* 3 */
+		{	PURPLE_STATUS_UNAVAILABLE,		MXIT_PRESENCE_DND,			"dnd",		NULL				}	/* 4 */
 };
 
 
@@ -77,7 +77,7 @@ GList* mxit_status_types( PurpleAccount*
 		const struct status* status = &mxit_statuses[i];
 
 		/* add mxit status (reference: "libpurple/status.h") */
-		type = purple_status_type_new_with_attrs( status->primative, status->id, status->name, TRUE, TRUE, FALSE,
+		type = purple_status_type_new_with_attrs( status->primative, status->id, _( status->name ), TRUE, TRUE, FALSE,
 					"message", _( "Message" ), purple_value_new( PURPLE_TYPE_STRING ),
 					NULL );
 


More information about the Commits mailing list