Lately, I’ve been noticing that a lot of software, be it a website, a client application, or a video game, often write a representation of quantity as follows: “1 result(s)”. Now, I can understand why they would do that 20 years ago. But these days, shouldn’t we have enough processing power and memory to be able to say “1 result” and “2 results”?
Is there some sort of special reason why it’s still done this way?
Now before you tell me to Google it, I would. But the thing is, I have no idea what search terms to use. So even some suggested search terms would be welcome.
9
Have you considered localization?
It may look simple to write something like:
var text = (count > 0) ? "items" : "item"
But it’s nowhere near that simple when you have to work in multiple languages. Here’s an example, just using Google Translate:
Language | Singular | Plural
----------------+---------------------------+-----------------
English | 1 item found | 2 items found
French | 1 article trouvé | 2 objets trouvés
Spanish | 1 artículo encontrado | 2 artículos encontrados
German | 1 Artikel gefunden | 2 Artikel gefunden
Hebrew | מצא פריט 1 | 2 פריטים נמצאו
Arabic | وجدت بند 1 | 2 أصناف تم العثور عليها
Korean | 1 개 항목 발견 | 2 항목 발견
Now, granted, Google Translate may not be doing a perfect job here. But isn’t that partly the point? This isn’t all that simple. You can’t just add an “s” and be done with it. Not in production code, anyway. It’s way simpler to just use the plural form with parentheses – you only have one resource to localize that way.
22
Imlementing “1 result(s)” is easier and faster.
EDIT: And it makes the code shorter and therefore easier to understand.
5
the primary reason is that almost universally in GUI designers there is a distinct separation between pure presentation components and dynamic, data-based presentation components.
eg, you may use a Unchangable label in the static layout of a page. And this label is really a quite distinct component from a ‘field’ control.
so, although there are good ways to make the labels themselves dynamic, this is often the very, very, very last step that gets skipped because of time and priority constraints.
And the natural flow of most GUI designers is to have this separation beween static and dynamic components, and often is left that way, unless you specifially go back and QA these kinds of things.
2