Вікіпэдыя:LanguageBe.php (converter)

Зьвесткі зь Вікіпэдыі — вольнай энцыкляпэдыі

Бягучы LanguageBe.php пераймяноўваецца ў LanguageBe_cl.php.

Мадыфікаваны LanguageZh.php вэрсіі 15978.

/**
  * @package MediaWiki
  * @subpackage Language
  */
require_once( dirname(__FILE__).'/LanguageConverter.php' );
require_once( dirname(__FILE__).'/LanguageBe_cl.php' );

class BeConverter extends LanguageConverter {
	function loadDefaultTables() {
		require( "includes/BeConversion.php" );
		$this->mTables = array();
		$this->mTables['be-cl'] = $be2CL;
		$this->mTables['be-of'] = $be2OF;
		$this->mTables['be'] = array();
	}

	/* there shouldn't be any latin text in Belarusian conversion, so no need
	   to mark anything
    */
	function markNoConversion($text) {
		return $text;
	}

	function convertCategoryKey( $key ) {
		return $this->autoConvert( $key, 'be-cl' );
	}
}

/* class that handles both classic and official spellings
   right now it only distinguish be cl and be of.
*/
class LanguageBe extends LanguageBe_cl {

	function __construct() {
		global $wgHooks;
		parent::__construct();
		$this->mConverter = new BeConverter($this, 'be',
                                            array('be', 'be-cl', 'be-of'),
/* Don't sure what this means
							array('zh'=>'zh-cn',
								  'zh-cn'=>'zh-sg',
								  'zh-sg'=>'zh-cn',
								  'zh-tw'=>'zh-hk',
								  'zh-hk'=>'zh-tw'));
*/
		$wgHooks['ArticleSaveComplete'][] = $this->mConverter;
	}

	// word segmentation
	function stripForSearch( $string ) {
		$fname="LanguageBe::stripForSearch";
		wfProfileIn( $fname );

        //always convert to be-cl before indexing.

		$t = $this->mConverter->autoConvert($string, 'be-cl');
		$t = parent::stripForSearch( $t );
		wfProfileOut( $fname );
		return $t;

	}

	function convertForSearchResult( $termsArray ) {
		$terms = implode( '|', $termsArray );
		$terms = implode( '|', $this->mConverter->autoConvertToAllVariants( $terms ) );
		$ret = array_unique( explode('|', $terms) );
		return $ret;
	}

}

Мадыфікаваны LanguageZh.deps.php вэрсіі 15823.

// This file exists to ensure that base classes are preloaded before
// LanguageBe.php is compiled, working around a bug in the APC opcode
// cache on PHP 5, where cached code can break if the include order
// changed on a subsequent page view.
// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html

require_once( dirname(__FILE__).'/LanguageBe_cl.php' );
require_once( dirname(__FILE__).'/LanguageConverter.php' );

../include/BeConversion.php[рэдагаваць крыніцу]

Мадыфікаваны ZhConversion.php вэрсіі 12472.

/**
 * Classic/Official Belarusian conversion tables
 *
 * Automatically generated using code and data in includes/betable/
 * Do not modify directly!
 *
 * @package MediaWiki
*/

$be2CL=array(
"Расліны"=>"Расьліны",
);

$be2OF=array(
"Расьліны"=>"Расліны",
);