Index: trunk/extensions/Transliterator/Transliterator.i18n.php |
— | — | @@ -17,9 +17,9 @@ |
18 | 18 | 'transliterator-error-ambiguous' => "Ambiguous rule '$1' in [[MediaWiki:$2]]", |
19 | 19 | 'transliterator-error-syntax' => "Invalid syntax '$1' in [[MediaWiki:$2]]", |
20 | 20 | // $1 is the limit on number of rules |
21 | | - 'transliterator-error-rulecount' => "More than $1 rules in [[MediaWiki:$2]]", |
22 | | - // $2 is the limit on the length of the left hand side (e.g. 'alpha => beta' has 5) |
23 | | - 'transliterator-error-rulesize' => "Rule '$1' has more than $2 characters on the left in [[MediaWiki:$3]]", |
| 21 | + 'transliterator-error-rulecount' => "More than $1 {{PLURA:$1|rule|rules}} in [[MediaWiki:$2]]", |
| 22 | + // $3 is the limit on the length of the left hand side (e.g. 'alpha => beta' has 5) |
| 23 | + 'transliterator-error-rulesize' => "Rule '$1' has more than $3 {{PLURAL:$3|character|characters}} on the left in [[MediaWiki:$2]]", |
24 | 24 | ); |
25 | 25 | |
26 | 26 | /** |
— | — | @@ -41,21 +41,35 @@ |
42 | 42 | * $2 is the map-page including thr prefix {{msg-mw|transliterator-invoke}}', |
43 | 43 | 'transliterator-error-rulesize' => 'Parameters: |
44 | 44 | * $1 is the line from the map, such as: <code>a => z</code> |
45 | | -* $2 is the limit on the length of the left hand side (e.g. <code>alpha => beta</code> has 5) |
46 | | -* $3 is the map-page including thr prefix {{msg-mw|transliterator-invoke}}', |
| 45 | +* $2 is the map-page including thr prefix {{msg-mw|transliterator-invoke}} |
| 46 | +* $3 is the limit on the length of the left hand side (e.g. <code>alpha => beta</code> has 5)', |
47 | 47 | ); |
48 | 48 | |
49 | 49 | /** |
| 50 | + * German (Deutsch) |
| 51 | + * @author: Purodha |
| 52 | + */ |
| 53 | +$messages['de'] = array( |
| 54 | + 'transliterator-desc' => 'Stellt eine konfigurierbare Parserfunktion zur Transliteration bereit.', |
| 55 | + 'transliterator-invoke' => 'transliterate', |
| 56 | + 'transliterator-prefix' => 'Transliterator:', |
| 57 | + 'transliterator-error-ambiguous' => 'Mehrdeutige Regel <code>$1</code> in [[MediaWiki:$2]]', |
| 58 | + 'transliterator-error-syntax' => 'Fehlerhafte Syntax in Regel <code>$1</code> in [[MediaWiki:$2]]', |
| 59 | + 'transliterator-error-rulecount' => 'Mehr als die {{PLURAL:$1|erlaubte eine Regel|die erlabubten $1 Regeln}} in [[MediaWiki:$2]]', |
| 60 | + 'transliterator-error-rulesize' => 'In der Regel <code>$1</code> {{PLURAL:$3|ist|sind}} mehr als $3 Zeichen auf der ligken Seite in [[MediaWiki:$2]]', |
| 61 | +); |
| 62 | + |
| 63 | +/** |
50 | 64 | * Ripuarian (Ripoaresch) |
51 | 65 | * @author: Purodha |
52 | 66 | */ |
53 | 67 | $messages['ksh'] = array( |
54 | | - 'transliterator-desc' => 'Deiht en ennslellba Paaserfunxjuhn en et Wiki, di Boochshtabe tuusche kann.', |
| 68 | + 'transliterator-desc' => 'Deiht en ennstellbaa Paaserfunxjuhn en et Wiki, di Boochshtabe tuusche kann.', |
55 | 69 | 'transliterator-invoke' => 'transliterate', |
56 | 70 | 'transliterator-prefix' => 'Transliterator:', |
57 | | - 'transliterator-error-ambiguous' => 'Unkloh Rejel <code>$1</code> en [[MediaWiki:$2]]', |
58 | | - 'transliterator-error-syntax' => 'En kappodde syntax <code>$1</code> es en [[MediaWiki:$2]]', |
59 | | - 'transliterator-error-rulecount' => 'Et sin mieh wi $1 Rejelle en [[MediaWiki:$2]]', |
60 | | - 'transliterator-error-rulesize' => 'En de Rejel <code>$1</code> sinn_er mieh wi $2 Zeische op de lengke Sigg, en [[MediaWiki:$3]]', |
| 71 | + 'transliterator-error-ambiguous' => 'En unkloh Rejel <code>$1</code> es en [[MediaWiki:$2]]', |
| 72 | + 'transliterator-error-syntax' => 'En kappodde Syntax <code>$1</code> es en [[MediaWiki:$2]]', |
| 73 | + 'transliterator-error-rulecount' => 'Et {{PLURAL:$1|es mieh wi ein Rejel|sinn_er mieh wi $1 Rejelle|es kei Rejel}} en [[MediaWiki:$2]]', |
| 74 | + 'transliterator-error-rulesize' => 'En de Rejel <code>$1</code> {{PLURAL:$3|es|sinn_er}} mieh wi $3 Zeische op de lengke Sigg, en [[MediaWiki:$2]]', |
61 | 75 | ); |
62 | 76 | |
Index: trunk/extensions/Transliterator/Transliterator.php |
— | — | @@ -1,5 +1,25 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | /** |
| 5 | + * @package MediaWiki |
| 6 | + * @subpackage Extensions |
| 7 | + * |
| 8 | + * @link http://www.mediawiki.org/wiki/Extension:Transliterator Documentation |
| 9 | + * @link http://en.wiktionary.org/wiki/User:Conrad.Irwin/Transliterator.php Original |
| 10 | + * |
| 11 | + * @author Conrad Irwin |
| 12 | + * @modifier Purodha Blissenbach |
| 13 | + * @copyright Copyright © 2009 Conrad.Irwin |
| 14 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 |
| 15 | + * or later |
| 16 | + * @version 1.0 |
| 17 | + * initial creation. |
| 18 | + * @version 1.0.1 |
| 19 | + * better i18n support, adjustable limits, minor formal adjustment. |
| 20 | + * |
| 21 | + */ |
| 22 | + |
| 23 | +/** |
4 | 24 | Extension:Transliterator Copyright (C) 2009 Conrad.Irwin |
5 | 25 | |
6 | 26 | This program is free software; you can redistribute it and/or modify |
— | — | @@ -17,12 +37,22 @@ |
18 | 38 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
19 | 39 | */ |
20 | 40 | |
| 41 | +if ( !defined( 'MEDIAWIKI' ) ) |
| 42 | +{ |
| 43 | + die( 'This file is a MediaWiki extension, not a valid entry point.' ); |
| 44 | +} |
| 45 | + |
| 46 | +// adjustable parameters |
| 47 | +$wgTransliteratorRuleCount = 255; // maximum number of permitted rules per map. |
| 48 | +$wgTransliteratorRuleSize = 10; // maximum number of characters in left side of a rule. |
| 49 | + |
21 | 50 | $wgExtensionCredits['parserhook'][] = array( |
22 | | - 'name' => "Transliterator", |
23 | | - 'version' => "1.0", |
24 | | - 'descriptionmsg' => "transliterator-desc", |
| 51 | + 'name' => 'Transliterator', |
| 52 | + 'version' => '1.0.1', |
| 53 | + 'descriptionmsg' => 'transliterator-desc', |
25 | 54 | 'author' => 'Conrad Irwin', |
26 | | - 'url' => 'http://en.wiktionary.org/wiki/User:Conrad.Irwin/Transliterator.php' |
| 55 | + 'url' => 'http://en.wiktionary.org/wiki/User:Conrad.Irwin/Transliterator.php', |
| 56 | + 'path' => __FILE__, |
27 | 57 | ); |
28 | 58 | |
29 | 59 | if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
— | — | @@ -137,6 +167,7 @@ |
138 | 168 | * $map['__decompose__'] indicates that NFD should be used instead of characters |
139 | 169 | */ |
140 | 170 | function readMap( $input, $mappage ) { |
| 171 | + global $wgTransliteratorRuleCount, $wgTransliteratorRuleSize; |
141 | 172 | |
142 | 173 | $map = array(); |
143 | 174 | $decompose = false; |
— | — | @@ -150,8 +181,8 @@ |
151 | 182 | $decompose = true; |
152 | 183 | } |
153 | 184 | |
154 | | - if ( count( $lines ) > 255 ) |
155 | | - return wfMsg("transliterator-error-rulecount", 255, $mappage); |
| 185 | + if ( count( $lines ) > $wgTransliteratorRuleCount ) |
| 186 | + return wfMsgExt('transliterator-error-rulecount', array('parsemag'), $wgTransliteratorRuleCount, $mappage ); |
156 | 187 | |
157 | 188 | foreach ( $lines as $line ) { |
158 | 189 | |
— | — | @@ -176,8 +207,8 @@ |
177 | 208 | // Fill in the blanks, so that we know when to stop looking while transliterating |
178 | 209 | $to_fill = strlen( $from ); |
179 | 210 | |
180 | | - if ( $to_fill > 10 ) |
181 | | - return wfMsg('transliterator-error-rulesize', $line, 10, $mappage); |
| 211 | + if ( $to_fill > $wgTransliteratorRuleSize ) |
| 212 | + return wfMsgExt('transliterator-error-rulesize', array('parsemag'), $line, $mappage, $wgTransliteratorRuleSize ); |
182 | 213 | |
183 | 214 | for ( $i = 1; $i < $to_fill; $i++ ) { |
184 | 215 | $substr = substr( $from, 0, $i ); |