After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771586 - batch rename: Reword "Rename %d files/folders" as "Rename %d items"
batch rename: Reword "Rename %d files/folders" as "Rename %d items"
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
3.21.x
Other Linux
: Normal minor
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-17 10:34 UTC by Mohammed Sadiq
Modified: 2016-11-22 11:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
file: reword "items" to "files and folders" (1.60 KB, patch)
2016-09-29 07:28 UTC, Carlos Soriano
committed Details | Review
batch-rename: Reword "Rename %d files/folders" as "Rename %d items" (2.88 KB, patch)
2016-10-12 17:50 UTC, Neha Yadav
none Details | Review
batch-rename: Reword "Rename %d files/folders" as "Rename %d items" (2.62 KB, patch)
2016-10-25 17:17 UTC, Neha Yadav
accepted-commit_now Details | Review
batch-rename: Reword "Rename %d files/folders" as "Rename %d files" (2.62 KB, patch)
2016-10-27 08:05 UTC, Neha Yadav
none Details | Review
batch-rename: Reword "Rename %d files/folders" as "Rename %d files" (2.62 KB, patch)
2016-11-03 09:19 UTC, Neha Yadav
reviewed Details | Review
batch-rename : Reword "Rename %d files/folders" as "Rename %d files" (2.68 KB, patch)
2016-11-03 14:59 UTC, Neha Yadav
committed Details | Review
batch-rename-dialog: mark string for translation (2.18 KB, patch)
2016-11-10 12:42 UTC, Carlos Soriano
committed Details | Review

Description Mohammed Sadiq 2016-09-17 10:34:01 UTC
The string "Rename %d files" may not be the right term when the selected items contains both files and folders.

It might be better to use "Rename %d items" which can be used both for Files and Folders.
Comment 1 Carlos Soriano 2016-09-19 09:42:31 UTC
Items is not very understandable. We use "files and folders". But yeah good idea, we need to do this all over Nautilus.
Comment 2 Neha Yadav 2016-09-27 17:02:22 UTC
Can anyone help me with this bug. I build nautilus.
Comment 3 Carlos Soriano 2016-09-28 09:11:30 UTC
(In reply to Neha yadav from comment #2)
> Can anyone help me with this bug. I build nautilus.

look at batch-rename-dialog.c and try to search for those strings mentioned in the comment above "Rename %d files"
Comment 4 Neha Yadav 2016-09-28 20:17:13 UTC
(In reply to Carlos Soriano from comment #3)
> look at batch-rename-dialog.c and try to search for those strings mentioned
> in the comment above "Rename %d files"

I found it "Rename %d files".
Now my question is shall I only remove "Rename %d files" and use "Rename %d items" or anything else needed.
Comment 5 Carlos Soriano 2016-09-29 07:28:01 UTC
(In reply to Neha yadav from comment #4)
> (In reply to Carlos Soriano from comment #3)
> > look at batch-rename-dialog.c and try to search for those strings mentioned
> > in the comment above "Rename %d files"
> 
> I found it "Rename %d files".
> Now my question is shall I only remove "Rename %d files" and use "Rename %d
> items" or anything else needed.

We need to make a differentiation between when all of them are files "Rename %d files", when all of them are folders "Rename %d folders" and when there is a mix between files and folders "Rename %d folders and files".
For do this difference in several places, for example, in batch-rename-dialog or nautilus-file. You can search for "folders".

I'm attaching here a patch to rework the nautilus-file.c example, since currently it's using items. You can follow a similar pattern for batch-rename.
Comment 6 Carlos Soriano 2016-09-29 07:28:45 UTC
Created attachment 336483 [details] [review]
file: reword "items" to "files and folders"

It looks more explicit and clear than using items.
Comment 7 Mohammed Sadiq 2016-09-29 08:30:05 UTC
(In reply to Carlos Soriano from comment #6)
> Created attachment 336483 [details] [review] [review]
> file: reword "items" to "files and folders"
> 
> It looks more explicit and clear than using items.

"%'u files and folders" (instead of simply items) may be a long string which could break the design in some locales.
Comment 8 Carlos Soriano 2016-09-29 09:21:25 UTC
(In reply to Mohammed Sadiq from comment #7)
> (In reply to Carlos Soriano from comment #6)
> > Created attachment 336483 [details] [review] [review] [review]
> > file: reword "items" to "files and folders"
> > 
> > It looks more explicit and clear than using items.
> 
> "%'u files and folders" (instead of simply items) may be a long string which
> could break the design in some locales.

The widgets will supposedly grow, if not, it's a bug.
Comment 9 Carlos Soriano 2016-10-04 20:22:19 UTC
Review of attachment 336483 [details] [review]:

my own patch review
Comment 10 Neha Yadav 2016-10-12 17:50:59 UTC
Created attachment 337523 [details] [review]
batch-rename: Reword "Rename %d files/folders" as "Rename %d items"

The problem is that when we select both folder and file then string
"Rename %d files" appears which may not be the right term when
the selected items contains both files and folders.

To solve this issue we rename the string and now in place of sting
"Rename %d files" we use "Rename %d Files and Folders" for both file
and folder.
Comment 11 Carlos Soriano 2016-10-25 10:01:43 UTC
Review of attachment 337523 [details] [review]:

Hey Neha, good progress on this! You are pretty close.

::: src/nautilus-batch-rename-dialog.c
@@ +2132,3 @@
     GList *l;
     gboolean all_targets_are_folders;
+    gboolean all_targets_are_files;

I know this is slightly confusing, but all folders and files are "files". You need to differenciate "regular files" so this boolean should be called all_targets_are_regular_files instead.

@@ +2146,3 @@
     for (l = selection; l != NULL; l = l->next)
     {
+        if (nautilus_file_is_regular_file (NAUTILUS_FILE (l->data)))

you actually want to know whether some of the files doesn't go with the logic you want. This is exactly !nautilus_file_is_directory, rather than checking if it's a regular file.

@@ +2156,3 @@
+    for (l = selection; l != NULL; l = l->next)
+    {
+        if (nautilus_file_is_directory (NAUTILUS_FILE (l->data)))

here's is similar to previously, but the other way around. You want to check if all files are regular files. This is not done by checking whether they are something else, but rather whether they are not regular files.
Comment 12 Neha Yadav 2016-10-25 17:17:32 UTC
Created attachment 338443 [details] [review]
batch-rename: Reword "Rename %d files/folders" as "Rename %d items"

The problem is that when we select both folder and file then string
"Rename %d files" appears which may not be the right term when
the selected items contains both files and folders.

To solve this issue we rename the string and now in place of string
"Rename %d files" we use "Rename %d Files and Folders" for both file
and folder.
Comment 13 Carlos Soriano 2016-10-25 20:19:35 UTC
Review of attachment 338443 [details] [review]:

Good work on it! Now looks good, congrats to your contribution! :)

(there is a small nitpick in the commit message, the title needs update since it says: batch-rename: Reword "Rename %d files/folders" as "Rename %d
 items" which is no longer the case)
Comment 14 Neha Yadav 2016-10-27 08:05:59 UTC
Created attachment 338586 [details] [review]
batch-rename: Reword "Rename %d files/folders" as "Rename %d files"

The problem is that when we select both folder and file then string
"Rename %d files" appears which may not be the right term when
the selected items contains both files and folders.

To solve this issue we rename the string and now in place of string
"Rename %d files" we use "Rename %d Files and Folders" for both file
and folder.
Comment 15 Ernestas Kulik 2016-11-02 19:34:47 UTC
Review of attachment 338586 [details] [review]:

I really would prefer “items”, but it is not up to me. :|

::: src/nautilus-batch-rename-dialog.c
@@ +2194,3 @@
+    {
+        g_string_append_printf (dialog_title,
+                                ngettext ("Rename %d File and Folder", "Rename %d Files and Folders", g_list_length (selection)),

This is a bit funky. The singular version will never be used, so maybe it needs a comment if we are going with this, so translators would not have to bother?
Comment 16 Neha Yadav 2016-11-03 09:19:14 UTC
Created attachment 339014 [details] [review]
batch-rename: Reword "Rename %d files/folders" as "Rename %d files"

The problem is that when we select both folder and file then string
"Rename %d files" appears which may not be the right term when
the selected items contains both files and folders.

To solve this issue we rename the string and now in place of string
"Rename %d files" we use "Rename %d Files and Folders" for both file
and folder.
Comment 17 Carlos Soriano 2016-11-03 10:07:46 UTC
(In reply to Ernestas Kulik from comment #15)
> Review of attachment 338586 [details] [review] [review]:
> 
> I really would prefer “items”, but it is not up to me. :|

Think about "items" in other languages. For example in Spanish would be the literal translations of "objects" which is less than understandable.
Let's be a little explicit here to make sure users understand it.
Comment 18 Carlos Soriano 2016-11-03 10:11:10 UTC
Review of attachment 339014 [details] [review]:

Looks excellent now, thanks Neha!
Comment 19 Carlos Soriano 2016-11-03 10:13:29 UTC
(In reply to Ernestas Kulik from comment #15)
> Review of attachment 338586 [details] [review] [review]:
> 
> I really would prefer “items”, but it is not up to me. :|
> 
> ::: src/nautilus-batch-rename-dialog.c
> @@ +2194,3 @@
> +    {
> +        g_string_append_printf (dialog_title,
> +                                ngettext ("Rename %d File and Folder",
> "Rename %d Files and Folders", g_list_length (selection)),
> 
> This is a bit funky. The singular version will never be used, so maybe it
> needs a comment if we are going with this, so translators would not have to
> bother?

That's true... sorry I just noticed your comment. Neha, could you add a comment for translators? Search on the source code for "Translators" to know how and where to add a comment for them.
Comment 20 Carlos Soriano 2016-11-03 10:14:02 UTC
Review of attachment 339014 [details] [review]:

Changing patch status based on Ernestas review
Comment 21 Neha Yadav 2016-11-03 14:59:42 UTC
Created attachment 339041 [details] [review]
batch-rename : Reword "Rename %d files/folders" as "Rename %d files"

The problem is that when we select both folder and file then string
"Rename %d files" appears which may not be the right term when
the selected items contains both files and folders.

To solve this issue we rename the string and now in place of string
"Rename %d files" we use "Rename %d Files and Folders" for both file
and folder.
Comment 22 Neha Yadav 2016-11-03 15:04:02 UTC
Comment on attachment 339014 [details] [review]
batch-rename: Reword "Rename %d files/folders" as "Rename %d files"

>From 50c4e0a12e1ca7eea12b73eb179451c45c1c21c9 Mon Sep 17 00:00:00 2001
>From: Neha Yadav <inehayadav28@gmail.com>
>Date: Wed, 12 Oct 2016 23:18:26 +0530
>Subject: [PATCH] batch-rename: Reword "Rename %d files/folders" as "Rename %d
> files"
>
>The problem is that when we select both folder and file then string
>"Rename %d files" appears which may not be the right term when
>the selected items contains both files and folders.
>
>To solve this issue we rename the string and now in place of string
>"Rename %d files" we use "Rename %d Files and Folders" for both file
>and folder.
>
>https://bugzilla.gnome.org/show_bug.cgi?id=771586
>---
> src/nautilus-batch-rename-dialog.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
>diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
>index 20f99de..1fd7607 100644
>--- a/src/nautilus-batch-rename-dialog.c
>+++ b/src/nautilus-batch-rename-dialog.c
>@@ -2100,6 +2100,7 @@ nautilus_batch_rename_dialog_new (GList             *selection,
>     GString *dialog_title;
>     GList *l;
>     gboolean all_targets_are_folders;
>+    gboolean all_targets_are_regular_files;
> 
>     dialog = g_object_new (NAUTILUS_TYPE_BATCH_RENAME_DIALOG, "use-header-bar", TRUE, NULL);
> 
>@@ -2120,19 +2121,36 @@ nautilus_batch_rename_dialog_new (GList             *selection,
>         }
>     }
> 
>-    dialog_title = g_string_new ("");
>+    all_targets_are_regular_files = TRUE;
>+    for (l = selection; l != NULL; l = l->next)
>+    {
>+        if (!nautilus_file_is_regular_file (NAUTILUS_FILE (l->data)))
>+        {
>+            all_targets_are_regular_files = FALSE;
>+            break;
>+        }
>+    }
>+
>+    dialog_title = g_string_new ("");   
>     if (all_targets_are_folders)
>     {
>         g_string_append_printf (dialog_title,
>                                 ngettext ("Rename %d Folder", "Rename %d Folders", g_list_length (selection)),
>                                 g_list_length (selection));
>     }
>-    else
>+    else if (all_targets_are_regular_files)
>     {
>         g_string_append_printf (dialog_title,
>                                 ngettext ("Rename %d File", "Rename %d Files", g_list_length (selection)),
>                                 g_list_length (selection));
>     }
>+    else 
>+    {
>+        g_string_append_printf (dialog_title,
>+                                ngettext ("Rename %d File and Folder", "Rename %d Files and Folders", g_list_length (selection)),
>+                                g_list_length (selection));   
>+    }
>+
>     gtk_window_set_title (GTK_WINDOW (dialog), dialog_title->str);
> 
>     add_tag (dialog, metadata_tags_constants[ORIGINAL_FILE_NAME]);
>-- 
>2.7.4
Comment 23 Carlos Soriano 2016-11-03 16:02:38 UTC
Review of attachment 339041 [details] [review]:

Looks good now to me! Thanks Neha!
Comment 24 Carlos Soriano 2016-11-10 12:12:37 UTC
Thanks Neha for the patch!

Attachment 336483 [details] pushed as a8dbefc - file: reword "items" to "files and folders"
Attachment 339041 [details] pushed as 735bdb1 - batch-rename : Reword "Rename %d files/folders" as "Rename %d files"
Comment 25 Piotr Drąg 2016-11-10 12:37:17 UTC
"Rename %d Files and Folders" in src/nautilus-batch-rename-dialog.c is not marked for translation.
Comment 26 Carlos Soriano 2016-11-10 12:42:34 UTC
Created attachment 339476 [details] [review]
batch-rename-dialog: mark string for translation
Comment 27 Carlos Soriano 2016-11-10 12:43:52 UTC
I'm not sure how this went through Ernestas and my eyes unnoticed :( sorry for that!

Attachment 339476 [details] pushed as 21bcdf7 - batch-rename-dialog: mark string for translation
Comment 28 Ernestas Kulik 2016-11-11 14:57:51 UTC
(In reply to Carlos Soriano from comment #24)
> Thanks Neha for the patch!
> 
> Attachment 336483 [details] pushed as a8dbefc - file: reword "items" to
> "files and folders"
> Attachment 339041 [details] pushed as 735bdb1 - batch-rename : Reword
> "Rename %d files/folders" as "Rename %d files"

Carlos, a8dbefc is broken with a single directory child. Both includes_directories and includes_files are true regardless of the count, it appears.
Comment 29 Carlos Soriano 2016-11-22 11:30:57 UTC
(In reply to Ernestas Kulik from comment #28)
> (In reply to Carlos Soriano from comment #24)
> > Thanks Neha for the patch!
> > 
> > Attachment 336483 [details] pushed as a8dbefc - file: reword "items" to
> > "files and folders"
> > Attachment 339041 [details] pushed as 735bdb1 - batch-rename : Reword
> > "Rename %d files/folders" as "Rename %d files"
> 
> Carlos, a8dbefc is broken with a single directory child. Both
> includes_directories and includes_files are true regardless of the count, it
> appears.

reverted
https://git.gnome.org/browse/nautilus/commit/?id=f879c81b4e6af0cfb13329c33e7fd1717db92b79