Once upon a time I read some article about the development of civilizations. There was a curious detail about the account. The author of the article claimed that the primitive man considered this: one, two, and so to some limit of a countable set, a lot. That is, he could count to some limited limit, and everything that is greater than this countable set did not fit into his brains and was simply called “a lot”. And he gave arguments for the fact that in Russian (as in some others) there are still traces of this division, for example:
- one horse is one.
- two horses, three horses, four horses (watch the end change) - this is a countable set.
- five horses, six horses and whether they are at least a million, but still the ending will be her. This is the "lot".
That is, the countable set of the ancient Slavs ended in the region of four.
')
Actually, it was the lyrics.
When setting up a wordpress blog, I encountered the following problem: it is impossible to adjust the normal declination under Russian (since I am not a humanist, I can’t vouch for the accuracy of using the term :) noun “comment”. That is, they wrote 1 comment, 2 comments, or 5 comments on the post.
In English, this case is easier. 0 comments, 1 comment, 2 and more comments. This is how the standard comments_number function works in the wp-includes / comment-tempate.php file. It takes only four arguments - a formula for displaying zero comments, one comment, “many” comments, and also the deprecated flag.
But I am writing in Russian, and, accordingly, I have a different situation. So. In order to properly incline the word "comments" we need to handle the following situations:
- Zero comments.
- One comment (as well as 21, 31 etc.)
- Two, three, four comments (as well as 22-24, 32-34 etc.)
- Fifteen comments. That is, an arbitrary number that does not fall under the above frame.
To solve this, I wrote this simple
plugin .
The plugin is installed very simply - unzip, copy to the wp-content / plugins folder, activate it in the admin area. Tested on wordpress versions 2.3.3, 2.5.1.
He has no settings, so he stupidly displays "23 comments", "31 comments" and so on.
Actually, for the time being, I see no reason to modify it, since I am completely satisfied with its functionality. In principle, you can also add a number converter to words, so that the verbal description of the number of comments is completely, but I think this is not the best option - it’s much more convenient to understand the number with a glance at the number than to read the whole line to find out four hundred eighty nine comments.
Crosspost on my blog.