Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -2680,6 +2680,11 @@ |
2681 | 2681 | 'variantname-ike-latn', |
2682 | 2682 | 'variantname-iu', |
2683 | 2683 | ), |
| 2684 | + 'variantname-shi' => array( |
| 2685 | + 'variantname-shi-tfng', |
| 2686 | + 'variantname-shi-latn', |
| 2687 | + 'variantname-shi', |
| 2688 | + ), |
2684 | 2689 | 'metadata' => array( |
2685 | 2690 | 'metadata', |
2686 | 2691 | 'metadata-help', |
— | — | @@ -3658,6 +3663,7 @@ |
3659 | 3664 | 'variantname-ku' => 'Variants for Kurdish language', |
3660 | 3665 | 'variantname-tg' => 'Variants for Tajiki language', |
3661 | 3666 | 'variantname-iu' => 'Variants for Inuktitut language', |
| 3667 | + 'variantname-shi' => 'Variants for Tachelhit language', |
3662 | 3668 | 'media-info' => 'Media information', |
3663 | 3669 | 'metadata' => 'Metadata', |
3664 | 3670 | 'exif' => 'EXIF tags', |
Index: trunk/phase3/maintenance/language/messageTypes.inc |
— | — | @@ -231,6 +231,9 @@ |
232 | 232 | 'variantname-ike-cans', |
233 | 233 | 'variantname-ike-latn', |
234 | 234 | 'variantname-iu', |
| 235 | + 'variantname-shi-tfng', |
| 236 | + 'variantname-shi-latn', |
| 237 | + 'variantname-shi', |
235 | 238 | 'rc-change-size', |
236 | 239 | 'resetpass_text', |
237 | 240 | 'image_sample', |
Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -56,6 +56,7 @@ |
57 | 57 | * (bug 26470) Add checkered background image on hover on files pages. |
58 | 58 | * (bug 30774) mediawiki.html: Add support for numbers and booleans in the |
59 | 59 | attribute values and element contents. |
| 60 | +* Conversion script between Tifinagh and Latin for the Tachelhit language |
60 | 61 | |
61 | 62 | === Bug fixes in 1.19 === |
62 | 63 | * $wgUploadNavigationUrl should be used for file redlinks if |
Index: trunk/phase3/includes/Preferences.php |
— | — | @@ -276,7 +276,7 @@ |
277 | 277 | if ( !$wgDisableLangConversion ) { |
278 | 278 | $variants = $wgContLang->getVariants(); |
279 | 279 | |
280 | | - $languages = Language::getLanguageNames( true ); |
| 280 | + $languages = Language::getLanguageNames(); |
281 | 281 | foreach ( $variants as $v ) { |
282 | 282 | $v = str_replace( '_', '-', strtolower( $v ) ); |
283 | 283 | if ( array_key_exists( $v, $languages ) ) { |
Index: trunk/phase3/languages/messages/MessagesShi.php |
— | — | @@ -1173,6 +1173,11 @@ |
1174 | 1174 | |
1175 | 1175 | ghir lhwayj n lista (stour libdounin s *) karaytyo7asab', |
1176 | 1176 | |
| 1177 | +# Variants for Tachelhit language |
| 1178 | +'variantname-shi-tfng' => 'ᑎᑎᕋᐅᓯᖅ ᓄᑖᖅ', |
| 1179 | +'variantname-shi-latn' => 'Tašlḥiyt', |
| 1180 | +'variantname-shi' => 'disable', |
| 1181 | + |
1177 | 1182 | # Metadata |
1178 | 1183 | 'metadata' => 'isfka n mita', |
1179 | 1184 | 'metadata-help' => 'Asdaw ad llan gis inɣmisn yaḍnin lli tfl lkamira tuṭunit niɣd aṣfḍ n uxddam lliɣ ay sgadda asdaw ad', |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3735,6 +3735,12 @@ |
3736 | 3736 | 'variantname-ike-latn' => 'ike-Latn', # only translate this message to other languages if you have to change it |
3737 | 3737 | 'variantname-iu' => 'iu', # only translate this message to other languages if you have to change it |
3738 | 3738 | |
| 3739 | +# Variants for Tachelhit language |
| 3740 | +'variantname-shi-tfng' => 'shi-Tfng', # only translate this message to other languages if you have to change it |
| 3741 | +'variantname-shi-latn' => 'shi-Latn', # only translate this message to other languages if you have to change it |
| 3742 | +'variantname-shi' => 'shi', # only translate this message to other languages if you have to change it |
| 3743 | + |
| 3744 | + |
3739 | 3745 | # Metadata |
3740 | 3746 | 'metadata' => 'Metadata', |
3741 | 3747 | 'metadata-help' => 'This file contains additional information, probably added from the digital camera or scanner used to create or digitize it. |
Index: trunk/phase3/languages/Names.php |
— | — | @@ -301,7 +301,9 @@ |
302 | 302 | 'sg' => 'Sängö', # Sango/Sangho |
303 | 303 | 'sgs' => 'Žemaitėška', # Samogitian |
304 | 304 | 'sh' => 'Srpskohrvatski / Српскохрватски', # Serbocroatian |
305 | | - 'shi' => 'Tašlḥiyt', # Tachelhit |
| 305 | + 'shi' => 'Tašlḥiyt/ⵜⴰⵛⵍⵃⵉⵜ', # Tachelhit (multiple scripts - defaults to Latin) |
| 306 | + 'shi-tfng' => 'ⵜⴰⵛⵍⵃⵉⵜ', # Tachelhit (Tifinagh script) |
| 307 | + 'shi-latn' => 'Tašlḥiyt', # Tachelhit (Latin script) |
306 | 308 | 'si' => 'සිංහල', # Sinhalese |
307 | 309 | 'simple' => 'Simple English', # Simple English |
308 | 310 | 'sk' => 'Slovenčina', # Slovak |
Index: trunk/phase3/languages/classes/LanguageShi.php |
— | — | @@ -0,0 +1,202 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @addtogroup Language |
| 5 | + */ |
| 6 | + |
| 7 | +/* |
| 8 | +* Conversion script between Latin and Tifinagh for Tachelhit. |
| 9 | +* - Tifinagh -> lowercase Latin |
| 10 | +* - lowercase/uppercase Latin -> Tifinagh |
| 11 | +* |
| 12 | +* |
| 13 | +* Based on: |
| 14 | +* - http://en.wikipedia.org/wiki/Shilha_language |
| 15 | +* - LanguageSr.php |
| 16 | +* |
| 17 | +* @ingroup Language |
| 18 | +*/ |
| 19 | +require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); |
| 20 | + |
| 21 | +/** |
| 22 | + * |
| 23 | + */ |
| 24 | +class ShiConverter extends LanguageConverter { |
| 25 | + var $mToLatin = array( |
| 26 | + 'ⴰ' => 'a', 'ⴱ' => 'b', 'ⴳ' => 'g', 'ⴷ' => 'd', 'ⴹ' => 'ḍ', 'ⴻ' => 'e', |
| 27 | + 'ⴼ' => 'f', 'ⴽ' => 'k', 'ⵀ' => 'h', 'ⵃ' => 'ḥ', 'ⵄ' => 'ε', 'ⵅ' => 'x', |
| 28 | + 'ⵇ' => 'q', 'ⵉ' => 'i', 'ⵊ' => 'j', 'ⵍ' => 'l', 'ⵎ' => 'm', 'ⵏ' => 'n', |
| 29 | + 'ⵓ' => 'u', 'ⵔ' => 'r', 'ⵕ' => 'ṛ', 'ⵖ' => 'γ', 'ⵙ' => 's', 'ⵚ' => 'ṣ', |
| 30 | + 'ⵛ' => 'š', 'ⵜ' => 't', 'ⵟ' => 'ṭ', 'ⵡ' => 'w', 'ⵢ' => 'y', 'ⵣ' => 'z', |
| 31 | + 'ⵥ' => 'ẓ', 'ⵯ' => 'ʷ', |
| 32 | + ); |
| 33 | + |
| 34 | + var $mUpperToLowerCaseLatin = array( |
| 35 | + 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', |
| 36 | + 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', |
| 37 | + 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', |
| 38 | + 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', |
| 39 | + 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', |
| 40 | + 'Z' => 'z', |
| 41 | + ); |
| 42 | + |
| 43 | + var $mToTifinagh = array( |
| 44 | + 'a' => 'ⴰ', 'b' => 'ⴱ', 'g' => 'ⴳ', 'd' => 'ⴷ', 'ḍ' => 'ⴹ', 'e' => 'ⴻ', |
| 45 | + 'f' => 'ⴼ', 'k' => 'ⴽ', 'h' => 'ⵀ', 'ḥ' => 'ⵃ', 'ε' => 'ⵄ', 'x' => 'ⵅ', |
| 46 | + 'q' => 'ⵇ', 'i' => 'ⵉ', 'j' => 'ⵊ', 'l' => 'ⵍ', 'm' => 'ⵎ', 'n' => 'ⵏ', |
| 47 | + 'u' => 'ⵓ', 'r' => 'ⵔ', 'ṛ' => 'ⵕ', 'γ' => 'ⵖ', 's' => 'ⵙ', 'ṣ' => 'ⵚ', |
| 48 | + 'š' => 'ⵛ', 't' => 'ⵜ', 'ṭ' => 'ⵟ', 'w' => 'ⵡ', 'y' => 'ⵢ', 'z' => 'ⵣ', |
| 49 | + 'ẓ' => 'ⵥ', 'ʷ' => 'ⵯ', |
| 50 | + ); |
| 51 | + |
| 52 | + function loadDefaultTables() { |
| 53 | + $this->mTables = array( |
| 54 | + 'lowercase' => new ReplacementArray( $this->mUpperToLowerCaseLatin ), |
| 55 | + 'shi-tfng' => new ReplacementArray( $this->mToTifinagh ), |
| 56 | + 'shi-latn' => new ReplacementArray( $this->mToLatin ), |
| 57 | + 'shi' => new ReplacementArray() |
| 58 | + ); |
| 59 | + } |
| 60 | + |
| 61 | + /** |
| 62 | + * rules should be defined as -{Tifinagh | Latin-} -or- |
| 63 | + * -{code:text | code:text | ...}- |
| 64 | + * update: delete all rule parsing because it's not used |
| 65 | + * currently, and just produces a couple of bugs |
| 66 | + * |
| 67 | + * @param $rule string |
| 68 | + * @param $flags array |
| 69 | + * @return array |
| 70 | + */ |
| 71 | + function parseManualRule( $rule, $flags = array() ) { |
| 72 | + if ( in_array( 'T', $flags ) ) { |
| 73 | + return parent::parseManualRule( $rule, $flags ); |
| 74 | + } |
| 75 | + |
| 76 | + $carray = array(); |
| 77 | + // otherwise ignore all formatting |
| 78 | + foreach ( $this->mVariants as $v ) { |
| 79 | + $carray[$v] = $rule; |
| 80 | + } |
| 81 | + |
| 82 | + return $carray; |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * Do not convert content on talk pages |
| 87 | + * |
| 88 | + * @param $text string |
| 89 | + * @param $parser Parser |
| 90 | + * @return string |
| 91 | + */ |
| 92 | + function parserConvert( $text, &$parser ) { |
| 93 | + if ( is_object( $parser->getTitle() ) && $parser->getTitle()->isTalkPage() ) |
| 94 | + $this->mDoContentConvert = false; |
| 95 | + else |
| 96 | + $this->mDoContentConvert = true; |
| 97 | + |
| 98 | + return parent::parserConvert( $text, $parser ); |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * A function wrapper: |
| 103 | + * - if there is no selected variant, leave the link |
| 104 | + * names as they were |
| 105 | + * - do not try to find variants for usernames |
| 106 | + * |
| 107 | + * @param $link string |
| 108 | + * @param $nt Title |
| 109 | + * @param $ignoreOtherCond bool |
| 110 | + */ |
| 111 | + function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) { |
| 112 | + // check for user namespace |
| 113 | + if ( is_object( $nt ) ) { |
| 114 | + $ns = $nt->getNamespace(); |
| 115 | + if ( $ns == NS_USER || $ns == NS_USER_TALK ) |
| 116 | + return; |
| 117 | + } |
| 118 | + |
| 119 | + $oldlink = $link; |
| 120 | + parent::findVariantLink( $link, $nt, $ignoreOtherCond ); |
| 121 | + if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) |
| 122 | + $link = $oldlink; |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * We want our external link captions to be converted in variants, |
| 127 | + * so we return the original text instead -{$text}-, except for URLs |
| 128 | + * |
| 129 | + * @param $text string |
| 130 | + * @param $noParse bool |
| 131 | + * |
| 132 | + * @return string |
| 133 | + */ |
| 134 | + function markNoConversion( $text, $noParse = false ) { |
| 135 | + if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) ) |
| 136 | + return parent::markNoConversion( $text ); |
| 137 | + return $text; |
| 138 | + } |
| 139 | + |
| 140 | + /** |
| 141 | + * An ugly function wrapper for parsing Image titles |
| 142 | + * (to prevent image name conversion) |
| 143 | + * |
| 144 | + * @param $text string |
| 145 | + * @param $toVariant bool |
| 146 | + * |
| 147 | + * @return string |
| 148 | + */ |
| 149 | + function autoConvert( $text, $toVariant = false ) { |
| 150 | + global $wgTitle; |
| 151 | + if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) { |
| 152 | + $imagename = $wgTitle->getNsText(); |
| 153 | + if ( preg_match( "/^$imagename:/", $text ) ) return $text; |
| 154 | + } |
| 155 | + return parent::autoConvert( $text, $toVariant ); |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * It translates text into variant |
| 160 | + * |
| 161 | + * @param $text string |
| 162 | + * @param $toVariant string |
| 163 | + * |
| 164 | + * @return string |
| 165 | + */ |
| 166 | + function translate( $text, $toVariant ) { |
| 167 | + // If $text is empty or only includes spaces, do nothing |
| 168 | + // Otherwise translate it |
| 169 | + if ( trim( $text ) ) { |
| 170 | + $this->loadTables(); |
| 171 | + // To Tifinagh, first translate uppercase to lowercase Latin |
| 172 | + if( $toVariant == 'shi-tfng' ) { |
| 173 | + $text = $this->mTables['lowercase']->replace( $text ); |
| 174 | + } |
| 175 | + $text = $this->mTables[$toVariant]->replace( $text ); |
| 176 | + } |
| 177 | + return $text; |
| 178 | + } |
| 179 | +} |
| 180 | + |
| 181 | +/** |
| 182 | + * Tachelhit |
| 183 | + * |
| 184 | + * @ingroup Language |
| 185 | + */ |
| 186 | +class LanguageShi extends Language { |
| 187 | + function __construct() { |
| 188 | + global $wgHooks; |
| 189 | + |
| 190 | + parent::__construct(); |
| 191 | + |
| 192 | + $variants = array( 'shi', 'shi-tfng', 'shi-latn' ); |
| 193 | + $variantfallbacks = array( |
| 194 | + 'shi' => 'shi-tfng', |
| 195 | + 'shi-tfng' => 'shi', |
| 196 | + 'shi-latn' => 'shi', |
| 197 | + ); |
| 198 | + |
| 199 | + $flags = array(); |
| 200 | + $this->mConverter = new ShiConverter( $this, 'shi', $variants, $variantfallbacks, $flags ); |
| 201 | + $wgHooks['ArticleSaveComplete'][] = $this->mConverter; |
| 202 | + } |
| 203 | +} |
Property changes on: trunk/phase3/languages/classes/LanguageShi.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 204 | + native |
Index: trunk/phase3/languages/classes/LanguageShi.deps.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | +// This file exists to ensure that base classes are preloaded before |
| 4 | +// LanguageIu.php is compiled, working around a bug in the APC opcode |
| 5 | +// cache on PHP 5, where cached code can break if the include order |
| 6 | +// changed on a subsequent page view. |
| 7 | +// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html |
| 8 | + |
| 9 | +require_once( dirname(__FILE__).'/../LanguageConverter.php' ); |
Property changes on: trunk/phase3/languages/classes/LanguageShi.deps.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |