-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Display the number of results for global search #44301
Display the number of results for global search #44301
Conversation
if (result_count == 1 && file_count == 1) { | ||
results_text = vformat(TTR("%d match in %d file."), result_count, file_count); | ||
} else if (result_count != 1 && file_count == 1) { | ||
results_text = vformat(TTR("%d matches in %d file."), result_count, file_count); | ||
} else { | ||
results_text = vformat(TTR("%d matches in %d files."), result_count, file_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.
That's a good use case to start using the newly implemented plurals support with TTRN()
: #40443.
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.
Indeed, didn't think about it. Will look into.
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.
On a second thought, this is probably not a good use case for that, because there are 2 numbers and 3 permutations between them. Not sure how TTRN
would help here. I'd be able to check either result_count
or file_count
, but the third option would still be separate. Picking one over the other seems arbitrary, no?
Edit: Unless you propose we split them into two and TTRN
each part individually?
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'd need to think more about it, but let's keep it simple for now and possibly improve laters. We haven't used TTRN
anywhere in the translations yet, there are several places which could benefit from it.
Thanks! |
Cherry-picked for 3.2.4. |
This replaces the ambiguous "Search complete" phrase with the actual number of results found in files.
This especially helps when doing refactoring and clicking "Refresh" to repeat the search.
Bugsquad edit: This partially addresses godotengine/godot-proposals#600.