aboutsummaryrefslogtreecommitdiffstats
path: root/includes/languages
diff options
context:
space:
mode:
Diffstat (limited to 'includes/languages')
-rw-r--r--includes/languages/LanguageAr.php6
-rw-r--r--includes/languages/LanguageAz.php12
-rw-r--r--includes/languages/LanguageBe_tarask.php12
-rw-r--r--includes/languages/LanguageBs.php8
-rw-r--r--includes/languages/LanguageCu.php24
-rw-r--r--includes/languages/LanguageDsb.php8
-rw-r--r--includes/languages/LanguageFi.php10
-rw-r--r--includes/languages/LanguageGa.php9
-rw-r--r--includes/languages/LanguageGan.php6
-rw-r--r--includes/languages/LanguageHsb.php9
-rw-r--r--includes/languages/LanguageHu.php5
-rw-r--r--includes/languages/LanguageHy.php8
-rw-r--r--includes/languages/LanguageJa.php13
-rw-r--r--includes/languages/LanguageKaa.php36
-rw-r--r--includes/languages/LanguageKk.php33
-rw-r--r--includes/languages/LanguageKk_cyrl.php69
-rw-r--r--includes/languages/LanguageKm.php9
-rw-r--r--includes/languages/LanguageKsh.php58
-rw-r--r--includes/languages/LanguageLa.php5
-rw-r--r--includes/languages/LanguageMl.php5
-rw-r--r--includes/languages/LanguageMy.php5
-rw-r--r--includes/languages/LanguageOs.php25
-rw-r--r--includes/languages/LanguageQqx.php7
-rw-r--r--includes/languages/LanguageSl.php8
-rw-r--r--includes/languages/LanguageTr.php36
-rw-r--r--includes/languages/LanguageTyv.php108
-rw-r--r--includes/languages/LanguageWa.php19
-rw-r--r--includes/languages/LanguageWuu.php5
-rw-r--r--includes/languages/LanguageYue.php10
-rw-r--r--includes/languages/LanguageZh.php16
-rw-r--r--includes/languages/LanguageZh_hans.php30
-rw-r--r--includes/languages/data/CrhExceptions.php10
32 files changed, 252 insertions, 372 deletions
diff --git a/includes/languages/LanguageAr.php b/includes/languages/LanguageAr.php
index 476aeefca6eb..b1c6c47173a1 100644
--- a/includes/languages/LanguageAr.php
+++ b/includes/languages/LanguageAr.php
@@ -1,4 +1,5 @@
<?php
+
/**
* 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
@@ -19,6 +20,8 @@
* @author Niklas Laxström
*/
+use MediaWiki\Languages\Data\NormalizeAr;
+
/**
* Arabic (العربية) specific code.
*
@@ -36,7 +39,6 @@ class LanguageAr extends Language {
*/
public function normalize( $s ) {
$s = parent::normalize( $s );
- $s = $this->transformUsingPairFile( MediaWiki\Languages\Data\NormalizeAr::class, $s );
- return $s;
+ return $this->transformUsingPairFile( NormalizeAr::class, $s );
}
}
diff --git a/includes/languages/LanguageAz.php b/includes/languages/LanguageAz.php
index 72db78aeb6ae..6f616ddff0fd 100644
--- a/includes/languages/LanguageAz.php
+++ b/includes/languages/LanguageAz.php
@@ -25,14 +25,10 @@
*/
class LanguageAz extends Language {
- /**
- * @param string $string
- * @return mixed|string
- */
- public function ucfirst( $string ) {
- if ( substr( $string, 0, 1 ) === 'i' ) {
- return 'İ' . substr( $string, 1 );
+ public function ucfirst( $str ) {
+ if ( substr( $str, 0, 1 ) === 'i' ) {
+ return 'İ' . substr( $str, 1 );
}
- return parent::ucfirst( $string );
+ return parent::ucfirst( $str );
}
}
diff --git a/includes/languages/LanguageBe_tarask.php b/includes/languages/LanguageBe_tarask.php
index 9d9f973f51a2..6eea17d8506b 100644
--- a/includes/languages/LanguageBe_tarask.php
+++ b/includes/languages/LanguageBe_tarask.php
@@ -35,19 +35,15 @@ class LanguageBe_tarask extends Language {
* This function unifies apostrophe sign in search index values
* to enable search using both apostrophe signs.
*
- * @param string $string
- *
- * @return string
+ * @inheritDoc
*/
- public function normalizeForSearch( $string ) {
+ public function normalizeForSearch( $text ) {
# MySQL fulltext index doesn't grok utf-8, so we
# need to fold cases and convert to hex
# Replacing apostrophe sign U+2019 with U+0027
- $s = str_replace( "\u{2019}", '\'', $string );
-
- $s = parent::normalizeForSearch( $s );
+ $text = str_replace( "\u{2019}", '\'', $text );
- return $s;
+ return parent::normalizeForSearch( $text );
}
}
diff --git a/includes/languages/LanguageBs.php b/includes/languages/LanguageBs.php
index 38ef25a46de7..595f708242f9 100644
--- a/includes/languages/LanguageBs.php
+++ b/includes/languages/LanguageBs.php
@@ -28,15 +28,9 @@ use MediaWiki\MediaWikiServices;
*/
class LanguageBs extends Language {
/**
- * Convert from the nominative form of a noun to some other case
- * Invoked with {{GRAMMAR:case|word}}
- *
* Cases: genitiv, dativ, akuzativ, vokativ, instrumental, lokativ
*
- * @param string $word
- * @param string $case
- *
- * @return string
+ * @inheritDoc
*/
public function convertGrammar( $word, $case ) {
$grammarForms =
diff --git a/includes/languages/LanguageCu.php b/includes/languages/LanguageCu.php
index c33f3c57138c..c83cc64907a6 100644
--- a/includes/languages/LanguageCu.php
+++ b/includes/languages/LanguageCu.php
@@ -27,14 +27,6 @@ use MediaWiki\MediaWikiServices;
* @ingroup Languages
*/
class LanguageCu extends Language {
- /**
- * Convert from the nominative form of a noun to some other case
- * Invoked with {{grammar:case|word}}
- *
- * @param string $word
- * @param string $case
- * @return string
- */
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
@@ -44,8 +36,8 @@ class LanguageCu extends Language {
}
# These rules are not perfect, but they are currently only used for
- # site names so it doesn't matter if they are wrong sometimes. Just add
- # a special case for your site name if necessary.
+ # site names, so it doesn't matter if they are wrong sometimes.
+ # Just add a special case for your site name if necessary.
# join and array_slice instead mb_substr
$ar = [];
@@ -53,11 +45,13 @@ class LanguageCu extends Language {
if ( !preg_match( "/[a-zA-Z_]/u", $word ) ) {
switch ( $case ) {
case 'genitive': # родительный падеж
- if ( ( implode( '', array_slice( $ar[0], -4 ) ) == 'вики' )
- || ( implode( '', array_slice( $ar[0], -4 ) ) == 'Вики' )
- ) {
- } elseif ( implode( '', array_slice( $ar[0], -2 ) ) == 'ї' ) {
- $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ';
+ // if ( ( implode( '', array_slice( $ar[0], -4 ) ) == 'вики' )
+ // || ( implode( '', array_slice( $ar[0], -4 ) ) == 'Вики' )
+ // ) {
+ // }
+
+ if ( implode( '', array_slice( $ar[0], -2 ) ) == 'ї' ) {
+ return implode( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ';
}
break;
case 'accusative': # винительный падеж
diff --git a/includes/languages/LanguageDsb.php b/includes/languages/LanguageDsb.php
index 482824463329..30fcd126e107 100644
--- a/includes/languages/LanguageDsb.php
+++ b/includes/languages/LanguageDsb.php
@@ -28,14 +28,6 @@ use MediaWiki\MediaWikiServices;
* @ingroup Languages
*/
class LanguageDsb extends Language {
- /**
- * Convert from the nominative form of a noun to some other case
- * Invoked with {{grammar:case|word}}
- *
- * @param string $word
- * @param string $case
- * @return string
- */
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
diff --git a/includes/languages/LanguageFi.php b/includes/languages/LanguageFi.php
index 68be28c682f0..bd050331b8a8 100644
--- a/includes/languages/LanguageFi.php
+++ b/includes/languages/LanguageFi.php
@@ -29,14 +29,6 @@ use MediaWiki\User\UserIdentity;
* @ingroup Languages
*/
class LanguageFi extends Language {
- /**
- * Convert from the nominative form of a noun to some other case
- * Invoked with {{grammar:case|word}}
- *
- * @param string $word
- * @param string $case
- * @return string
- */
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
@@ -47,7 +39,7 @@ class LanguageFi extends Language {
# These rules don't cover the whole language.
# They are used only for site names.
- # wovel harmony flag
+ # vowel harmony flag
$aou = preg_match( '/[aou][^äöy]*$/i', $word );
# The flag should be false for compounds where the last word has only neutral vowels (e/i).
diff --git a/includes/languages/LanguageGa.php b/includes/languages/LanguageGa.php
index ce47418bab53..50edfdd6b48f 100644
--- a/includes/languages/LanguageGa.php
+++ b/includes/languages/LanguageGa.php
@@ -27,15 +27,6 @@ use MediaWiki\MediaWikiServices;
* @ingroup Languages
*/
class LanguageGa extends Language {
-
- /**
- * Convert day names
- * Invoked with {{GRAMMAR:transformation|word}}
- *
- * @param string $word
- * @param string $case
- * @return string
- */
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
diff --git a/includes/languages/LanguageGan.php b/includes/languages/LanguageGan.php
index f5382e6ba1d5..780e5163e70a 100644
--- a/includes/languages/LanguageGan.php
+++ b/includes/languages/LanguageGan.php
@@ -27,11 +27,7 @@
* @ingroup Languages
*/
class LanguageGan extends LanguageZh {
-
- /**
- * @inheritDoc
- */
- protected function getSerchIndexVariant() {
+ protected function getSearchIndexVariant() {
return 'gan-hans';
}
}
diff --git a/includes/languages/LanguageHsb.php b/includes/languages/LanguageHsb.php
index 22ca6a8d9248..1325a9a8a993 100644
--- a/includes/languages/LanguageHsb.php
+++ b/includes/languages/LanguageHsb.php
@@ -27,14 +27,7 @@ use MediaWiki\MediaWikiServices;
* @ingroup Languages
*/
class LanguageHsb extends Language {
- /**
- * Convert from the nominative form of a noun to some other case
- * Invoked with {{grammar:case|word}}
- *
- * @param string $word
- * @param string $case
- * @return string
- */
+
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
diff --git a/includes/languages/LanguageHu.php b/includes/languages/LanguageHu.php
index fa3afc14088c..53033ecf027e 100644
--- a/includes/languages/LanguageHu.php
+++ b/includes/languages/LanguageHu.php
@@ -28,11 +28,6 @@ use MediaWiki\MediaWikiServices;
*/
class LanguageHu extends Language {
- /**
- * @param string $word
- * @param string $case
- * @return string
- */
public function convertGrammar( $word, $case ) {
$grammarForms = MediaWikiServices::getInstance()->getMainConfig()
->get( MainConfigNames::GrammarForms );
diff --git a/includes/languages/LanguageHy.php b/includes/languages/LanguageHy.php
index 6bde97680b4d..d7e0e8990f83 100644
--- a/includes/languages/LanguageHy.php
+++ b/includes/languages/LanguageHy.php
@@ -29,14 +29,6 @@ use MediaWiki\MediaWikiServices;
*/
class LanguageHy extends Language {
- /**
- * Convert from the nominative form of a noun to some other case
- * Invoked with {{grammar:case|word}}
- *
- * @param string $word
- * @param string $case
- * @return string
- */
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
diff --git a/includes/languages/LanguageJa.php b/includes/languages/LanguageJa.php
index 180bde799e4f..3331cdd46c9f 100644
--- a/includes/languages/LanguageJa.php
+++ b/includes/languages/LanguageJa.php
@@ -25,12 +25,8 @@
*/
class LanguageJa extends Language {
- /**
- * @param string $string
- * @return string
- */
public function segmentByWord( $string ) {
- // Strip known punctuation ?
+ // Strip known punctuation?
// $s = preg_replace( '/\xe3\x80[\x80-\xbf]/', '', $s ); # U3000-303f
// Space strings of like hiragana/katakana/kanji
@@ -42,13 +38,12 @@ class LanguageJa extends Language {
. '|\xe9\xa6[\x80-\x99])';
# U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
$reg = "/({$hiragana}+|{$katakana}+|{$kanji}+)/";
- $s = self::insertSpace( $string, $reg );
- return $s;
+ return self::insertSpace( $string, $reg );
}
/**
- * Italic is not appropriate for Japanese script
- * Unfortunately most browsers do not recognise this, and render `<em>` as italic
+ * Italic is not appropriate for Japanese script.
+ * Unfortunately, most browsers do not recognise this, and render `<em>` as italic.
*
* @param string $text
* @return string
diff --git a/includes/languages/LanguageKaa.php b/includes/languages/LanguageKaa.php
index ea0651d5f0a1..531aeb958300 100644
--- a/includes/languages/LanguageKaa.php
+++ b/includes/languages/LanguageKaa.php
@@ -28,16 +28,10 @@ use MediaWiki\MediaWikiServices;
*/
class LanguageKaa extends Language {
- # Convert from the nominative form of a noun to some other case
- # Invoked with {{GRAMMAR:case|word}}
-
/**
* Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms
*
- * @param string $word
- * @param string $case
- *
- * @return string
+ * @inheritDoc
*/
public function convertGrammar( $word, $case ) {
$grammarForms =
@@ -50,31 +44,27 @@ class LanguageKaa extends Language {
}
/**
- * It fixes issue with ucfirst for transforming 'i' to 'İ'
+ * Fixes an issue with ucfirst for transforming 'i' to 'İ'
*
- * @param string $string
- *
- * @return string
+ * @inheritDoc
*/
- public function ucfirst( $string ) {
- if ( substr( $string, 0, 1 ) === 'i' ) {
- return 'İ' . substr( $string, 1 );
+ public function ucfirst( $str ) {
+ if ( substr( $str, 0, 1 ) === 'i' ) {
+ return 'İ' . substr( $str, 1 );
}
- return parent::ucfirst( $string );
+ return parent::ucfirst( $str );
}
/**
- * It fixes issue with lcfirst for transforming 'I' to 'ı'
- *
- * @param string $string
+ * Fixes an issue with lcfirst for transforming 'I' to 'ı'
*
- * @return mixed|string
+ * @inheritDoc
*/
- public function lcfirst( $string ) {
- if ( substr( $string, 0, 1 ) === 'I' ) {
- return 'ı' . substr( $string, 1 );
+ public function lcfirst( $str ) {
+ if ( substr( $str, 0, 1 ) === 'I' ) {
+ return 'ı' . substr( $str, 1 );
}
- return parent::lcfirst( $string );
+ return parent::lcfirst( $str );
}
}
diff --git a/includes/languages/LanguageKk.php b/includes/languages/LanguageKk.php
index ac750e544506..9576cc1e96d1 100644
--- a/includes/languages/LanguageKk.php
+++ b/includes/languages/LanguageKk.php
@@ -29,44 +29,35 @@
*/
class LanguageKk extends LanguageKk_cyrl {
/**
- * It fixes issue with ucfirst for transforming 'i' to 'İ'
+ * Fixes an issue with ucfirst for transforming 'i' to 'İ'
*
- * @param string $string
- *
- * @return string
+ * @inheritDoc
*/
- public function ucfirst( $string ) {
- if ( substr( $string, 0, 1 ) === 'i' ) {
+ public function ucfirst( $str ) {
+ if ( substr( $str, 0, 1 ) === 'i' ) {
$variant = $this->getConverterInternal()->getPreferredVariant();
if ( $variant == 'kk-latn' || $variant == 'kk-tr' ) {
- return 'İ' . substr( $string, 1 );
+ return 'İ' . substr( $str, 1 );
}
}
- return parent::ucfirst( $string );
+ return parent::ucfirst( $str );
}
/**
- * It fixes issue with lcfirst for transforming 'I' to 'ı'
- *
- * @param string $string
+ * Fixes issue with lcfirst for transforming 'I' to 'ı'
*
- * @return string
+ * @inheritDoc
*/
- public function lcfirst( $string ) {
- if ( substr( $string, 0, 1 ) === 'I' ) {
+ public function lcfirst( $str ) {
+ if ( substr( $str, 0, 1 ) === 'I' ) {
$variant = $this->getConverterInternal()->getPreferredVariant();
if ( $variant == 'kk-latn' || $variant == 'kk-tr' ) {
- return 'ı' . substr( $string, 1 );
+ return 'ı' . substr( $str, 1 );
}
}
- return parent::lcfirst( $string );
+ return parent::lcfirst( $str );
}
- /**
- * @param string $word
- * @param string $case
- * @return string
- */
public function convertGrammar( $word, $case ) {
// T277689: If there's no word, then there's nothing to convert.
if ( $word === '' ) {
diff --git a/includes/languages/LanguageKk_cyrl.php b/includes/languages/LanguageKk_cyrl.php
index 5ee8ebc1791e..6cc4fd4905f5 100644
--- a/includes/languages/LanguageKk_cyrl.php
+++ b/includes/languages/LanguageKk_cyrl.php
@@ -28,10 +28,10 @@ use MediaWiki\MediaWikiServices;
* @ingroup Languages
*/
class LanguageKk_cyrl extends Language {
- # Convert from the nominative form of a noun to some other case
- # Invoked with {{GRAMMAR:case|word}}
-
/**
+ * Convert from the nominative form of a noun to some other case
+ * Invoked with {{GRAMMAR:case|word}}
+ *
* Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms
*
* @param string $word
@@ -61,7 +61,7 @@ class LanguageKk_cyrl extends Language {
$Sonorants = [ "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з" ];
// Possessives
- $firstPerson = [ "м", "ң" ]; // 1st singular, 2nd unformal
+ $firstPerson = [ "м", "ң" ]; // 1st singular, 2nd informal
$secondPerson = [ "з" ]; // 1st plural, 2nd formal
$thirdPerson = [ "ы", "і" ]; // 3rd
@@ -91,6 +91,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc2":
case "dative": # barıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -107,6 +108,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc21":
case "possessive dative": # täweldık + barıs
if ( in_array( $wordEnding, $firstPerson ) ) {
@@ -129,6 +131,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc3":
case "accusative": # tabıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -151,6 +154,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc31":
case "possessive accusative": # täweldık + tabıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
@@ -160,9 +164,10 @@ class LanguageKk_cyrl extends Language {
$word .= "ды";
}
} elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- $word .= "н";
+ $word .= "н";
}
break;
+
case "dc4":
case "locative": # jatıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -179,6 +184,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc41":
case "possessive locative": # täweldık + jatıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
@@ -195,6 +201,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc5":
case "ablative": # şığıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -220,6 +227,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc51":
case "possessive ablative": # täweldık + şığıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
@@ -236,6 +244,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc6":
case "comitative": # kömektes
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -262,7 +271,9 @@ class LanguageKk_cyrl extends Language {
$word .= "бенен";
}
break;
+
default: # dc0 #nominative #ataw
+ break;
}
return $word;
}
@@ -294,7 +305,7 @@ class LanguageKk_cyrl extends Language {
$Sonorants = [ "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z" ];
// Possessives
- $firstPerson = [ "m", "ñ" ]; // 1st singular, 2nd unformal
+ $firstPerson = [ "m", "ñ" ]; // 1st singular, 2nd informal
$secondPerson = [ "z" ]; // 1st plural, 2nd formal
$thirdPerson = [ "ı", "i" ]; // 3rd
@@ -324,6 +335,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc2":
case "dative": # barıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -340,6 +352,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc21":
case "possessive dative": # täweldık + barıs
if ( in_array( $wordEnding, $firstPerson ) ) {
@@ -362,6 +375,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc3":
case "accusative": # tabıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -384,6 +398,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc31":
case "possessive accusative": # täweldık + tabıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
@@ -396,6 +411,7 @@ class LanguageKk_cyrl extends Language {
$word .= "n";
}
break;
+
case "dc4":
case "locative": # jatıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -412,6 +428,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc41":
case "possessive locative": # täweldık + jatıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
@@ -428,6 +445,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc5":
case "ablative": # şığıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -453,6 +471,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc51":
case "possessive ablative": # täweldık + şığıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
@@ -469,30 +488,32 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc6":
case "comitative": # kömektes
if ( in_array( $wordEnding, $Consonants ) ) {
- $word .= "pen";
+ $word .= "pen";
} elseif ( in_array( $wordEnding, $allVowels )
|| in_array( $wordEnding, $Nasals )
|| in_array( $wordEnding, $Sonants )
) {
- $word .= "men";
+ $word .= "men";
} elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word .= "ben";
+ $word .= "ben";
}
break;
+
case "dc61":
case "possessive comitative": # täweldık + kömektes
if ( in_array( $wordEnding, $Consonants ) ) {
- $word .= "penen";
+ $word .= "penen";
} elseif ( in_array( $wordEnding, $allVowels )
|| in_array( $wordEnding, $Nasals )
|| in_array( $wordEnding, $Sonants )
) {
- $word .= "menen";
+ $word .= "menen";
} elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word .= "benen";
+ $word .= "benen";
}
break;
default: # dc0 #nominative #ataw
@@ -527,7 +548,7 @@ class LanguageKk_cyrl extends Language {
$Sonorants = [ "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز" ];
// Possessives
- $firstPerson = [ "م", "ڭ" ]; // 1st singular, 2nd unformal
+ $firstPerson = [ "م", "ڭ" ]; // 1st singular, 2nd informal
$secondPerson = [ "ز" ]; // 1st plural, 2nd formal
$thirdPerson = [ "ى", "ٸ" ]; // 3rd
@@ -557,6 +578,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc2":
case "dative": # barıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -573,6 +595,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc21":
case "possessive dative": # täweldık + barıs
if ( in_array( $wordEnding, $firstPerson ) ) {
@@ -617,6 +640,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc31":
case "possessive accusative": # täweldık + tabıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
@@ -626,9 +650,10 @@ class LanguageKk_cyrl extends Language {
$word .= "دى";
}
} elseif ( in_array( $wordEnding, $thirdPerson ) ) {
- $word .= "ن";
+ $word .= "ن";
}
break;
+
case "dc4":
case "locative": # jatıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -645,6 +670,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc41":
case "possessive locative": # täweldık + jatıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
@@ -661,6 +687,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc5":
case "ablative": # şığıs
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -686,6 +713,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc51":
case "possessive ablative": # täweldık + şığıs
if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
@@ -702,6 +730,7 @@ class LanguageKk_cyrl extends Language {
}
}
break;
+
case "dc6":
case "comitative": # kömektes
if ( in_array( $wordEnding, $Consonants ) ) {
@@ -710,9 +739,9 @@ class LanguageKk_cyrl extends Language {
|| in_array( $wordEnding, $Nasals )
|| in_array( $wordEnding, $Sonants )
) {
- $word .= "مەن";
+ $word .= "مەن";
} elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word .= "بەن";
+ $word .= "بەن";
}
break;
case "dc61":
@@ -723,12 +752,14 @@ class LanguageKk_cyrl extends Language {
|| in_array( $wordEnding, $Nasals )
|| in_array( $wordEnding, $Sonants )
) {
- $word .= "مەنەن";
+ $word .= "مەنەن";
} elseif ( in_array( $wordEnding, $Sibilants ) ) {
- $word .= "بەنەن";
+ $word .= "بەنەن";
}
break;
+
default: # dc0 #nominative #ataw
+ break;
}
return $word;
}
@@ -740,7 +771,7 @@ class LanguageKk_cyrl extends Language {
*/
private function lastLetter( $word, $allVowels ) {
// Put the word in a form we can play with since we're using UTF-8
- $ar = mb_str_split( parent::lc( $word ), 1 );
+ $ar = mb_str_split( $this->lc( $word ), 1 );
// Here's the last letter in the word
$lastLetter = end( $ar );
diff --git a/includes/languages/LanguageKm.php b/includes/languages/LanguageKm.php
index 0a6e76c34299..7062fff39ae8 100644
--- a/includes/languages/LanguageKm.php
+++ b/includes/languages/LanguageKm.php
@@ -27,12 +27,13 @@
class LanguageKm extends Language {
/**
- * @param string $number
- * @param bool|null $noSeparators
+ * @param string|int|float $number
+ *
* @return string
*/
- public function formatNum( $number, $noSeparators = null ) {
- /* NO-op for Khmer. Cannot use
+ public function formatNum( $number ) {
+ /**
+ * NO-op for Khmer. Cannot use
* $separatorTransformTable = [ ',' => '' ]
* That would break when parsing and doing strstr '' => 'foo';
*/
diff --git a/includes/languages/LanguageKsh.php b/includes/languages/LanguageKsh.php
index 1c39a6481ff1..533630744bfb 100644
--- a/includes/languages/LanguageKsh.php
+++ b/includes/languages/LanguageKsh.php
@@ -26,7 +26,7 @@
*/
class LanguageKsh extends Language {
// Do not add male wiki families, since that's the default.
- // No need add neuter wikis having names ending in -wiki.
+ // No need to add neuter to wikis having names ending in "-wiki".
private static $familygender = [
'wikipedia' => 'f',
'wikiversity' => 'f',
@@ -40,11 +40,10 @@ class LanguageKsh extends Language {
];
/**
- * Convert from the nominative form of a noun to other cases.
- * Invoked with {{GRAMMAR:case|word}} inside messages.
+ * @inheritDoc
*
- * case is a sequence of words, each of which is case insensitive.
- * Between words, there must be at least one space character.
+ * $case is a sequence of words, each of which is case insensitive.
+ * There must be at least one space character between words.
* Only the 1st character of each word is considered.
* Word order is irrelevant.
*
@@ -56,15 +55,15 @@ class LanguageKsh extends Language {
*
* Possible values specifying the article type are:
* Betoont focussed or stressed article
- * -omitted- unstressed or unfocussed article
+ * -omitted- unstressed or unfocused article
*
* Possible values for the type of genitive are:
* Sing, Iehr prepositioned genitive = possessive dative
* Vun, Fon, -omitted- postpositioned genitive = preposition "vun" with dative
*
- * Values of case overrides & prepositions, in the order of preceedence:
+ * Values of case overrides & prepositions, in the order of precedence:
* Sing, Iehr possessive dative = prepositioned genitive
- * Vun, Fon preposition "vun" with dative = postpositioned genitive
+ * Vun, Fon preposition "vun" with dative = post positioned genitive
* En, em preposition "en" with dative
*
* Values for object gender specifiers of the possessive dative, or
@@ -77,21 +76,19 @@ class LanguageKsh extends Language {
* http://translatewiki.net/wiki/Portal:Ksh#GRAMMAR_Pr%C3%B6%C3%B6fe
* Contents of the leftmost table column can be copied and pasted as
* "case" values.
- *
- * @param string $word
- * @param string $case
- *
- * @return string
*/
public function convertGrammar( $word, $case ) {
$lord = strtolower( $word );
$gender = 'm'; // Nuutnaarel // default
if ( preg_match( '/wiki$/', $lord ) ) {
- $gender = 'n'; // Dat xyz-wiki
+ $gender = 'n'; // Dat xyz-wiki
}
if ( isset( self::$familygender[$lord] ) ) {
$gender = self::$familygender[$lord];
}
+
+ $isGenderFemale = $gender === 'f';
+
$case = ' ' . strtolower( $case );
if ( preg_match( '/ [is]/', $case ) ) {
# däm WikiMaatplaz singe, dä Wikipeedija iere, däm Wikiwööterbooch singe
@@ -99,35 +96,34 @@ class LanguageKsh extends Language {
# däm WikiMaatplaz sing, dä Wikipeedija ier, däm Wikiwööterbooch sing
# dem/em WikiMaatplaz sing, de Wikipeedija ier, dem/em Wikiwööterbooch sing
$word = ( preg_match( '/ b/', $case )
- ? ( $gender == 'f' ? 'dä' : 'däm' )
- : ( $gender == 'f' ? 'de' : 'dem' )
- ) . ' ' . $word . ' ' .
- ( $gender == 'f' ? 'ier' : 'sing' ) .
- ( preg_match( '/ m/', $case ) ? 'e' : ''
- );
+ ? ( $isGenderFemale ? 'dä' : 'däm' )
+ : ( $isGenderFemale ? 'de' : 'dem' )
+ ) . ' ' . $word . ' ' .
+ ( $isGenderFemale ? 'ier' : 'sing' ) .
+ ( preg_match( '/ m/', $case ) ? 'e' : '' );
} elseif ( preg_match( '/ e/', $case ) ) {
# en dämm WikiMaatPlaz, en dä Wikipeedija, en dämm Wikiwööterbooch
# em WikiMaatplaz, en de Wikipeedija, em Wikiwööterbooch
if ( preg_match( '/ b/', $case ) ) {
- $word = 'en ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word;
+ $word = 'en ' . ( $isGenderFemale ? 'dä' : 'däm' ) . ' ' . $word;
} else {
- $word = ( $gender == 'f' ? 'en de' : 'em' ) . ' ' . $word;
+ $word = ( $isGenderFemale ? 'en de' : 'em' ) . ' ' . $word;
}
} elseif ( preg_match( '/ [fv]/', $case ) || preg_match( '/ [2jg]/', $case ) ) {
# vun däm WikiMaatplaz, vun dä Wikipeedija, vun däm Wikiwööterbooch
# vum WikiMaatplaz, vun de Wikipeedija, vum Wikiwööterbooch
if ( preg_match( '/ b/', $case ) ) {
- $word = 'vun ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word;
+ $word = 'vun ' . ( $isGenderFemale ? 'dä' : 'däm' ) . ' ' . $word;
} else {
- $word = ( $gender == 'f' ? 'vun de' : 'vum' ) . ' ' . $word;
+ $word = ( $isGenderFemale ? 'vun de' : 'vum' ) . ' ' . $word;
}
} elseif ( preg_match( '/ [3d]/', $case ) ) {
# dämm WikiMaatPlaz, dä Wikipeedija, dämm Wikiwööterbooch
# dem/em WikiMaatplaz, de Wikipeedija, dem/em Wikiwööterbooch
if ( preg_match( '/ b/', $case ) ) {
- $word = ( $gender == 'f' ? 'dää' : 'dämm' ) . ' ' . $word;
+ $word = ( $isGenderFemale ? 'dää' : 'dämm' ) . ' ' . $word;
} else {
- $word = ( $gender == 'f' ? 'de' : 'dem' ) . ' ' . $word;
+ $word = ( $isGenderFemale ? 'de' : 'dem' ) . ' ' . $word;
}
} else {
# dä WikiMaatPlaz, di Wikipeedija, dat Wikiwööterbooch
@@ -178,12 +174,14 @@ class LanguageKsh extends Language {
}
$forms = $this->preConvertPlural( $forms, 3 );
- if ( $count == 1 ) {
+ if ( $count === 1 ) {
return $forms[0];
- } elseif ( $count == 0 ) {
+ }
+
+ if ( $count === 0 ) {
return $forms[2];
- } else {
- return $forms[1];
}
+
+ return $forms[1];
}
}
diff --git a/includes/languages/LanguageLa.php b/includes/languages/LanguageLa.php
index fa674b1b646e..ed347e63bf7f 100644
--- a/includes/languages/LanguageLa.php
+++ b/includes/languages/LanguageLa.php
@@ -31,7 +31,7 @@ class LanguageLa extends Language {
* Convert from the nominative form of a noun to some other case
*
* Just used in a couple places for sitenames; special-case as necessary.
- * Rules are far from complete.
+ * The rules are far from complete.
*
* Cases: genitive, accusative, ablative
*
@@ -67,6 +67,7 @@ class LanguageLa extends Language {
'ei'
];
return preg_replace( $in, $out, $word );
+
case 'accusative':
// only a few declensions, and even for those mostly the singular only
$in = [
@@ -86,6 +87,7 @@ class LanguageLa extends Language {
'em'
];
return preg_replace( $in, $out, $word );
+
case 'ablative':
// only a few declensions, and even for those mostly the singular only
$in = [
@@ -105,6 +107,7 @@ class LanguageLa extends Language {
'e'
];
return preg_replace( $in, $out, $word );
+
default:
return $word;
}
diff --git a/includes/languages/LanguageMl.php b/includes/languages/LanguageMl.php
index a5a9e59cb527..333f388472a0 100644
--- a/includes/languages/LanguageMl.php
+++ b/includes/languages/LanguageMl.php
@@ -18,6 +18,8 @@
* @file
*/
+use MediaWiki\Languages\Data\NormalizeMl;
+
/**
* Malayalam (മലയാളം)
*
@@ -40,7 +42,6 @@ class LanguageMl extends Language {
*/
public function normalize( $s ) {
$s = parent::normalize( $s );
- $s = $this->transformUsingPairFile( MediaWiki\Languages\Data\NormalizeMl::class, $s );
- return $s;
+ return $this->transformUsingPairFile( NormalizeMl::class, $s );
}
}
diff --git a/includes/languages/LanguageMy.php b/includes/languages/LanguageMy.php
index 7abf05d66105..8a283d2af657 100644
--- a/includes/languages/LanguageMy.php
+++ b/includes/languages/LanguageMy.php
@@ -27,11 +27,10 @@
class LanguageMy extends Language {
/**
- * @param string $number
- * @param bool|null $noSeparators
+ * @param string|int|float $number
* @return string
*/
- public function formatNum( $number, $noSeparators = null ) {
+ public function formatNum( $number ) {
/* NO-op. Cannot use
* $separatorTransformTable = [ ',' => '' ]
* That would break when parsing and doing strstr '' => 'foo';
diff --git a/includes/languages/LanguageOs.php b/includes/languages/LanguageOs.php
index 86e94ea7ff15..de9b5c7ee73a 100644
--- a/includes/languages/LanguageOs.php
+++ b/includes/languages/LanguageOs.php
@@ -33,21 +33,21 @@ 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.
+ * Depending on the word, there are four different ways of converting to other cases.
+ * 1) Words 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 'æм'.
+ * Then result word is: word - last letter + case ending. Ending of the allative case here is 'æм'.
*
- * 2.2) Word is in singular.
+ * 2.2) Word is in singular form.
* 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 'æ'.
+ * The resultant word is: word + 'й' + case ending for cases != allative or comitative
+ * and word + case ending for allative or comitative. Ending of the allative case here is 'æ'.
*
* @param string $word
* @param string $case
@@ -59,16 +59,16 @@ class LanguageOs extends Language {
if ( isset( $grammarForms['os'][$case][$word] ) ) {
return $grammarForms['os'][$case][$word];
}
- # Ending for allative case
+ # Ending for the allative case
$end_allative = 'мæ';
- # Variable for 'j' beetwen vowels
+ # Variable for 'j' between vowels
$jot = '';
# Variable for "-" for not Ossetic words
$hyphen = '';
# Variable for ending
$ending = '';
- # CHecking if the $word is in plural form
+ # Checking if the $word is in plural form
if ( preg_match( '/тæ$/u', $word ) ) {
$word = mb_substr( $word, 0, -1 );
$end_allative = 'æм';
@@ -91,12 +91,15 @@ class LanguageOs extends Language {
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 . 'æ';
@@ -104,14 +107,18 @@ class LanguageOs extends Language {
$ending = $hyphen . $jot . 'æй';
}
break;
+
case 'inessive':
break;
+
case 'superessive':
$ending = $hyphen . $jot . 'ыл';
break;
+
case 'equative':
$ending = $hyphen . $jot . 'ау';
break;
+
case 'comitative':
$ending = $hyphen . 'имæ';
break;
diff --git a/includes/languages/LanguageQqx.php b/includes/languages/LanguageQqx.php
index 3d864a9676a7..d42ada6a6db2 100644
--- a/includes/languages/LanguageQqx.php
+++ b/includes/languages/LanguageQqx.php
@@ -19,7 +19,7 @@
*/
/**
- * Dummy language that return the message names.
+ * Dummy language that returns the message names.
*
* For all translated messages, this returns a special value handled in Message::format()
* to display the message key (and fallback keys) and the parameters passed to the message.
@@ -29,14 +29,11 @@
* extensions that assume the contents of some messages are valid.
*
* @ingroup Languages
- * @deprecated since 1.41 The overridden method is deprecated. The feature has been reimplemented
+ * @deprecated since 1.41. The overridden method is deprecated. The feature has been reimplemented
* in MessageCache. Callers doing "new LanguageQqx" should use
* $languageFactory->getLanguage( 'qqx' ) to get a Language object with its code set to qqx.
*/
class LanguageQqx extends Language {
- /**
- * @inheritDoc
- */
public function getMessage( $key ) {
// Special value replaced in Message::format()
return '($*)';
diff --git a/includes/languages/LanguageSl.php b/includes/languages/LanguageSl.php
index 62feb294343d..a69cb640384a 100644
--- a/includes/languages/LanguageSl.php
+++ b/includes/languages/LanguageSl.php
@@ -27,16 +27,11 @@ use MediaWiki\MediaWikiServices;
* @ingroup Languages
*/
class LanguageSl extends Language {
- # Convert from the nominative form of a noun to some other case
- # Invoked with {{GRAMMAR:case|word}}
/**
* Cases: rodilnik, dajalnik, tožilnik, mestnik, orodnik
*
- * @param string $word
- * @param string $case
- *
- * @return string
+ * @inheritDoc
*/
public function convertGrammar( $word, $case ) {
$grammarForms =
@@ -49,6 +44,7 @@ class LanguageSl extends Language {
case 'mestnik': # locative
$word = 'o ' . $word;
break;
+
case 'orodnik': # instrumental
$word = 'z ' . $word;
break;
diff --git a/includes/languages/LanguageTr.php b/includes/languages/LanguageTr.php
index e62a4ccc42b1..3c57b7f947ba 100644
--- a/includes/languages/LanguageTr.php
+++ b/includes/languages/LanguageTr.php
@@ -37,33 +37,25 @@
*/
class LanguageTr extends Language {
- private $uc = [ 'I', 'İ' ];
- private $lc = [ 'ı', 'i' ];
+ private const UC = [ 'I', 'İ' ];
+ private const LC = [ 'ı', 'i' ];
- /**
- * @param string $string
- * @return string
- */
- public function ucfirst( $string ) {
- $first = mb_substr( $string, 0, 1 );
- if ( in_array( $first, $this->lc ) ) {
- $first = str_replace( $this->lc, $this->uc, $first );
- return $first . mb_substr( $string, 1 );
+ public function ucfirst( $str ) {
+ $first = mb_substr( $str, 0, 1 );
+ if ( in_array( $first, self::LC ) ) {
+ $first = str_replace( self::LC, self::UC, $first );
+ return $first . mb_substr( $str, 1 );
}
- return parent::ucfirst( $string );
+ return parent::ucfirst( $str );
}
- /**
- * @param string $string
- * @return mixed|string
- */
- public function lcfirst( $string ) {
- $first = mb_substr( $string, 0, 1 );
- if ( in_array( $first, $this->uc ) ) {
- $first = str_replace( $this->uc, $this->lc, $first );
- return $first . mb_substr( $string, 1 );
+ public function lcfirst( $str ) {
+ $first = mb_substr( $str, 0, 1 );
+ if ( in_array( $first, self::UC ) ) {
+ $first = str_replace( self::UC, self::LC, $first );
+ return $first . mb_substr( $str, 1 );
}
- return parent::lcfirst( $string );
+ return parent::lcfirst( $str );
}
}
diff --git a/includes/languages/LanguageTyv.php b/includes/languages/LanguageTyv.php
index ccfe868a0831..f76d613c7129 100644
--- a/includes/languages/LanguageTyv.php
+++ b/includes/languages/LanguageTyv.php
@@ -29,14 +29,7 @@ use MediaWiki\MediaWikiServices;
* @ingroup Languages
*/
class LanguageTyv extends Language {
- /**
- * Grammatical transformations, needed for inflected languages
- * Invoked by putting {{grammar:case|word}} in a message
- *
- * @param string $word
- * @param string $case
- * @return string
- */
+
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
@@ -76,144 +69,151 @@ class LanguageTyv extends Language {
case "genitive":
if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
- $word = $word . "түң";
+ $word .= "түң";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
- $word = $word . "тиң";
+ $word .= "тиң";
} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
- $word = $word . "туң";
+ $word .= "туң";
} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
- $word = $word . "тың";
+ $word .= "тың";
}
} elseif ( $wordEnding === "л" ) {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
- $word = $word . "дүң";
+ $word .= "дүң";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
- $word = $word . "диң";
+ $word .= "диң";
} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
- $word = $word . "дуң";
+ $word .= "дуң";
} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
- $word = $word . "дың";
+ $word .= "дың";
}
} else {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
- $word = $word . "нүң";
+ $word .= "нүң";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
- $word = $word . "ниң";
+ $word .= "ниң";
} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
- $word = $word . "нуң";
+ $word .= "нуң";
} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
- $word = $word . "ның";
+ $word .= "ның";
}
}
break;
+
case "dative":
if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ке";
+ $word .= "ке";
} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "ка";
+ $word .= "ка";
}
} else {
if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ге";
+ $word .= "ге";
} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "га";
+ $word .= "га";
}
}
break;
+
case "accusative":
if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
- $word = $word . "тү";
+ $word .= "тү";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
- $word = $word . "ти";
+ $word .= "ти";
} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
- $word = $word . "ту";
+ $word .= "ту";
} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
- $word = $word . "ты";
+ $word .= "ты";
}
} elseif ( $wordEnding === "л" ) {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
- $word = $word . "дү";
+ $word .= "дү";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
- $word = $word . "ди";
+ $word .= "ди";
} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
- $word = $word . "ду";
+ $word .= "ду";
} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
- $word = $word . "ды";
+ $word .= "ды";
}
} else {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
- $word = $word . "нү";
+ $word .= "нү";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
- $word = $word . "ни";
+ $word .= "ни";
} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
- $word = $word . "ну";
+ $word .= "ну";
} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
- $word = $word . "ны";
+ $word .= "ны";
}
}
break;
+
case "locative":
if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "те";
+ $word .= "те";
} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "та";
+ $word .= "та";
}
} else {
if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "де";
+ $word .= "де";
} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "да";
+ $word .= "да";
}
}
break;
+
case "ablative":
if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "тен";
+ $word .= "тен";
} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "тан";
+ $word .= "тан";
}
} else {
if ( in_array( $wordLastVowel, $frontVowels ) ) {
- $word = $word . "ден";
+ $word .= "ден";
} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
- $word = $word . "дан";
+ $word .= "дан";
}
}
break;
+
case "directive1":
if ( in_array( $wordEnding, $directiveVoicedStems ) ) {
- $word = $word . "же";
+ $word .= "же";
} elseif ( in_array( $wordEnding, $directiveUnvoicedStems ) ) {
- $word = $word . "че";
+ $word .= "че";
}
break;
+
case "directive2":
if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
- $word = $word . "түве";
+ $word .= "түве";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
- $word = $word . "тиве";
+ $word .= "тиве";
} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
- $word = $word . "туве";
+ $word .= "туве";
} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
- $word = $word . "тыве";
+ $word .= "тыве";
}
} else {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
- $word = $word . "дүве";
+ $word .= "дүве";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
- $word = $word . "диве";
+ $word .= "диве";
} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
- $word = $word . "дуве";
+ $word .= "дуве";
} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
- $word = $word . "дыве";
+ $word .= "дыве";
}
}
break;
+
default:
break;
}
diff --git a/includes/languages/LanguageWa.php b/includes/languages/LanguageWa.php
index b659142fe22f..652fa51304fb 100644
--- a/includes/languages/LanguageWa.php
+++ b/includes/languages/LanguageWa.php
@@ -33,21 +33,17 @@ class LanguageWa extends Language {
* "<day> di <monthname>" for months starting by a consoun, and
* "<day> d' <monthname>" for months starting with a vowel
*
- * @param string $ts
- * @param bool $adj
- * @param bool $format
- * @param bool $tc
- * @return string
+ * @inheritDoc
*/
- public function date( $ts, $adj = false, $format = true, $tc = false ) {
+ public function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
$datePreference = $this->dateFormat( $format );
if ( $datePreference == 'ISO 8601' || $datePreference == 'walloon short' ) {
- return parent::date( $ts, $adj, $format, $tc );
+ return parent::date( $ts, $adj, $format, $timecorrection );
}
$ts = wfTimestamp( TS_MW, $ts );
if ( $adj ) {
- $ts = $this->userAdjust( $ts, $tc );
+ $ts = $this->userAdjust( $ts, $timecorrection );
}
# Walloon 'dmy' format
@@ -69,13 +65,6 @@ class LanguageWa extends Language {
return $d;
}
- /**
- * @param string $ts
- * @param bool $adj
- * @param bool $format
- * @param bool $tc
- * @return string
- */
public function timeanddate( $ts, $adj = false, $format = true, $tc = false ) {
$datePreference = $this->dateFormat( $format );
if ( $datePreference == 'ISO 8601' || $datePreference == 'walloon short' ) {
diff --git a/includes/languages/LanguageWuu.php b/includes/languages/LanguageWuu.php
index fe57d1d9a01b..a16419598a69 100644
--- a/includes/languages/LanguageWuu.php
+++ b/includes/languages/LanguageWuu.php
@@ -27,10 +27,7 @@
* @ingroup Languages
*/
class LanguageWuu extends LanguageZh {
- /**
- * @inheritDoc
- */
- protected function getSerchIndexVariant() {
+ protected function getSearchIndexVariant() {
return 'wuu-hans';
}
}
diff --git a/includes/languages/LanguageYue.php b/includes/languages/LanguageYue.php
index 7ff4310276d3..a5f5afe2097f 100644
--- a/includes/languages/LanguageYue.php
+++ b/includes/languages/LanguageYue.php
@@ -25,16 +25,13 @@
*/
class LanguageYue extends Language {
- /**
- * @return bool
- */
public function hasWordBreaks() {
return false;
}
/**
- * Eventually this should be a word segmentation;
- * for now just treat each character as a word.
+ * Eventually, this should be a word segmentation;
+ * but for now just treat each character as a word.
* @todo FIXME: Only do this for Han characters...
*
* @param string $string
@@ -42,7 +39,6 @@ class LanguageYue extends Language {
*/
public function segmentByWord( $string ) {
$reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
- $s = self::insertSpace( $string, $reg );
- return $s;
+ return self::insertSpace( $string, $reg );
}
}
diff --git a/includes/languages/LanguageZh.php b/includes/languages/LanguageZh.php
index 11aa6be44480..1325834f7c51 100644
--- a/includes/languages/LanguageZh.php
+++ b/includes/languages/LanguageZh.php
@@ -47,30 +47,18 @@ class LanguageZh extends LanguageZh_hans {
return preg_replace( '/[\xc0-\xff][\x80-\xbf]*/', "\x0c$0", $text );
}
- /**
- * @param string $text
- * @return string
- */
public function unsegmentForDiff( $text ) {
return str_replace( "\x0c", '', $text );
}
- /**
- * @inheritDoc
- */
- protected function getSerchIndexVariant() {
+ protected function getSearchIndexVariant() {
return 'zh-hans';
}
- /**
- * @param string[] $termsArray
- * @return string[]
- */
public function convertForSearchResult( $termsArray ) {
$terms = implode( '|', $termsArray );
$terms = self::convertDoubleWidth( $terms );
$terms = implode( '|', $this->getConverterInternal()->autoConvertToAllVariants( $terms ) );
- $ret = array_unique( explode( '|', $terms ) );
- return $ret;
+ return array_unique( explode( '|', $terms ) );
}
}
diff --git a/includes/languages/LanguageZh_hans.php b/includes/languages/LanguageZh_hans.php
index 66aa9a343503..13fbe4872ea5 100644
--- a/includes/languages/LanguageZh_hans.php
+++ b/includes/languages/LanguageZh_hans.php
@@ -25,51 +25,27 @@
* @ingroup Languages
*/
class LanguageZh_hans extends Language {
- /**
- * @return bool
- */
public function hasWordBreaks() {
return false;
}
/**
- * Eventually this should be a word segmentation;
- * for now just treat each character as a word.
* @todo FIXME: Only do this for Han characters...
*
- * @param string $string
- *
- * @return string
+ * @inheritDoc
*/
public function segmentByWord( $string ) {
$reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
- $s = self::insertSpace( $string, $reg );
- return $s;
+ return self::insertSpace( $string, $reg );
}
- /**
- * @param string $s
- * @return string
- */
public function normalizeForSearch( $s ) {
// Double-width roman characters
$s = parent::normalizeForSearch( $s );
$s = trim( $s );
- $s = $this->segmentByWord( $s );
-
- return $s;
+ return $this->segmentByWord( $s );
}
- /**
- * Takes a number of seconds and turns it into a text using values such as hours and minutes.
- *
- * @since 1.21
- *
- * @param int $seconds The amount of seconds.
- * @param array $chosenIntervals The intervals to enable.
- *
- * @return string
- */
public function formatDuration( $seconds, array $chosenIntervals = [] ) {
if ( !$chosenIntervals ) {
$chosenIntervals = [ 'centuries', 'years', 'days', 'hours', 'minutes', 'seconds' ];
diff --git a/includes/languages/data/CrhExceptions.php b/includes/languages/data/CrhExceptions.php
index 7dddb9c6e0db..6eae61a6ccc5 100644
--- a/includes/languages/data/CrhExceptions.php
+++ b/includes/languages/data/CrhExceptions.php
@@ -124,9 +124,9 @@ class CrhExceptions {
* variants: all lowercase, all uppercase, first letter capitalized
*/
private $ManyToOneC2LMappings = [
- # Carefully ordered many-to-one mappings
- # these are ordered so C2L is correct (the later Latin one)
- # see also L2C mappings below
+ # Carefully ordered many-to-one mapping.
+ # These are ordered so that the C2L is correct (the later Latin one).
+ # See also the L2C mappings below
'fevqülade' => 'февкъульаде', 'fevqulade' => 'февкъульаде',
'beyude' => 'бейуде', 'beyüde' => 'бейуде',
'curat' => 'джурьат', 'cürat' => 'джурьат',
@@ -385,7 +385,7 @@ class CrhExceptions {
/**
* @var string[] map Cyrillic to Latin and back, match beginning of word
- * variants: all lowercase, all uppercase, first letter capitalized
+ * variants: all lowercase letters, all uppercase letters, first letter capitalized
* items with capture group refs (e.g., $1) are only mapped from the
* regex to the reference
*/
@@ -816,7 +816,7 @@ class CrhExceptions {
'/ЙЬ/u' => 'Й',
# частичное решение проблемы слова юз - 100
- # Partial solution of the problem of the word юз ("100")
+ # Partial solution to the problem of the word юз ("100")
# notice that these are cross-word patterns
'/эки юзь/u' => 'эки юз', '/Эки юзь/u' => 'Эки юз', '/ЭКИ ЮЗЬ/u' => 'ЭКИ ЮЗ',
'/учь юзь/u' => 'учь юз', '/Учь юзь/u' => 'Учь юз', '/УЧЬ ЮЗЬ/u' => 'УЧЬ ЮЗ',