[dia] Bug 659393 - Improve i18n plural handling for some messages
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Bug 659393 - Improve i18n plural handling for some messages
- Date: Sun, 21 Jul 2013 15:28:39 +0000 (UTC)
commit 84744505f1688d7a8db249d11683fe11d0ba8fc4
Author: Hans Breuer <hans breuer org>
Date: Sun Jul 21 17:27:57 2013 +0200
Bug 659393 - Improve i18n plural handling for some messages
Even the ones which have no singular form need it, see:
https://live.gnome.org/TranslationProject/DevGuidelines/Plurals
app/confirm.c | 15 +++++++++++----
lib/message.c | 7 +++++--
lib/prop_text.c | 9 ++++++---
3 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/app/confirm.c b/app/confirm.c
index 3c0b70e..c9f9a76 100644
--- a/app/confirm.c
+++ b/app/confirm.c
@@ -65,13 +65,20 @@ confirm_export_size (Diagram *dia, GtkWindow *parent, guint flags)
#else
size = g_format_size_for_display (bytes);
#endif
+ /* See: https://live.gnome.org/TranslationProject/DevGuidelines/Plurals */
if (flags & CONFIRM_PRINT)
- msg = g_strdup_printf (_("You are about to print a diagram with %d pages."), pages);
+ msg = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+ "You are about to print a diagram with %d page.", /* not triggered */
+ "You are about to print a diagram with %d pages.", pages), pages);
else if ((flags & ~CONFIRM_PAGES) == 0)
- msg = g_strdup_printf (_("You are about to export a diagram with %d pages."), pages);
+ msg = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+ "You are about to export a diagram with %d page.", /* not triggered */
+ "You are about to export a diagram with %d pages.", pages), pages);
else
- msg = g_strdup_printf (_("You are about to export a diagram "
- "which may require %s of memory.(%d pages)."), size, pages);
+ msg = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+ "You are about to export a diagram which may require %s of memory.(%d page).",
+ "You are about to export a diagram which may require %s of memory.(%d pages).", pages),
+ size, pages);
dialog = gtk_message_dialog_new (parent, /* diagrams display 'shell' */
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
diff --git a/lib/message.c b/lib/message.c
index c30168a..b0e1737 100644
--- a/lib/message.c
+++ b/lib/message.c
@@ -200,8 +200,11 @@ gtk_message_internal(const char* title, enum ShowAgainStyle showAgain,
if (msginfo->repeats != NULL) {
if (g_list_length(msginfo->repeats) > 1) {
char *newlabel;
- newlabel = g_strdup_printf(_("There are %d similar messages."),
- g_list_length(msginfo->repeats));
+ guint num = g_list_length(msginfo->repeats);
+ /* See: https://live.gnome.org/TranslationProject/DevGuidelines/Plurals */
+ newlabel = g_strdup_printf(g_dngettext (GETTEXT_PACKAGE,
+ "There is %d similar message.", /* not triggered */
+ "There are %d similar messages.", num), num);
gtk_label_set_text(GTK_LABEL(msginfo->repeat_label), newlabel);
}
/* for repeated messages, show the last one */
diff --git a/lib/prop_text.c b/lib/prop_text.c
index 1bd73b7..3d517d2 100644
--- a/lib/prop_text.c
+++ b/lib/prop_text.c
@@ -477,9 +477,12 @@ object_get_displayname (DiaObject* object)
if (!object)
return g_strdup ("<null>"); /* should not happen */
- if (IS_GROUP(object))
- name = g_strdup_printf (_("Group with %d objects"), g_list_length(group_objects(object)));
- else if ((prop = object_prop_by_name(object, "name")) != NULL)
+ if (IS_GROUP(object)) {
+ guint num = g_list_length(group_objects(object));
+ name = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+ "Group with %d object",
+ "Group with %d objects", num), num);
+ } else if ((prop = object_prop_by_name(object, "name")) != NULL)
name = g_strdup (((StringProperty *)prop)->string_data);
else if ((prop = object_prop_by_name(object, "text")) != NULL)
name = g_strdup (((TextProperty *)prop)->text_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]