I translate the template WP Rentals into Russian, faced with some problems. Can not translate reviews. It is necessary that, depending on the number, the ending of the word changes: 3 reviews, 1 review and so on. Now itβs just done: 1 Reviews. In which file is it edited by the standard?
1 answer
http://dimox.name/plural-form-of-nouns/
When you need a text of the form 21 comments.
In the themes functions.php file, insert the function:
function plural_form($number, $after) { $cases = array (2, 0, 1, 1, 1, 2); echo $number.' '.$after[ ($number%100>4 && $number%100<20)? 2: $cases[min($number%10, 5)] ]; }
And in the place where you need to display text about the number of comments, insert the following code:
<?php plural_form( get_comments_number(), /* Π²Π°ΡΠΈΠ°Π½ΡΡ Π½Π°ΠΏΠΈΡΠ°Π½ΠΈΡ Π΄Π»Ρ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²Π° 1, 2 ΠΈ 5 */ array('ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΉ','ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΡ','ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠ΅Π²') ); ?>
|