[gnio] Mark translations in GSocket
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnio] Mark translations in GSocket
- Date: Tue, 5 May 2009 08:52:12 -0400 (EDT)
commit 1012d8c967f8678107136b8dceb23942acc8e178
Author: Alexander Larsson <alexl redhat com>
Date: Tue May 5 14:49:42 2009 +0200
Mark translations in GSocket
---
gio/Makefile.am | 2 +-
gio/gsocket.c | 93 ++++++++++++++++++++++++++---------------------
gio/gsocketconnection.c | 13 ++++++-
3 files changed, 65 insertions(+), 43 deletions(-)
diff --git a/gio/Makefile.am b/gio/Makefile.am
index 9e271ec..d4fa639 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libgnio.la
CLEANFILES = gnio.gir gnio.gi gnio.vapi $(BUILT_SOURCES)
BUILT_SOURCES = gnioenums.c gnioenums.h gnio-marshal.c gnio-marshal.h
-AM_CFLAGS = -I$(top_srcdir) $(gio_CFLAGS) -Wall -Wmissing-prototypes -DGIO_COMPILATION
+AM_CFLAGS = -I$(top_srcdir) $(gio_CFLAGS) -Wall -Wmissing-prototypes -DGIO_COMPILATION -DGETTEXT_PACKAGE=\"gnio\"
libgnio_la_LIBADD = $(gio_LIBS) $(gnutls_LIBS)
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 5150f29..b1b41c8 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -23,6 +23,15 @@
* Ryan Lortie <desrt desrt ca>
*/
+/* TODO: On glib merge, switch this */
+#if 0
+#include "config.h"
+#include "glibintl.h"
+#else
+#include <glib/gi18n-lib.h>
+#define P_(String) _(String)
+#endif
+
#include "gsocket.h"
#include <errno.h>
@@ -47,6 +56,8 @@
#include "gnioenums.h"
#include <gio/gioerror.h>
+
+
G_DEFINE_TYPE (GSocket, g_socket, G_TYPE_OBJECT);
enum
@@ -172,14 +183,14 @@ check_socket (GSocket *socket,
if (socket->priv->construct_error)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
- "Invalid socket, creation failed due to: %s",
+ _("Invalid socket, creation failed due to: %s"),
socket->priv->construct_error->message);
return FALSE;
}
if (socket->priv->closed)
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED,
- "Socket is already closed");
+ _("Socket is already closed"));
return FALSE;
}
return TRUE;
@@ -326,7 +337,7 @@ g_socket_details_from_fd (GSocket *socket)
err:
g_set_error (&socket->priv->construct_error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "creating GSocket from fd: %s",
+ _("creating GSocket from fd: %s"),
socket_strerror (errsv));
}
@@ -376,7 +387,7 @@ g_socket_create_socket (GSocketFamily family,
if (protoent == NULL)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- "unable to create socket: Protocol %s not supported",
+ _("unable to create socket: Protocol %s not supported"),
protocol_name);
return -1;
}
@@ -390,7 +401,7 @@ g_socket_create_socket (GSocketFamily family,
int errsv = get_socket_errno ();
g_set_error (error, G_IO_ERROR, socket_io_error_from_errno (errsv),
- "unable to create socket: %s", socket_strerror (errsv));
+ _("unable to create socket: %s"), socket_strerror (errsv));
}
return fd;
@@ -574,31 +585,31 @@ g_socket_class_init (GSocketClass *klass)
g_object_class_install_property (gobject_class, PROP_DOMAIN,
g_param_spec_enum ("family",
- "socket family",
- "the socket's address family",
+ P_("Socket family"),
+ P_("The sockets address family"),
G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_TYPE,
g_param_spec_enum ("type",
- "socket type",
- "the socket's type",
+ P_("Socket type"),
+ P_("The sockets type"),
G_TYPE_SOCKET_TYPE,
G_SOCKET_TYPE_STREAM,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PROTOCOL,
g_param_spec_string ("protocol",
- "socket protocol",
- "the protocol to use, or NULL",
+ P_("Socket protocol"),
+ P_("The name of the protocol to use, or NULL"),
NULL,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_FD,
g_param_spec_int ("fd",
- "file descriptor",
- "the socket's file descriptor",
+ P_("File descriptor"),
+ P_("The sockets file descriptor"),
G_MININT,
G_MAXINT,
-1,
@@ -606,15 +617,15 @@ g_socket_class_init (GSocketClass *klass)
g_object_class_install_property (gobject_class, PROP_BLOCKING,
g_param_spec_boolean ("blocking",
- "blocking",
- "whether or not this socket is blocking",
+ P_("blocking"),
+ P_("Whether or not I/O on this socket is blocking"),
TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_LISTEN_BACKLOG,
g_param_spec_int ("listen-backlog",
- "listen backlog",
- "outstanding connections in the listen queue",
+ P_("Listen backlog"),
+ P_("outstanding connections in the listen queue"),
0,
SOMAXCONN,
10,
@@ -622,29 +633,29 @@ g_socket_class_init (GSocketClass *klass)
g_object_class_install_property (gobject_class, PROP_REUSE_ADDRESS,
g_param_spec_boolean ("reuse-address",
- "reuse address",
- "allow reuse of local addresses when binding",
+ P_("Reuse address"),
+ P_("Allow reuse of local addresses when binding"),
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_KEEPALIVE,
g_param_spec_boolean ("keepalive",
- "keep connection alive",
- "keep connection alive by sending periodic pings",
+ P_("Keep connection alive"),
+ P_("Keep connection alive by sending periodic pings"),
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_LOCAL_ADDRESS,
g_param_spec_object ("local-address",
- "local address",
- "the local address the socket is bound to",
+ P_("Local address"),
+ P_("The local address the socket is bound to"),
G_TYPE_SOCKET_ADDRESS,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_REMOTE_ADDRESS,
g_param_spec_object ("remote-address",
- "remote address",
- "the remote address the socket is connected to",
+ P_("Remote address"),
+ P_("The remote address the socket is connected to"),
G_TYPE_SOCKET_ADDRESS,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
@@ -834,7 +845,7 @@ g_socket_get_local_address (GSocket *socket,
{
int errsv = get_socket_errno ();
g_set_error (error, G_IO_ERROR, socket_io_error_from_errno (errsv),
- "could not get local address: %s", socket_strerror (errsv));
+ _("could not get local address: %s"), socket_strerror (errsv));
return NULL;
}
@@ -858,7 +869,7 @@ g_socket_get_remote_address (GSocket *socket,
{
int errsv = get_socket_errno ();
g_set_error (error, G_IO_ERROR, socket_io_error_from_errno (errsv),
- "could not get remote address: %s", socket_strerror (errsv));
+ _("could not get remote address: %s"), socket_strerror (errsv));
return NULL;
}
@@ -903,7 +914,7 @@ g_socket_listen (GSocket *socket,
int errsv = get_socket_errno ();
g_set_error (error, G_IO_ERROR, socket_io_error_from_errno (errsv),
- "could not listen: %s", socket_strerror (errsv));
+ _("could not listen: %s"), socket_strerror (errsv));
return FALSE;
}
@@ -932,7 +943,7 @@ g_socket_bind (GSocket *socket,
int errsv = get_socket_errno ();
g_set_error (error,
G_IO_ERROR, socket_io_error_from_errno (errsv),
- "error binding to address: %s", socket_strerror (errsv));
+ _("Error binding to address: %s"), socket_strerror (errsv));
return FALSE;
}
@@ -967,7 +978,7 @@ g_socket_accept (GSocket *socket,
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "error accepting connection: %s", socket_strerror (errsv));
+ _("Error accepting connection: %s"), socket_strerror (errsv));
return NULL;
}
break;
@@ -1029,11 +1040,11 @@ g_socket_connect (GSocket *socket,
if (errsv == WSAEINPROGRESS)
#endif
g_set_error (error, G_IO_ERROR, G_IO_ERROR_PENDING,
- "connection in progress");
+ _("Connection in progress"));
else
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "error connecting: %s", socket_strerror (errsv));
+ _("Error connecting: %s"), socket_strerror (errsv));
return FALSE;
}
@@ -1073,7 +1084,7 @@ g_socket_receive (GSocket *socket,
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "error receiving data: %s", socket_strerror (errsv));
+ _("Error receiving data: %s"), socket_strerror (errsv));
return -1;
}
@@ -1114,7 +1125,7 @@ g_socket_send (GSocket *socket,
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "error sending data: %s", socket_strerror (errsv));
+ _("Error sending data: %s"), socket_strerror (errsv));
return -1;
}
break;
@@ -1153,7 +1164,7 @@ g_socket_close (GSocket *socket,
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "Error closing sockete: %s",
+ _("Error closing socket: %s"),
socket_strerror (errsv));
}
break;
@@ -1603,7 +1614,7 @@ g_socket_condition_wait (GSocket *socket,
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "waiting for socket condition: %s",
+ _("Waiting for socket condition: %s"),
socket_strerror (errsv));
break;
}
@@ -1761,7 +1772,7 @@ g_socket_send_message (GSocket *socket,
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "sendmsg: %s", socket_strerror (errsv));
+ _("Error sending message: %s"), socket_strerror (errsv));
return -1;
}
@@ -1786,7 +1797,7 @@ g_socket_send_message (GSocket *socket,
if (num_messages != 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- "GSocketControlMessage not supported on windows");
+ _("GSocketControlMessage not supported on windows"));
return -1;
}
@@ -1831,7 +1842,7 @@ g_socket_send_message (GSocket *socket,
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "WSASendTo: %s", socket_strerror (errsv));
+ _("Error sending message: %s"), socket_strerror (errsv));
return -1;
}
@@ -1994,7 +2005,7 @@ g_socket_receive_message (GSocket *socket,
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "recvmsg: %s", socket_strerror (errsv));
+ _("Error recieving message: %s"), socket_strerror (errsv));
return -1;
}
@@ -2120,7 +2131,7 @@ g_socket_receive_message (GSocket *socket,
win32_unset_event_mask (socket, FD_READ);
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
- "WSARecvFrom: %s", socket_strerror (errsv));
+ _("Error recieving message: %s"), socket_strerror (errsv));
return -1;
}
diff --git a/gio/gsocketconnection.c b/gio/gsocketconnection.c
index bbdd3fb..3d9a7c1 100644
--- a/gio/gsocketconnection.c
+++ b/gio/gsocketconnection.c
@@ -23,6 +23,15 @@
* Ryan Lortie <desrt desrt ca>
*/
+/* TODO: On glib merge, switch this */
+#if 0
+#include "config.h"
+#include "glibintl.h"
+#else
+#include <glib/gi18n-lib.h>
+#define P_(String) _(String)
+#endif
+
#include "gsocketconnection.h"
#include "gsocketoutputstream.h"
@@ -158,7 +167,9 @@ g_socket_connection_class_init (GSocketConnectionClass *klass)
gobject_class->finalize = g_socket_connection_finalize;
g_object_class_install_property (gobject_class, PROP_SOCKET,
- g_param_spec_object ("socket", "socket", "the underlying GSocket",
+ g_param_spec_object ("socket",
+ P_("Socket"),
+ P_("The underlying GSocket"),
G_TYPE_SOCKET, G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]