Jump to content

Some special in Russian language


Recommended Posts

In Russian language nouns after numerals have not 2 forms as in english and other languages (single and plural, eg. COMMENT, COMMENTS) - in my language there are 3 forms exists (single, double and multiple, eg. КОММЕНТАРИЙ, КОММЕНТАРИЯ, КОММЕНТАРИЕВ).

So all scripts oriented on english users looks not good with russian translate.

Here is algorythm for determine form of noun from numeral:

function declension($n, $form1, $form2, $form5) {
   $n = abs($n) % 100;  
   $n1 = $n % 10;  
   if ($n > 10 && $n < 20) return $form5;  
   if ($n1 > 1 && $n1 < 5) return $form2;  
   if ($n1 == 1) return $form1;  
   return $form5;   
}



I write modifier for smarty which uses this functions and implement this function in js for ajax cart. Now all is ok :)

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...