http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97524

Revision: 97524
Author:   reedy
Date:     2011-09-19 18:11:47 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
MFT r97515

Modified Paths:
--------------
    branches/wmf/1.18wmf1/RELEASE-NOTES-1.18

Added Paths:
-----------
    branches/wmf/1.18wmf1/languages/classes/LanguageOs.php

Property Changed:
----------------
    branches/wmf/1.18wmf1/RELEASE-NOTES-1.18

Modified: branches/wmf/1.18wmf1/RELEASE-NOTES-1.18
===================================================================
--- branches/wmf/1.18wmf1/RELEASE-NOTES-1.18    2011-09-19 18:09:44 UTC (rev 
97523)
+++ branches/wmf/1.18wmf1/RELEASE-NOTES-1.18    2011-09-19 18:11:47 UTC (rev 
97524)
@@ -627,6 +627,7 @@
   (Devanagari) (ks-deva). Defaults to ks-arab.
 * (bug 30817) Restored linktrail for kk (Kazakh)
 * (bug 27398) Add $wgExtraGenderNamespaces for configured gendered namespaces
+* (bug 30846) New LanguageOs class
 
 === Other changes in 1.18 ===
 * Removed legacy wgAjaxWatch javascript global object, no longer in use.


Property changes on: branches/wmf/1.18wmf1/RELEASE-NOTES-1.18
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/RELEASE-NOTES-1.18:51646
/branches/REL1_17/phase3/RELEASE-NOTES-1.18:81445,81448
/branches/new-installer/phase3/RELEASE-NOTES-1.18:43664-66004
/branches/sqlite/RELEASE-NOTES-1.18:58211-58321
/trunk/phase3/RELEASE-NOTES-1.18:92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93382-93383,93516-93518,93520,93818-93822,93847,93858,93891,93916,93935-93936,94058,94062,94068,94107,94155,94235-94236,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95014,95016-95017,95023,95042,95072-95073,95155,95171,95327,95332,95409-95410,95422,95426,95436,95442,95458,95467-95468,95470,95475,95493,95521,95525,95540,95562,95570,95597,95601,95608,95627,95647-95648,95651-95653,95655-95656,95659,95663,95674,95790,95812,95855,95899,95999,96087,96180,96227-96228,96286,96297,96386,96393,96405,96427,96460,96472,96509,96522,96606,96643,96645,96655,96659,96687,96762,96764,96775,96825,96829,96833,96964,96998,97141,97143,97177,97296,97298,97362,97365,97381
/trunk/phase3/RELEASE-NOTES-1.19:95655,95999
   + /branches/REL1_15/phase3/RELEASE-NOTES-1.18:51646
/branches/REL1_17/phase3/RELEASE-NOTES-1.18:81445,81448
/branches/REL1_18/phase3/RELEASE-NOTES-1.18:97522
/branches/new-installer/phase3/RELEASE-NOTES-1.18:43664-66004
/branches/sqlite/RELEASE-NOTES-1.18:58211-58321
/trunk/phase3/RELEASE-NOTES-1.18:92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93382-93383,93516-93518,93520,93818-93822,93847,93858,93891,93916,93935-93936,94058,94062,94068,94107,94155,94235-94236,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95014,95016-95017,95023,95042,95072-95073,95155,95171,95327,95332,95409-95410,95422,95426,95436,95442,95458,95467-95468,95470,95475,95493,95521,95525,95540,95562,95570,95597,95601,95608,95627,95647-95648,95651-95653,95655-95656,95659,95663,95674,95790,95812,95855,95899,95999,96087,96180,96227-96228,96286,96297,96386,96393,96405,96427,96460,96472,96509,96522,96606,96643,96645,96655,96659,96687,96762,96764,96775,96825,96829,96833,96964,96998,97141,97143,97177,97296,97298,97362,97365,97381,97515
/trunk/phase3/RELEASE-NOTES-1.19:95655,95999

Copied: branches/wmf/1.18wmf1/languages/classes/LanguageOs.php (from rev 97522, 
branches/REL1_18/phase3/languages/classes/LanguageOs.php)
===================================================================
--- branches/wmf/1.18wmf1/languages/classes/LanguageOs.php                      
        (rev 0)
+++ branches/wmf/1.18wmf1/languages/classes/LanguageOs.php      2011-09-19 
18:11:47 UTC (rev 97524)
@@ -0,0 +1,87 @@
+<?php
+
+/** Ossetian (Ирон)
+ *
+ * @author Soslan Khubulov
+ *
+ * @ingroup Language
+ */
+class LanguageOs extends Language {
+
+       /**
+        * Convert from the nominative form of a noun to other cases
+        * Invoked with {{grammar:case|word}}
+        *
+        * Depending on word there are four different ways of converting to 
other cases.
+        * 1) Word consist of not cyrillic letters or is an abbreviation.
+        *              Then result word is: word + hyphen + case ending.
+        *
+        * 2) Word consist of cyrillic letters.
+        * 2.1) Word is in plural.
+        *              Then result word is: word - last letter + case ending. 
Ending of allative case here is 'æм'.
+        *
+        * 2.2) Word is in singular.
+        * 2.2.1) Word ends on consonant.
+        *              Then result word is: word + case ending.
+        *
+        * 2.2.2) Word ends on vowel.
+        *              Then result word is: word + 'й' + case ending for cases 
!= allative or comitative
+        *              and word + case ending for allative or comitative. 
Ending of allative case here is 'æ'.
+        *
+        * @param $word string
+        * @param $case string
+        * @return string
+        */
+       function convertGrammar( $word, $case ) {
+               global $wgGrammarForms;
+               if ( isset( $wgGrammarForms['os'][$case][$word] ) ) {
+                       return $wgGrammarForms['os'][$case][$word];
+               }
+               # Ending for allative case
+               $end_allative = 'мæ';
+               # Variable for 'j' beetwen vowels
+               $jot = '';
+               # Variable for "-" for not Ossetic words
+               $hyphen = '';
+               # Variable for ending
+               $ending = '';
+
+
+               # CHecking if the $word is in plural form
+               if ( preg_match( '/тæ$/u', $word ) ) {
+                       $word = mb_substr( $word, 0, -1 );
+                       $end_allative = 'æм';
+               }
+               # Works if $word is in singular form.
+               # Checking if $word ends on one of the vowels: е, ё, и, о, ы, 
э, ю, я.
+               elseif ( preg_match( "/[аæеёиоыэюя]$/u", $word ) ) {
+                       $jot = 'й';
+               }
+               # Checking if $word ends on 'у'. 'У' can be either consonant 
'W' or vowel 'U' in cyrillic Ossetic.
+               # Examples: {{grammar:genitive|аунеу}} = аунеуы, 
{{grammar:genitive|лæппу}} = лæппуйы.
+               elseif ( preg_match( "/у$/u", $word ) ) {
+                       if ( !preg_match( "/[аæеёиоыэюя]$/u", mb_substr( $word, 
-2, 1 ) ) )
+                               $jot = 'й';
+               } elseif ( !preg_match( "/[бвгджзйклмнопрстфхцчшщьъ]$/u", $word 
) ) {
+                       $hyphen = '-';
+               }
+
+               switch ( $case ) {
+                       case 'genitive': $ending = $hyphen . $jot . 'ы'; break;
+                       case 'dative': $ending = $hyphen . $jot . 'æн'; break;
+                       case 'allative': $ending = $hyphen . $end_allative; 
break;
+                       case 'ablative':
+                               if ( $jot == 'й' ) {
+                                       $ending = $hyphen . $jot . 'æ'; break;
+                               }
+                               else {
+                                       $ending = $hyphen . $jot . 'æй'; break;
+                               }
+                       case 'inessive': break;
+                       case 'superessive': $ending = $hyphen . $jot . 'ыл'; 
break;
+                       case 'equative': $ending = $hyphen . $jot . 'ау'; break;
+                       case 'comitative': $ending = $hyphen . 'имæ'; break;
+               }
+               return $word . $ending;
+       }
+}


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to