Merge "Replace deprecated wfMsg* calls with Message class calls."
[lhc/web/wiklou.git] / languages / classes / LanguageCs.php
index 0cb1b45..49c4756 100644 (file)
@@ -1,98 +1,56 @@
 <?php
-/** Czech (česky)
+/**
+ * Czech (čeština [subst.], český [adj.], česky [adv.]) specific code.
  *
- * @addtogroup Language
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Language
  */
 
-#--------------------------------------------------------------------------
-# Internationalisation code
-#--------------------------------------------------------------------------
-
+/**
+ * Czech (čeština [subst.], český [adj.], česky [adv.])
+ *
+ * @ingroup Language
+ */
 class LanguageCs extends Language {
-       # Grammatical transformations, needed for inflected languages
-       # Invoked by putting {{grammar:case|word}} in a message
-       function convertGrammar( $word, $case ) {
-               global $wgGrammarForms;
-               if ( isset($wgGrammarForms['cs'][$case][$word]) ) {
-                       return $wgGrammarForms['cs'][$case][$word];
-               }
-               # allowed values for $case:
-               #       1sg, 2sg, ..., 7sg -- nominative, genitive, ... (in singular)
-               switch ( $word ) {
-                       case 'Wikibooks':
-                       case 'Wikiknihy':
-                               switch ( $case ) {
-                                       case '2sg':
-                                               return 'Wikiknih';
-                                       case '3sg':
-                                               return 'Wikiknihám';
-                                       case '6sg';
-                                               return 'Wikiknihách';
-                                       case '7sg':
-                                               return 'Wikiknihami';
-                                       default:
-                                               return 'Wikiknihy';
-                               }
-                       case 'Wikipedia':
-                       case 'Wikipedie':
-                               switch ( $case ) {
-                                       case '3sg':
-                                       case '4sg':
-                                       case '6sg':
-                                               return 'Wikipedii';
-                                       case '7sg':
-                                               return 'Wikipedií';
-                                       default:
-                                               return 'Wikipedie';
-                               }
 
-                       case 'Wiktionary':
-                       case 'Wikcionář':
-                               switch ( $case ) {
-                                       case '2sg':
-                                               return 'Wikcionáře';
-                                       case '3sg':
-                                       case '5sg';
-                                       case '6sg';
-                                               return 'Wikcionáři';
-                                       case '7sg':
-                                               return 'Wikcionářem';
-                                       default:
-                                               return 'Wikcionář';
-                               }
+       /**
+        * Plural transformations
+        * Invoked by putting
+        * {{plural:count|form1|form2-4|form0,5+}} for two forms plurals
+        * {{plural:count|form1|form0,2+}} for single form plurals
+        * in a message
+        * @param $count int
+        * @param $forms array
+        * @return string
+        */
+       function convertPlural( $count, $forms ) {
+               if ( !count( $forms ) ) { return ''; }
+               $forms = $this->preConvertPlural( $forms, 3 );
 
-                       case 'Wikiquote':
-                       case 'Wikicitáty':
-                               switch ( $case ) {
-                                       case '2sg':
-                                               return 'Wikicitátů';
-                                       case '3sg':
-                                               return 'Wikicitátům';
-                                       case '6sg';
-                                               return 'Wikicitátech';
-                                       default:
-                                               return 'Wikicitáty';
-                               }
+               switch ( $count ) {
+                       case 1:
+                               return $forms[0];
+                       case 2:
+                       case 3:
+                       case 4:
+                               return $forms[1];
+                       default:
+                               return $forms[2];
                }
-               # unknown
-               return $word;
        }
-
-  # Plural form transformations, needed for some languages.
-  # Invoked by {{plural:count|wordform1|wordform2|wordform3}}
-  function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
-       $count = str_replace( '\xc2\xa0', '', $count );
-       switch ( $count ) {
-               case 1:
-                       return $wordform1;
-
-               case 2:
-               case 3:
-               case 4:
-                       return $wordform2;
-
-               default:
-                       return $wordform3;
-       };
-  }
 }