aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2009-06-19 04:16:51 +0800
committerWill Thompson <will.thompson@collabora.co.uk>2009-06-19 04:16:51 +0800
commit08f02f53a10fd653cac56e23817f3c40d636ca5e (patch)
tree2fb3c1406c6a3517c6140c1fad942561bd4b0998 /libempathy-gtk/empathy-chat.c
parent28acd3ce10a88f912f0d3f42d14c2e5a98d619bd (diff)
downloadgsoc2013-empathy-08f02f53a10fd653cac56e23817f3c40d636ca5e.tar
gsoc2013-empathy-08f02f53a10fd653cac56e23817f3c40d636ca5e.tar.gz
gsoc2013-empathy-08f02f53a10fd653cac56e23817f3c40d636ca5e.tar.bz2
gsoc2013-empathy-08f02f53a10fd653cac56e23817f3c40d636ca5e.tar.lz
gsoc2013-empathy-08f02f53a10fd653cac56e23817f3c40d636ca5e.tar.xz
gsoc2013-empathy-08f02f53a10fd653cac56e23817f3c40d636ca5e.tar.zst
gsoc2013-empathy-08f02f53a10fd653cac56e23817f3c40d636ca5e.zip
Reduce format string duplication for part notifications.
Xavier suggested that just appending " (%s)" to the common prefix when there is a message is probably okay from a translation point of view, as long as there's a comment to translators.
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c83
1 files changed, 33 insertions, 50 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index c3fc7948f..04b0cbd0f 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1159,60 +1159,43 @@ build_part_message (guint reason,
const gchar *actor,
const gchar *message)
{
+ GString *s = g_string_new ("");
+
/* Having an actor only really makes sense for a few actions... */
- if (message == NULL) {
- switch (reason) {
- case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE:
- return g_strdup_printf (_("%s has disconnected"), name);
- case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED:
- if (actor != NULL) {
- return g_strdup_printf (
- _("%s was kicked by %s"), name, actor);
- } else {
- return g_strdup_printf (_("%s was kicked"),
- name);
- }
- case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED:
- if (actor != NULL) {
- return g_strdup_printf (
- _("%s was banned by %s"), name, actor);
- } else {
- return g_strdup_printf (_("%s was banned"),
- name);
- }
- default:
- return g_strdup_printf (_("%s has left the room"),
- name);
+ switch (reason) {
+ case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE:
+ g_string_append_printf (s, _("%s has disconnected"), name);
+ break;
+ case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED:
+ if (actor != NULL) {
+ g_string_append_printf (s, _("%s was kicked by %s"),
+ name, actor);
+ } else {
+ g_string_append_printf (s, _("%s was kicked"), name);
}
- } else {
- switch (reason) {
- case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE:
- return g_strdup_printf (_("%s has disconnected (%s)"),
- name, message);
- case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED:
- if (actor != NULL) {
- return g_strdup_printf (
- _("%s was kicked by %s (%s)"), name,
- actor, message);
- } else {
- return g_strdup_printf (
- _("%s was kicked (%s)"),
- name, message);
- }
- case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED:
- if (actor != NULL) {
- return g_strdup_printf (
- _("%s was banned by %s (%s)"), name,
- actor, message);
- } else {
- return g_strdup_printf (_("%s was banned (%s)"),
- name, message);
- }
- default:
- return g_strdup_printf (_("%s has left the room (%s)"),
- name, message);
+ break;
+ case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED:
+ if (actor != NULL) {
+ g_string_append_printf (s, _("%s was banned by %s"),
+ name, actor);
+ } else {
+ g_string_append_printf (s, _("%s was banned"), name);
}
+ break;
+ default:
+ g_string_append_printf (s, _("%s has left the room"), name);
}
+
+ if (message != NULL) {
+ /* Note to translators: this string is appended to
+ * notifications like "foo has left the room", with the message
+ * given by the user living the room. If this poses a problem,
+ * please let us know. :-)
+ */
+ g_string_append_printf (s, _(" (%s)"), message);
+ }
+
+ return g_string_free (s, FALSE);
}
static void