* @ingroup Language
*/
class KkConverter extends LanguageConverter {
-
protected $mCyrl2Latn, $mLatn2Cyrl, $mCyLa2Arab;
/**
- * @param $langobj Language
- * @param $maincode string
- * @param $variants array
- * @param $variantfallbacks array
- * @param $flags array
+ * @param Language $langobj
+ * @param string $maincode
+ * @param array $variants
+ * @param array $variantfallbacks
+ * @param array $flags
*/
function __construct( $langobj, $maincode,
$variants = array(),
* update: delete all rule parsing because it's not used
* currently, and just produces a couple of bugs
*
- * @param $rule string
- * @param $flags array
+ * @param string $rule
+ * @param array $flags
* @return array
*/
function parseManualRule( $rule, $flags = array() ) {
* names as they were
* - do not try to find variants for usernames
*
- * @param $link string
- * @param $nt Title
+ * @param string &$link
+ * @param Title &$nt
* @param bool $ignoreOtherCond
*/
function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
}
}
- /**
- * An ugly function wrapper for parsing Image titles
- * (to prevent image name conversion)
- *
- * @param $text string
- * @param $toVariant bool
- *
- * @return string
- */
- function autoConvert( $text, $toVariant = false ) {
- global $wgTitle;
- if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) {
- $imagename = $wgTitle->getNsText();
- if ( preg_match( "/^$imagename:/", $text ) ) {
- return $text;
- }
- }
- return parent::autoConvert( $text, $toVariant );
- }
-
/**
* It translates text into variant
*
- * @param $text string
- * @param $toVariant string
+ * @param string $text
+ * @param string $toVariant
*
* @return string
*/
// disable conversion variables like $1, $2...
$varsfix = '\$[0-9]';
- $matches = preg_split( '/' . $varsfix . '[^' . $letters . ']+/u', $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
+ $matches = preg_split(
+ '/' . $varsfix . '[^' . $letters . ']+/u',
+ $text,
+ -1,
+ PREG_SPLIT_OFFSET_CAPTURE
+ );
+
$mstart = 0;
$ret = '';
+
foreach ( $matches as $m ) {
$ret .= substr( $text, $mstart, $m[1] -$mstart );
$ret .= $this->regsConverter( $m[0], $toVariant );
$mstart = $m[1] + strlen( $m[0] );
}
+
return $ret;
}
/**
- * @param $text string
- * @param $toVariant string
+ * @param string $text
+ * @param string $toVariant
* @return mixed|string
*/
function regsConverter( $text, $toVariant ) {
switch ( $toVariant ) {
case 'kk-arab':
case 'kk-cn':
- $letters = KK_C_LC . KK_C_UC/*.KK_L_LC.KK_L_UC*/;
- $front = 'әөүіӘӨҮІ'/*.'äöüiÄÖÜİ'*/;
- $excludes = 'еэгғкқЕЭГҒКҚ'/*.'eégğkqEÉGĞKQ'*/;
+ $letters = KK_C_LC . KK_C_UC; /*.KK_L_LC.KK_L_UC*/
+ $front = 'әөүіӘӨҮІ'; /*.'äöüiÄÖÜİ'*/
+ $excludes = 'еэгғкқЕЭГҒКҚ'; /*.'eégğkqEÉGĞKQ'*/
// split text to words
$matches = preg_split( '/[\b\s\-\.:]+/', $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
$mstart = 0;
// is matched the word to front vowels?
// exclude a words matched to е, э, г, к, к, қ,
// them should be without hamza
- if ( preg_match( '/[' . $front . ']/u', $m[0] ) && !preg_match( '/[' . $excludes . ']/u', $m[0] ) ) {
+ if ( preg_match( '/[' . $front . ']/u', $m[0] )
+ && !preg_match( '/[' . $excludes . ']/u', $m[0] )
+ ) {
$ret .= preg_replace( '/[' . $letters . ']+/u', H_HAMZA . '$0', $m[0] );
} else {
$ret .= $m[0];
}
/**
- * @param $key string
- * @return String
+ * @param string $key
+ * @return string
*/
function convertCategoryKey( $key ) {
return $this->autoConvert( $key, 'kk' );
}
-
}
/**
* @ingroup Language
*/
class LanguageKk extends LanguageKk_cyrl {
-
function __construct() {
global $wgHooks;
parent::__construct();
/**
* It fixes issue with ucfirst for transforming 'i' to 'İ'
*
- * @param $string string
+ * @param string $string
*
* @return string
*/
/**
* It fixes issue with lcfirst for transforming 'I' to 'ı'
*
- * @param $string string
+ * @param string $string
*
* @return string
*/
}
/**
- * @param $word string
- * @param $case string
+ * @param string $word
+ * @param string $case
* @return string
*/
function convertGrammar( $word, $case ) {