From 7c70ddcc35a65e1078a7789832e5209a7a2e4a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20=C5=A0egan?= Date: Wed, 24 Mar 2004 00:18:02 +0000 Subject: Use ngettext for handling plural forms throughout (fixes bug 53464). svn path=/trunk/; revision=25168 --- addressbook/ChangeLog | 8 ++++++ addressbook/gui/widgets/e-addressbook-model.c | 5 +--- addressbook/gui/widgets/eab-gui-util.c | 7 ++++-- addressbook/gui/widgets/eab-vcard-control.c | 8 +++--- calendar/ChangeLog | 7 ++++++ calendar/gui/dialogs/delete-comp.c | 18 +++++++++----- calendar/gui/e-alarm-list.c | 35 ++++++++------------------- calendar/gui/e-itip-control.c | 35 +++++++-------------------- mail/ChangeLog | 5 ++++ mail/mail-ops.c | 8 ++++-- 10 files changed, 66 insertions(+), 70 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 27e23fed75..4cddb7f17f 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2004-03-24 Danilo Šegan + + * gui/widgets/e-addressbook-model.c (update_folder_bar_message): + Use ngettext for handling plural forms (fixes bug #53464). + * gui/widgets/eab-gui-util.c (eab_show_multiple_contacts): Likewise. + * gui/widgets/eab-vcard-control.c (pstream_load): Likewise. + + 2004-03-22 Chris Toshok [ fixes bug #53653, and a couple other instances ] diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index ed698e3340..725c7b687d 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -147,11 +147,8 @@ update_folder_bar_message (EABModel *model) case 0: message = g_strdup (_("No contacts")); break; - case 1: - message = g_strdup (_("1 contact")); - break; default: - message = g_strdup_printf (_("%d contacts"), count); + message = g_strdup_printf (ngettext("%d contact", "%d contacts", count), count); break; } diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index efa128e93a..7c9e540cbe 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -204,8 +204,11 @@ eab_show_multiple_contacts (EBook *book, 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 this contact?", + "Opening %d contacts will open %d new windows as well.\n" + "Do you really want to display all of these contacts?", + length), length, length); diff --git a/addressbook/gui/widgets/eab-vcard-control.c b/addressbook/gui/widgets/eab-vcard-control.c index c161333f15..7289851113 100644 --- a/addressbook/gui/widgets/eab-vcard-control.c +++ b/addressbook/gui/widgets/eab-vcard-control.c @@ -136,11 +136,9 @@ pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream, 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 one 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); diff --git a/calendar/ChangeLog b/calendar/ChangeLog index ea422277b8..8b93a91628 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2004-03-24 Danilo Šegan + + * gui/e-alarm-list.c (get_alarm_duration_string): Use ngettext for + handling plural forms (fixes bug #53464). + * gui/dialogs/delete-comp.c (delete_component_dialog): Likewise. + * gui/e-itip-control.c (write_recurrence_piece): Likewise. + 2004-03-23 JP Rosevear Fixes #51948 diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index 843f79ad3c..1c81598021 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -128,18 +128,24 @@ delete_component_dialog (ECalComponent *comp, } 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: diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c index c8b968600f..705e6bac54 100644 --- a/calendar/gui/e-alarm-list.c +++ b/calendar/gui/e-alarm-list.c @@ -391,43 +391,28 @@ get_alarm_duration_string (struct icaldurationtype *duration) 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")); + if (duration->days >= 1) { + g_string_sprintf (string, ngettext("%d day", "%d days", duration->days), duration->days); 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->weeks >= 1) { + g_string_sprintf (string, ngettext("%d week","%d weeks", duration->weeks), duration->weeks); 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->hours >= 1) { + g_string_sprintf (string, ngettext("%d hour", "%d hours", duration->hours), duration->hours); 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")); + if (duration->minutes >= 1) { + g_string_sprintf (string, ngettext("%d minute", "%d minutes", duration->minutes), duration->minutes); 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 >= 1) { + g_string_sprintf (string, ngettext("%d second", "%d seconds", duration->seconds), duration->seconds); have_something = TRUE; } diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index bff068a5b8..30a357a158 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -599,23 +599,14 @@ write_recurrence_piece (EItipControl *itip, ECalComponent *comp, switch (r->freq) { case ICAL_DAILY_RECURRENCE: - if (r->interval == 1) - strcpy (buffer, _("Every day")); - else - sprintf (buffer, _("Every %d days"), r->interval); + sprintf (buffer, ngettext("Every day", "Every %d days", r->interval), r->interval); break; case ICAL_WEEKLY_RECURRENCE: if (r->by_day[0] == ICAL_RECURRENCE_ARRAY_MAX) { - if (r->interval == 1) - strcpy (buffer, _("Every week")); - else - sprintf (buffer, _("Every %d weeks"), r->interval); + sprintf (buffer, ngettext("Every week", "Every %d weeks", r->interval), r->interval); } else { - if (r->interval == 1) - strcpy (buffer, _("Every week on ")); - else - sprintf (buffer, _("Every %d weeks on "), r->interval); + sprintf (buffer, ngettext("Every week on ", "Every %d weeks on ", r->interval), r->interval); for (i = 1; i < 8 && r->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) { if (i > 1) @@ -647,22 +638,14 @@ write_recurrence_piece (EItipControl *itip, ECalComponent *comp, nth (pos), get_dayname (r, 0)); } - if (r->interval == 1) - strcat (buffer, _("every month")); - else { - len = strlen (buffer); - buffer += len; - size -= len; - sprintf (buffer, _("every %d months"), r->interval); - } + len = strlen (buffer); + buffer += len; + size -= len; + sprintf (buffer, ngettext("every month","every %d months", r->interval), r->interval); break; case ICAL_YEARLY_RECURRENCE: - if (r->interval == 1) - strcpy (buffer, _("Every year")); - else { - sprintf (buffer, _("Every %d years"), r->interval); - } + sprintf (buffer, ngettext("Every year", "Every %d years", r->interval), r->interval); break; default: @@ -673,7 +656,7 @@ write_recurrence_piece (EItipControl *itip, ECalComponent *comp, buffer += len; size -= len; if (r->count) { - sprintf (buffer, _(" a total of %d times"), r->count); + sprintf (buffer, ngettext("a total of %d time", " a total of %d times", r->count), r->count); } else if (!icaltime_is_null_time (r->until)) { ECalComponentDateTime dt; diff --git a/mail/ChangeLog b/mail/ChangeLog index f57d52913b..ca6781ea58 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2004-03-24 Danilo Šegan + + * mail-ops.c (get_messages_desc): Use ngettext for handling plural + forms (fixes bug #53464). + 2004-03-23 Jeffrey Stedfast * em-format-html.c (emfh_gethttp): Use sizeof() to decide how big diff --git a/mail/mail-ops.c b/mail/mail-ops.c index ca2027c25d..d2e8a19c4e 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1835,7 +1835,9 @@ 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 +1921,9 @@ static char *save_messages_desc(struct _mail_msg *mm, int done) { 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", + "Saving %d messsages", m->uids->len), + m->uids->len); } static void -- cgit v1.2.3