-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't show amount of hidden files when showing hidden files #204
Conversation
src/sidebar.jsx
Outdated
@@ -139,6 +139,8 @@ export const SidebarPanelDetails = ({ | |||
}, [path, selected]); | |||
|
|||
const Dialogs = useDialogs(); | |||
const hidden_item_count = currentDirectory.items_cnt.hidden; | |||
const item_count = showHidden ? currentDirectory.items_cnt.all + hidden_item_count : currentDirectory.items_cnt.all; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about the logic here? The existing code already included the hidden items in the overall count (and indeed item_cnt.all
sounds like it contains them). Adding them again here might be wrong. Probably you would actually want to subtract them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and all is all except hidden which is super confusing. Do you want me to refactor this all now?
src/sidebar.jsx
Outdated
currentDirectory.items_cnt.all, | ||
cockpit.format("($0 hidden)", currentDirectory.items_cnt.hidden) | ||
item_count, | ||
showHidden ? "" : cockpit.format("($0 hidden)", hidden_item_count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be translated with ngettext. "hidden" might be declined differently depending on the number.
src/sidebar.jsx
Outdated
@@ -154,10 +156,10 @@ export const SidebarPanelDetails = ({ | |||
{cockpit.format( | |||
cockpit.ngettext( | |||
"$0 item $1", "$0 items $1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way these strings get pasted together is pretty confusing. Of course there's no two-dimensional ngettext(), so we're going to have to do some kind of pasting, but I think I'd prefer if it looked something like:
let str = ngettext("$0 item", "$0 items", visible_count);
if (!showHidden)
str += " " + ngettext("($0 hidden)", "($0 hidden)", hidden_count)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, we could turn it around and use the translation of the "hidden" part to do the pasting — since it's the one that's only done conditionally.
If you do that, then please write a translator comment about it.
When a user wants to see all files regardless of if they are hidden files show the item count without (X hidden items).
070cc4b
to
7a2773b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
When a user wants to see all files regardless of if they are hidden files show the item count without (X hidden items).