r55229 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55228‎ | r55229 | r55230 >
Date:10:07, 18 August 2009
Author:raymond
Status:ok
Tags:
Comment:
Use the new i18n system for magic words
Add extension to translatewiki
Make 'transliterator-prefix' optional
Modified paths:
  • /trunk/extensions/Translate/groups/mediawiki-defines.txt (modified) (history)
  • /trunk/extensions/Transliterator/Transliterator.i18n.magic.php (added) (history)
  • /trunk/extensions/Transliterator/Transliterator.i18n.php (modified) (history)
  • /trunk/extensions/Transliterator/Transliterator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/groups/mediawiki-defines.txt
@@ -1041,6 +1041,10 @@
10421042 file = Translate/PageTranslation.i18n.php
10431043 descmsg = tpt-desc
10441044
 1045+Transliterator
 1046+magicfile = Transliterator/Transliterator.i18n.magic.php
 1047+optional = transliterator-prefix
 1048+
10451049 Trusted XFF
10461050
10471051 TSPoll
Index: trunk/extensions/Transliterator/Transliterator.i18n.magic.php
@@ -0,0 +1,10 @@
 2+<?php
 3+
 4+$magicWords = array();
 5+
 6+/**
 7+ * English
 8+ */
 9+$magicWords['en'] = array(
 10+ 'transliterate' => array( 0, 'transliterate' ),
 11+);
Property changes on: trunk/extensions/Transliterator/Transliterator.i18n.magic.php
___________________________________________________________________
Name: svn:eol-style
112 + native
Index: trunk/extensions/Transliterator/Transliterator.i18n.php
@@ -2,6 +2,9 @@
33 /**
44 * Internationalization file for Transliterator
55 */
 6+
 7+require_once( dirname(__FILE__) . '/Transliterator.i18n.magic.php' );
 8+
69 $messages = array();
710
811 /**
@@ -11,7 +14,6 @@
1215 */
1316 $messages['en'] = array(
1417 'transliterator-desc' => "Provides a configurable parser function for transliteration",
15 - 'transliterator-invoke' => 'transliterate', // {{#transliterate:blah}}
1618 'transliterator-prefix' => 'Transliterator:', // [[MediaWiki:Transliterator:blah]] NOTE: changing this requires moving all maps
1719 // $1 is the line from the map, 'a => z', $2 is the map-page including prefix.
1820 'transliterator-error-ambiguous' => "Ambiguous rule <code>$1</code> in [[MediaWiki:$2]]",
@@ -28,7 +30,6 @@
2931 */
3032 $messages['qqq'] = array(
3133 'transliterator-desc' => 'This is a short description of the extension. It is shown in [[Special:Version]].',
32 - 'transliterator-invoke' => "This is the name of a parserfunction: {<nowiki />{#transliterate:''blah''}}",
3334 'transliterator-prefix' => "This is a prefix for the transliteration maps, used in the MediaWiki namespace like [<nowiki />[MediaWiki:Transliterator:''blah'']]. Changing this requires moving all maps.",
3435 'transliterator-error-ambiguous' => 'Parameters:
3536 * $1 is the line from the map, such as: <code>a => z</code>
@@ -51,12 +52,10 @@
5253 */
5354 $messages['de'] = array(
5455 'transliterator-desc' => 'Stellt eine konfigurierbare Parserfunktion zur Transliteration bereit.',
55 - 'transliterator-invoke' => 'transliterate',
56 - 'transliterator-prefix' => 'Transliterator:',
5756 'transliterator-error-ambiguous' => 'Mehrdeutige Regel <code>$1</code> in [[MediaWiki:$2]]',
5857 'transliterator-error-syntax' => 'Fehlerhafte Syntax in Regel <code>$1</code> in [[MediaWiki:$2]]',
5958 '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]]',
 59+ 'transliterator-error-rulesize' => 'In der Regel <code>$1</code> {{PLURAL:$3|ist|sind}} mehr als $3 Zeichen auf der linken Seite in [[MediaWiki:$2]]',
6160 );
6261
6362 /**
@@ -65,8 +64,6 @@
6665 */
6766 $messages['ksh'] = array(
6867 'transliterator-desc' => 'Deiht en ennstellbaa Paaserfunxjuhn en et Wiki, di Boochshtabe tuusche kann.',
69 - 'transliterator-invoke' => 'transliterate',
70 - 'transliterator-prefix' => 'Transliterator:',
7168 'transliterator-error-ambiguous' => 'En unkloh Rejel <code>$1</code> es en [[MediaWiki:$2]]',
7269 'transliterator-error-syntax' => 'En kappodde Syntax <code>$1</code> es en [[MediaWiki:$2]]',
7370 'transliterator-error-rulecount' => 'Et {{PLURAL:$1|es mieh wi ein Rejel|sinn_er mieh wi $1 Rejelle|es kei Rejel}} en [[MediaWiki:$2]]',
Index: trunk/extensions/Transliterator/Transliterator.php
@@ -22,6 +22,8 @@
2323 * semi-case-sensitive by default, fix bugs with edge-detection and html-entities
2424 * @version 1.2.1
2525 * added cache support
 26+ * @version 1.2.2
 27+ * use new magic word i18n system
2628 */
2729
2830 /**
@@ -53,7 +55,7 @@
5456
5557 $wgExtensionCredits['parserhook'][] = array(
5658 'name' => 'Transliterator',
57 - 'version' => '1.2.0',
 59+ 'version' => '1.2.2',
5860 'descriptionmsg' => 'transliterator-desc',
5961 'author' => 'Conrad Irwin',
6062 'url' => 'http://www.mediawiki.org/wiki/Extension:Transliterator',
@@ -66,7 +68,6 @@
6769 $wgExtensionFunctions[] = 'ExtTransliterator::setup';
6870 }
6971 $wgExtensionMessagesFiles['Transliterator'] = dirname(__FILE__).'/Transliterator.i18n.php';
70 -$wgHooks['LanguageGetMagic'][] = 'ExtTransliterator::getMagic';
7172 $wgHooks['ArticleDeleteComplete'][] = 'ExtTransliterator::purgeMap';
7273 $wgHooks['NewRevisionFromEditComplete'][] = 'ExtTransliterator::purgeMap';
7374 $wgHooks['ArticlePurge'][] = 'ExtTransliterator::purgeMap';
@@ -498,17 +499,7 @@
499500 }
500501 return true;
501502 }
502 -
503 - /**
504 - * Load the magic words
505 - */
506 - static function getMagic( &$magicWords, $langCode ) {
507 - wfLoadExtensionMessages('Transliterator');
508503
509 - $magicWords['transliterate'] = array( 0, 'transliterate', wfMsg( 'transliterator-invoke' ) );
510 - return true;
511 - }
512 -
513504 /**
514505 * Called on first use to create singleton
515506 */

Status & tagging log