2004-02-18 02:15:00 +00:00
|
|
|
|
<?php
|
2012-06-06 20:42:13 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Hebrew (עברית) specific code.
|
|
|
|
|
|
*
|
|
|
|
|
|
* 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
|
|
|
|
|
|
* @author Rotem Liss
|
|
|
|
|
|
* @ingroup Language
|
|
|
|
|
|
*/
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
|
|
2005-04-05 11:00:27 +00:00
|
|
|
|
/**
|
2006-06-16 18:47:15 +00:00
|
|
|
|
* Hebrew (עברית)
|
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
|
* @ingroup Language
|
2006-06-16 18:47:15 +00:00
|
|
|
|
*/
|
2006-07-26 07:15:39 +00:00
|
|
|
|
class LanguageHe extends Language {
|
2010-06-05 19:15:50 +00:00
|
|
|
|
|
2006-05-26 18:26:51 +00:00
|
|
|
|
/**
|
2006-06-25 10:37:45 +00:00
|
|
|
|
* Convert grammar forms of words.
|
2006-06-16 18:47:15 +00:00
|
|
|
|
*
|
2006-06-25 10:37:45 +00:00
|
|
|
|
* Available cases:
|
|
|
|
|
|
* "prefixed" (or "תחילית") - when the word has a prefix
|
2006-05-26 18:26:51 +00:00
|
|
|
|
*
|
2010-06-05 19:15:50 +00:00
|
|
|
|
* @param $word String: the word to convert
|
|
|
|
|
|
* @param $case String: the case
|
2011-05-29 15:03:33 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @return string
|
2006-06-25 10:37:45 +00:00
|
|
|
|
*/
|
2006-07-07 13:12:51 +00:00
|
|
|
|
public function convertGrammar( $word, $case ) {
|
2006-06-25 10:37:45 +00:00
|
|
|
|
global $wgGrammarForms;
|
2010-07-29 09:43:18 +00:00
|
|
|
|
if ( isset( $wgGrammarForms['he'][$case][$word] ) ) {
|
2006-06-25 10:37:45 +00:00
|
|
|
|
return $wgGrammarForms['he'][$case][$word];
|
|
|
|
|
|
}
|
2010-06-05 19:15:50 +00:00
|
|
|
|
|
2006-06-25 10:37:45 +00:00
|
|
|
|
switch ( $case ) {
|
|
|
|
|
|
case 'prefixed':
|
|
|
|
|
|
case 'תחילית':
|
|
|
|
|
|
# Duplicate the "Waw" if prefixed
|
|
|
|
|
|
if ( substr( $word, 0, 2 ) == "ו" && substr( $word, 0, 4 ) != "וו" ) {
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$word = "ו" . $word;
|
2006-06-25 10:37:45 +00:00
|
|
|
|
}
|
2010-06-05 19:15:50 +00:00
|
|
|
|
|
2006-06-25 10:37:45 +00:00
|
|
|
|
# Remove the "He" if prefixed
|
|
|
|
|
|
if ( substr( $word, 0, 2 ) == "ה" ) {
|
|
|
|
|
|
$word = substr( $word, 2 );
|
|
|
|
|
|
}
|
2010-06-05 19:15:50 +00:00
|
|
|
|
|
2012-01-14 22:32:18 +00:00
|
|
|
|
# Add a hyphen (maqaf) if non-Hebrew letters
|
2006-06-25 10:37:45 +00:00
|
|
|
|
if ( substr( $word, 0, 2 ) < "א" || substr( $word, 0, 2 ) > "ת" ) {
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$word = "־" . $word;
|
2006-06-25 10:37:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2010-06-05 19:15:50 +00:00
|
|
|
|
|
2006-06-25 10:37:45 +00:00
|
|
|
|
return $word;
|
|
|
|
|
|
}
|
2010-06-05 19:15:50 +00:00
|
|
|
|
|
2006-06-25 10:37:45 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Gets a number and uses the suited form of the word.
|
2006-05-26 18:26:51 +00:00
|
|
|
|
*
|
2010-06-05 19:15:50 +00:00
|
|
|
|
* @param $count Integer: the number of items
|
|
|
|
|
|
* @param $forms Array with 3 items: the three plural forms
|
|
|
|
|
|
* @return String: the suited form of word
|
2006-05-26 18:26:51 +00:00
|
|
|
|
*/
|
2007-11-18 20:15:49 +00:00
|
|
|
|
function convertPlural( $count, $forms ) {
|
2010-07-29 09:43:18 +00:00
|
|
|
|
if ( !count( $forms ) ) { return ''; }
|
2007-11-18 20:15:49 +00:00
|
|
|
|
$forms = $this->preConvertPlural( $forms, 3 );
|
|
|
|
|
|
|
2012-02-02 14:42:48 +00:00
|
|
|
|
if ( $count == 1 ) {
|
2012-01-14 22:32:18 +00:00
|
|
|
|
return $forms[0]; // Singular
|
2012-02-02 14:42:48 +00:00
|
|
|
|
} elseif ( $count == 2 ) {
|
2012-01-31 14:47:12 +00:00
|
|
|
|
return $forms[2]; // Dual or plural if dual is not provided (filled in preConvertPlural)
|
2006-05-26 18:26:51 +00:00
|
|
|
|
} else {
|
2012-01-14 22:32:18 +00:00
|
|
|
|
return $forms[1]; // Plural
|
2006-05-26 18:26:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2003-07-08 20:17:36 +00:00
|
|
|
|
}
|