Cleaner singular/plural strings for match count notification.

This commit is contained in:
Pistos 2011-05-13 14:13:30 -04:00
parent 33479dfc4b
commit 8d51c1070c
2 changed files with 7 additions and 3 deletions

View file

@ -248,7 +248,7 @@ module Diakonos
}
choice = auto_choice || $diakonos.get_choice(
"#{num_matches_found} match(es) - Replace this one?",
"#{num_matches_found} match#{ num_matches_found != 1 ? 'es' : '' } - Replace this one?",
[ CHOICE_YES, CHOICE_NO, CHOICE_ALL, CHOICE_CANCEL, CHOICE_YES_AND_STOP ],
CHOICE_YES
)

View file

@ -140,10 +140,14 @@ module Diakonos
def show_number_of_matches_found( num_replacements = nil )
return if buffer_current.num_matches_found.nil?
num_found = buffer_current.num_matches_found
if num_found != 1
plural = 'es'
end
if num_replacements
set_iline_if_empty "#{num_replacements} out of #{buffer_current.num_matches_found} match(es) replaced"
set_iline_if_empty "#{num_replacements} out of #{num_found} match#{plural} replaced"
else
set_iline_if_empty "#{buffer_current.num_matches_found} match(es) found"
set_iline_if_empty "#{num_found} match#{plural} found"
end
end