From 40a79b6599ac2619ae8f0d8a54baa4662496809b Mon Sep 17 00:00:00 2001 From: Chidambar Zinnoury Date: Sun, 15 Jul 2012 08:23:19 +0000 Subject: [PATCH] e fm: add plural support for the delete confirmation dialog. Here the singular version is not used in english, but plural support is nonetheless needed for languages who have multiple plurals depending on the number of files. Bonus: add a complementary dialog for when you're trying to delete all the files in the folder. SVN revision: 73868 --- src/bin/e_fm.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 05cb15d87..98038810c 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -9390,6 +9390,7 @@ _e_fm2_file_delete(Evas_Object *obj) E_Fm2_Icon *ic; char text[4096 + 256]; Eina_List *sel; + int n, folder_count; man = e_manager_current_get(); if (!man) return; @@ -9408,19 +9409,35 @@ _e_fm2_file_delete(Evas_Object *obj) e_dialog_title_set(dialog, _("Confirm Delete")); e_dialog_icon_set(dialog, "dialog-warning", 64); sel = e_fm2_selected_list_get(obj); - if ((!sel) || (eina_list_count(sel) == 1)) + if (sel) + { + n = eina_list_count(sel); + folder_count = eina_list_count(ic->sd->icons); + } + if ((!sel) || (n == 1)) snprintf(text, sizeof(text), _("Are you sure you want to delete
" - "%s ?"), + "%s?"), ic->info.file); + else if (n == folder_count) + snprintf(text, sizeof(text), + _("Are you sure you want to delete
" + "all the %d files in
" + "%s?"), + n, ic->sd->realpath); else { + /* Here the singular version is not used in english, but plural support + * is nonetheless needed for languages who have multiple plurals + * depending on the number of files. */ snprintf(text, sizeof(text), - _("Are you sure you want to delete
" - "the %d selected files in:
" - "%s ?"), - eina_list_count(sel), - ic->sd->realpath); + P_("Are you sure you want to delete
" + "the %d selected file in
" + "%s?", + "Are you sure you want to delete
" + "the %d selected files in
" + "%s?", n), + n, ic->sd->realpath); } if (sel) eina_list_free(sel); e_dialog_text_set(dialog, text);