I have a program that needs to print the results of a query. So I create a localizable string, use string.Format and print the results as in
Your query returned 5 results.
This looks good. Now a tester assigned to test this tried another query and got back
Your query returned 1 results.
And oops there goes a bug on my name. The question is how do I solve it. I have three options. Leave it as it is, make it result(s) or have two strings and switch between the two so that I get.
Your query returned 5 results.Your query returned 1 result.
I am sure most users will immediately want me to use the 3rd option because it is the correct solution. The problem is that this has heavy localization, test and maintenance cost. Consider the following code that I need to use to get that done
if (resultCount == 1)
str = string.Format(singular, resultCount);
else str = string.Format(plural, resultCount);
you can use tertiary operator for above but that complicates things further.
This piece of code needs testers to test both code paths, localization team to localize double the number of string in all supported languages. Some change in code need to be done at two places. Some costs are straight forward, outsourced localization is often charged per string localized :)
Even after that subtle errors creep in. For example the tester needs to ensure that in case of 0, 0 results is shown and not 0 result.
So the first two solutions appear to be better. However result(s) though popular choice before do not work any more. Screen-readers used by the visually-impaired fail on this. Modern style-guidelines favor 1 results over 1 result(s).
So next time you see a program show 1 results, don't consider the programmer to be grammatically challenged :)