]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - languages/classes/LanguageLv.php
MediaWiki 1.16.0
[autoinstallsdev/mediawiki.git] / languages / classes / LanguageLv.php
index 8a46bb9d66f74381db33f855177266959ad48592..84974c37e63b329911347a96caf45640a2437b2e 100644 (file)
@@ -1,14 +1,14 @@
 <?php
+
 /** Latvian (Latviešu)
  *
- * @addtogroup Language
+ * @ingroup Language
  *
  * @author Niklas Laxström
  *
  * @copyright Copyright © 2006, Niklas Laxström
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
  */
-
 class LanguageLv extends Language {
        /**
         * Plural form transformations. Using the first form for words with the last digit 1, but not for words with the last digits 11, and the second form for all the others.
@@ -21,36 +21,13 @@ class LanguageLv extends Language {
         * @param string $wordform3 (not used)
         * @return string
         */
-       function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5 ) {
-               return ( ( $count % 10 == 1 ) && ( $count % 100 != 11 ) ) ? $wordform1 : $wordform2;
-       }
-
-       # Convert from the nominative form of a noun to some other case
-       # Invoked with {{GRAMMAR:case|word}}
-       # ģenitīvs - kā, datīvs - kam, akuzatīvs - ko, lokatīvs - kur.
-       /**
-        * Cases: ģenitīvs, datīvs, akuzatīvs, lokatīvs
-        */
-       function convertGrammar( $word, $case ) {
-               global $wgGrammarForms;
-
-               $wgGrammarForms['lv']['ģenitīvs' ]['Vikipēdija']   = 'Vikipēdijas';
-               $wgGrammarForms['lv']['ģenitīvs' ]['Vikivārdnīca'] = 'Vikivārdnīcas';
-               $wgGrammarForms['lv']['datīvs'   ]['Vikipēdija']   = 'Vikipēdijai';
-               $wgGrammarForms['lv']['datīvs'   ]['Vikivārdnīca'] = 'Vikivārdnīcai';
-               $wgGrammarForms['lv']['akuzatīvs']['Vikipēdija']   = 'Vikipēdiju';
-               $wgGrammarForms['lv']['akuzatīvs']['Vikivārdnīca'] = 'Vikivārdnīcu';
-               $wgGrammarForms['lv']['lokatīvs' ]['Vikipēdija']   = 'Vikipēdijā';
-               $wgGrammarForms['lv']['lokatīvs' ]['Vikivārdnīca'] = 'Vikivārdnīcā';
-       
-               if ( isset($wgGrammarForms['lv'][$case][$word]) ) {
-                       return $wgGrammarForms['lv'][$case][$word];
-               }
+       function convertPlural( $count, $forms ) {
+               if ( !count($forms) ) { return ''; }
 
-               return $word;
+               // FIXME: CLDR defines 3 plural forms instead of 2.  Form for 0 is missing.
+               //        http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#lv
+               $forms = $this->preConvertPlural( $forms, 2 );
 
+               return ( ( $count % 10 == 1 ) && ( $count % 100 != 11 ) ) ? $forms[0] : $forms[1];
        }
-
 }
-
-