[RESEND] Re: [evolution-patches] [PATCH] Use ngettext (partitially)
- From: Christian Neumair <chris gnome-de org>
- To: evolution-patches ximian com
- Subject: [RESEND] Re: [evolution-patches] [PATCH] Use ngettext (partitially)
- Date: Tue, 06 Jan 2004 15:38:15 +0100
On Sa, 2003-12-13 at 19:01 +0100, Christian Neumair wrote:
> More info on ngettext can be found under [1]. It's already used by most
> of the GNOME core software, at least on HEAD.
> Don't wonder if something like
> if (count > 5)
> const *str = ngettext ("%d time", "%d times", count);
> happens. Some non-roman languages really need this grammatically-wise.
Resend, bunzip2'ed.
regs,
Chris
Index: addressbook/gui/widgets/e-addressbook-model.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-model.c,v
retrieving revision 1.57
diff -u -r1.57 e-addressbook-model.c
--- addressbook/gui/widgets/e-addressbook-model.c 5 Dec 2003 18:30:58 -0000 1.57
+++ addressbook/gui/widgets/e-addressbook-model.c 13 Dec 2003 18:00:30 -0000
@@ -143,17 +143,13 @@
count = model->data_count;
- switch (count) {
- case 0:
+ if (count == 0)
message = g_strdup (_("No contacts"));
- break;
- case 1:
- message = g_strdup (_("1 contact"));
- break;
- default:
- message = g_strdup_printf (_("%d contacts"), count);
- break;
- }
+ else
+ message = g_strdup_printf (ngettext ("%d contact",
+ "%d contacts",
+ count),
+ count);
g_signal_emit (model,
eab_model_signals [FOLDER_BAR_MESSAGE], 0,
Index: addressbook/gui/widgets/eab-gui-util.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-gui-util.c,v
retrieving revision 1.4
diff -u -r1.4 eab-gui-util.c
--- addressbook/gui/widgets/eab-gui-util.c 3 Dec 2003 15:38:29 -0000 1.4
+++ addressbook/gui/widgets/eab-gui-util.c 13 Dec 2003 18:00:30 -0000
@@ -201,8 +201,11 @@
0,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
- _("Opening %d contacts will open %d new windows as well.\n"
- "Do you really want to display all of these contacts?"),
+ ngettext ("Opening %d contact will open %d new window as well.\n"
+ "Do you really want to display all of these contacts?",
+ "Opening %d contacts will open %d new windows as well.\n"
+ "Do you really want to display all of these contacts?",
+ length),
length,
length);
Index: addressbook/gui/widgets/eab-vcard-control.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-vcard-control.c,v
retrieving revision 1.4
diff -u -r1.4 eab-vcard-control.c
--- addressbook/gui/widgets/eab-vcard-control.c 1 Dec 2003 22:14:17 -0000 1.4
+++ addressbook/gui/widgets/eab-vcard-control.c 13 Dec 2003 18:00:30 -0000
@@ -136,11 +136,11 @@
if (list && list->next) {
char *message;
int length = g_list_length (list) - 1;
- if (length > 1) {
- message = g_strdup_printf (_("and %d other contacts."), length);
- } else {
- message = g_strdup_printf (_("and one other contact."));
- }
+
+ message = g_strdup_printf (ngettext ("and %d other contact",
+ "and %d other contacts",
+ length),
+ length);
gtk_label_set_text (GTK_LABEL (vcard_control->label), message);
g_free (message);
gtk_widget_show (vcard_control->label);
Index: calendar/gui/e-alarm-list.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-alarm-list.c,v
retrieving revision 1.5
diff -u -r1.5 e-alarm-list.c
--- calendar/gui/e-alarm-list.c 7 Nov 2003 05:51:58 -0000 1.5
+++ calendar/gui/e-alarm-list.c 13 Dec 2003 18:00:31 -0000
@@ -393,43 +393,46 @@
have_something = FALSE;
- if (duration->days > 1) {
- g_string_sprintf (string, _("%d days"), duration->days);
- have_something = TRUE;
- } else if (duration->days == 1) {
- g_string_append (string, _("1 day"));
- have_something = TRUE;
- }
-
- if (duration->weeks > 1) {
- g_string_sprintf (string, _("%d weeks"), duration->weeks);
- have_something = TRUE;
- } else if (duration->weeks == 1) {
- g_string_append (string, _("1 week"));
+ if (duration->days > 0) {
+ g_string_sprintf (string,
+ ngettext ("%d day",
+ "%d days",
+ duration->days),
+ duration->days);
have_something = TRUE;
}
- if (duration->hours > 1) {
- g_string_sprintf (string, _("%d hours"), duration->hours);
- have_something = TRUE;
- } else if (duration->hours == 1) {
- g_string_append (string, _("1 hour"));
+ if (duration->weeks > 0) {
+ g_string_sprintf (string,
+ ngettext ("%d week",
+ "%d weeks",
+ duration->weeks),
+ duration->weeks);
+ }
+
+ if (duration->hours > 0) {
+ g_string_sprintf (string,
+ ngettext ("%d hour",
+ "%d hours",
+ duration->hours),
+ duration->hours);
+ }
+
+ if (duration->minutes > 0) {
+ g_string_sprintf (string,
+ ngettext ("%d minute",
+ "%d minutes",
+ duration->minutes),
+ duration->minutes);
have_something = TRUE;
}
- if (duration->minutes > 1) {
- g_string_sprintf (string, _("%d minutes"), duration->minutes);
- have_something = TRUE;
- } else if (duration->minutes == 1) {
- g_string_append (string, _("1 minute"));
- have_something = TRUE;
- }
-
- if (duration->seconds > 1) {
- g_string_sprintf (string, _("%d seconds"), duration->seconds);
- have_something = TRUE;
- } else if (duration->seconds == 1) {
- g_string_append (string, _("1 second"));
+ if (duration->seconds > 0) {
+ g_string_sprintf (string,
+ ngettext ("%d second",
+ "%d seconds",
+ duration->seconds),
+ duration->seconds);
have_something = TRUE;
}
Index: calendar/gui/dialogs/delete-comp.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/delete-comp.c,v
retrieving revision 1.19
diff -u -r1.19 delete-comp.c
--- calendar/gui/dialogs/delete-comp.c 20 Nov 2003 15:11:40 -0000 1.19
+++ calendar/gui/dialogs/delete-comp.c 13 Dec 2003 18:00:31 -0000
@@ -128,18 +128,30 @@
} else {
switch (vtype) {
case E_CAL_COMPONENT_EVENT:
- str = g_strdup_printf (_("Are you sure you want to delete "
- "%d appointments?"), n_comps);
+ str = g_strdup_printf (ngettext ("Are you sure you want to delete "
+ "%d appointment?",
+ "Are you sure you want to delete "
+ "%d appointments?",
+ n_comps),
+ n_comps);
break;
case E_CAL_COMPONENT_TODO:
- str = g_strdup_printf (_("Are you sure you want to delete "
- "%d tasks?"), n_comps);
+ str = g_strdup_printf (ngettext ("Are you sure you want to delete "
+ "%d task?",
+ "Are you sure you want to delete "
+ "%d tasks?",
+ n_comps),
+ n_comps);
break;
case E_CAL_COMPONENT_JOURNAL:
- str = g_strdup_printf (_("Are you sure you want to delete "
- "%d journal entries?"), n_comps);
+ str = g_strdup_printf (ngettext ("Are you sure you want to delete "
+ "%d journal entry?",
+ "Are you sure you want to delete "
+ "%d journal entries?",
+ n_comps),
+ n_comps);
break;
default:
Index: mail/mail-ops.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.c,v
retrieving revision 1.407
diff -u -r1.407 mail-ops.c
--- mail/mail-ops.c 4 Dec 2003 20:31:48 -0000 1.407
+++ mail/mail-ops.c 13 Dec 2003 18:00:34 -0000
@@ -1831,11 +1831,14 @@
void *data;
};
-static char * get_messages_desc(struct _mail_msg *mm, int done)
+static char *get_messages_desc(struct _mail_msg *mm, int done)
{
struct _get_messages_msg *m = (struct _get_messages_msg *)mm;
- return g_strdup_printf(_("Retrieving %d message(s)"), m->uids->len);
+ return g_strdup_printf (ngettext ("Retrieving %d message",
+ "Retrieving %d messages",
+ m->uids->len),
+ m->uids->len);
}
static void get_messages_get(struct _mail_msg *mm)
@@ -1919,7 +1922,10 @@
{
struct _save_messages_msg *m = (struct _save_messages_msg *)mm;
- return g_strdup_printf(_("Saving %d messsage(s)"), m->uids->len);
+ return g_strdup_printf (ngettext ("Saving %d message",
+ "Savind %d messages",
+ m->uids->len),
+ m->uids->len);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]