Jump to content

Talk:Wp/tzm/ⵊⴰⴷⵓ

Add topic
From Wikimedia Incubator

Conversion automatisée Tifinagh -> Latin

[edit source]

<?php /**

 * @addtogroup Language
 */

/*

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

class ShiConverter extends LanguageConverter { var $mToLatin = array( 'ⴰ'=>'a', 'ⴱ'=>'b', 'ⵛ'=>'c', 'ⴷ'=>'d', 'ⴹ'=>'ḍ', 'ⴻ'=>'e', 'ⴼ'=>'f', 'ⴳ'=>'g', 'ⵖ'=>'gh', 'ⵀ'=>'h', 'ⵃ'=>'ḥ' , 'ⵉ'=>'i', 'ⴽ'=>'k', 'ⵄ'=>'â', 'ⵊ'=>'j', 'ⵍ'=>'l' , 'ⵎ'=>'m', 'ⵏ'=>'n', 'ⵇ'=>'q', 'ⵔ'=>'r', 'ⵕ'=>'ṛ' ,'ⵙ'=>'s', 'ⵚ'=>'ṣ' , 'ⵜ'=>'t', 'ⵟ'=>'ṭ' , 'ⵓ'=>'u', 'ⵅ'=>'x', 'ⵡ'=>'w', 'ⵢ'=>'y', 'ⵣ'=>'z', 'ⵥ'=>'ẓ' 'ⴽⵯ'=>'kᵂ', 'ⴳⵯ'=>'gᵂ'

);

var $mUpperToLowerCaseLatin = array( 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z', );

var $mToTifinagh = array( 'a'=>'ⴰ', 'b'=>'ⴱ', 'c'=>'ⵛ', 'd'=>'ⴷ', 'ḍ'=>'ⴹ', 'e'=>'ⴻ', 'f'=>'ⴼ', 'g'=>'ⴳ', 'gh'=>'ⵖ', 'h'=>'ⵀ', 'ḥ'=>'ⵃ' , 'i'=>'ⵉ', 'k'=>'ⴽ', 'â'=>'ⵄ', 'j'=>'ⵊ', 'l'=>'ⵍ' , 'm'=>'ⵎ', 'n'=>'ⵏ', 'q'=>'ⵇ', 'r'=>'ⵔ', 'ṛ'=>'ⵕ' ,=>'s'=>'ⵙ', 'ṣ'=>'ⵚ' , 't'=>'ⵜ', 'ṭ'=>'ⵟ' , 'u'=>'ⵓ', 'x'=>'ⵅ', 'w'=>'ⵡ', 'y'=>'ⵢ', 'z'=>'ⵣ', 'ẓ'=>'ⵥ' 'kᵂ'=>'ⴽⵯ', 'gᵂ'=>'ⴳⵯ'

);

function loadDefaultTables() { $this->mTables = array( 'lowercase' => new ReplacementArray( $this->mUpperToLowerCaseLatin ), 'ike-cans' => new ReplacementArray( $this->mToTifinagh ), 'ike-latn' => new ReplacementArray( $this->mToLatin ), 'zgh' => new ReplacementArray() ); }

/* rules should be defined as -{Tifinagh | Latin-} -or- -{code:text | code:text | ...}- update: delete all rule parsing because it's not used currently, and just produces a couple of bugs */ function parseManualRule( $rule, $flags = array() ) { if ( in_array( 'T', $flags ) ) { return parent::parseManualRule( $rule, $flags ); }

$carray = array(); // otherwise ignore all formatting foreach ( $this->mVariants as $v ) { $carray[$v] = $rule; }

return $carray; }

// Do not convert content on talk pages function parserConvert( $text, &$parser ) { if ( is_object( $parser->getTitle() ) && $parser->getTitle()->isTalkPage() ) $this->mDoContentConvert = false; else $this->mDoContentConvert = true;

return parent::parserConvert( $text, $parser ); }

/* * A function wrapper: * - if there is no selected variant, leave the link * names as they were * - do not try to find variants for usernames */ function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) { // check for user namespace if ( is_object( $nt ) ) { $ns = $nt->getNamespace(); if ( $ns == NS_USER || $ns == NS_USER_TALK ) return; }

$oldlink = $link; parent::findVariantLink( $link, $nt, $ignoreOtherCond ); if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) $link = $oldlink; }

/* * We want our external link captions to be converted in variants, * so we return the original text instead -{$text}-, except for URLs */ function markNoConversion( $text, $noParse = false ) { if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) ) return parent::markNoConversion(