r58353 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58352‎ | r58353 | r58354 >
Date:02:38, 30 October 2009
Author:juliano
Status:deferred (Comments)
Tags:
Comment:
Update localisation for compatibility with Mw 1.16 LocalisationCache.
Modified paths:
  • /trunk/extensions/Wikilog/Wikilog.i18n.alias.php (added) (history)
  • /trunk/extensions/Wikilog/Wikilog.i18n.magic.php (modified) (history)
  • /trunk/extensions/Wikilog/Wikilog.i18n.php (modified) (history)
  • /trunk/extensions/Wikilog/Wikilog.php (modified) (history)
  • /trunk/extensions/Wikilog/WikilogHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikilog/Wikilog.i18n.magic.php
@@ -4,14 +4,13 @@
55 * @addtogroup Extensions
66 */
77
8 -// FIXME: Use $wgExtensionMessagesFiles[] and $magicWords. See f.e. extension ParserFunctions.
9 -$words = array();
 8+$magicWords = array();
109
1110 /**
1211 * English.
1312 * @author Juliano F. Ravasi
1413 */
15 -$words['en'] = array(
 14+$magicWords['en'] = array(
1615 'wl-settings' => array( 0, 'wl-settings' ),
1716 'wl-publish' => array( 0, 'wl-publish' ),
1817 'wl-author' => array( 0, 'wl-author' ),
@@ -28,7 +27,7 @@
2928 * Portuguese.
3029 * @author Juliano F. Ravasi
3130 */
32 -$words['pt'] = array(
 31+$magicWords['pt'] = array(
3332 'wl-settings' => array( 0, 'wl-configs', 'wl-settings' ),
3433 'wl-publish' => array( 0, 'wl-publicar', 'wl-publish' ),
3534 'wl-author' => array( 0, 'wl-autor', 'wl-author' ),
@@ -45,7 +44,7 @@
4645 * Brazilian Portuguese.
4746 * @author Juliano F. Ravasi
4847 */
49 -$words['pt-br'] = array(
 48+$magicWords['pt-br'] = array(
5049 'wl-settings' => array( 0, 'wl-configs', 'wl-settings' ),
5150 'wl-publish' => array( 0, 'wl-publicar', 'wl-publish' ),
5251 'wl-author' => array( 0, 'wl-autor', 'wl-author' ),
Index: trunk/extensions/Wikilog/Wikilog.php
@@ -50,6 +50,8 @@
5151 */
5252 $dir = dirname( __FILE__ ) . '/';
5353 $wgExtensionMessagesFiles['Wikilog'] = $dir . 'Wikilog.i18n.php';
 54+$wgExtensionMessagesFiles['WikilogMagic'] = $dir . 'Wikilog.i18n.magic.php';
 55+$wgExtensionMessagesFiles['WikilogAlias'] = $dir . 'Wikilog.i18n.alias.php';
5456
5557 /*
5658 * Autoloaded classes.
@@ -111,9 +113,6 @@
112114 $wgHooks['ArticleEditUpdates'][] = 'WikilogHooks::ArticleEditUpdates';
113115 $wgHooks['ArticleDeleteComplete'][] = 'WikilogHooks::ArticleDeleteComplete';
114116 $wgHooks['TitleMoveComplete'][] = 'WikilogHooks::TitleMoveComplete';
115 -$wgHooks['LanguageGetSpecialPageAliases'][]
116 - = 'WikilogHooks::LanguageGetSpecialPageAliases';
117 -$wgHooks['LanguageGetMagic'][] = 'WikilogHooks::LanguageGetMagic';
118117 $wgHooks['LoadExtensionSchemaUpdates'][] = 'WikilogHooks::ExtensionSchemaUpdates';
119118 $wgHooks['UnknownAction'][] = 'WikilogHooks::UnknownAction';
120119
@@ -128,6 +127,12 @@
129128 $wgHooks['GetLocalURL'][] = 'WikilogParser::GetLocalURL';
130129 $wgHooks['GetFullURL'][] = 'WikilogParser::GetFullURL';
131130
 131+if ( !defined( 'MW_SUPPORTS_LOCALISATIONCACHE' ) ) {
 132+ /* pre Mw1.16 compatibility */
 133+ $wgHooks['LanguageGetMagic'][] = 'WikilogHooks::LanguageGetMagic';
 134+ $wgHooks['LanguageGetSpecialPageAliases'][] = 'WikilogHooks::LanguageGetSpecialPageAliases';
 135+}
 136+
132137 /*
133138 * Added rights.
134139 */
Index: trunk/extensions/Wikilog/WikilogHooks.php
@@ -232,6 +232,8 @@
233233 /**
234234 * LanguageGetSpecialPageAliases hook handler function.
235235 * Adds language aliases for special pages.
 236+ * @note Deprecated in MediaWiki 1.16.
 237+ * @todo Remove this in Wikilog 1.1.0, along with support for Mw < 1.16.
236238 */
237239 static function LanguageGetSpecialPageAliases( &$specialPageAliases, $lang ) {
238240 wfLoadExtensionMessages( 'Wikilog' );
@@ -243,13 +245,15 @@
244246 /**
245247 * LanguageGetMagic hook handler function.
246248 * Adds language aliases for magic words.
 249+ * @note Deprecated in MediaWiki 1.16.
 250+ * @todo Remove this in Wikilog 1.1.0, along with support for Mw < 1.16.
247251 */
248 - static function LanguageGetMagic( &$magicWords, $lang ) {
 252+ static function LanguageGetMagic( &$words, $lang ) {
249253 require( 'Wikilog.i18n.magic.php' );
250 - if ( $lang == 'en' || !isset( $words[$lang] ) ) {
251 - $magicWords += $words['en'];
 254+ if ( $lang == 'en' || !isset( $magicWords[$lang] ) ) {
 255+ $words += $magicWords['en'];
252256 } else {
253 - $magicWords += array_merge( $words['en'], $words[$lang] );
 257+ $words += array_merge( $magicWords['en'], $magicWords[$lang] );
254258 }
255259 return true;
256260 }
Index: trunk/extensions/Wikilog/Wikilog.i18n.alias.php
@@ -0,0 +1,23 @@
 2+<?php
 3+/**
 4+ * Special page aliases used by Wikilog extension.
 5+ * @addtogroup Extensions
 6+ */
 7+
 8+$specialPageAliases = array();
 9+
 10+/**
 11+ * English.
 12+ * @author Juliano F. Ravasi
 13+ */
 14+$specialPageAliases['en'] = array(
 15+ 'Wikilog' => array( 'Wikilog', 'Wikilogs' ),
 16+);
 17+
 18+/**
 19+ * Portuguese (Português)
 20+ * @author Juliano F. Ravasi
 21+ */
 22+$specialPageAliases['pt'] = array(
 23+ 'Wikilog' => array( 'Wikilog', 'Wikilogs' ),
 24+);
Property changes on: trunk/extensions/Wikilog/Wikilog.i18n.alias.php
___________________________________________________________________
Name: svn:eol-style
125 + native
Index: trunk/extensions/Wikilog/Wikilog.i18n.php
@@ -19,7 +19,7 @@
2020
2121 # Special:Wikilog
2222 'wikilog' => 'Wikilogs', # Page title
23 - 'wikilog-specialwikilog' => 'Wikilog', # Special page name
 23+ 'wikilog-specialwikilog' => 'Wikilog', # Special page name (DEPRECATED AFTER MW1.16)
2424
2525 # Logs
2626 'wikilog-log-pagename' => 'Wikilog actions log',
@@ -103,8 +103,8 @@
104104 'wikilog-feed-description' => 'Read the most recent posts in this feed.',
105105
106106 # Item and comments page titles
107 - 'wikilog-title-item-full' => '$1 - $2', # 1 = article title, $2 wikilog title
108 - 'wikilog-title-comments' => 'Comments - $1', # 1 = article title
 107+ 'wikilog-title-item-full' => '$1 - $2', # $1 = article title, $2 wikilog title
 108+ 'wikilog-title-comments' => 'Comments - $1', # $1 = article title
109109
110110 # Warning and error messages
111111 'wikilog-error-msg' => 'Wikilog: $1',
@@ -182,7 +182,6 @@
183183 'right-wl-postcomment' => 'Poste Kommentare zu Wikilog-Beiträgen',
184184 'right-wl-moderation' => 'Moderation von Kommentaren zu wikilog-Beiträgen',
185185 'wikilog' => 'Wikilogs', # Page title
186 - 'wikilog-specialwikilog' => 'Wikilog', # Special page name
187186 'wikilog-tab' => 'Wikilog',
188187 'wikilog-tab-title' => 'Wikilog Aktionen',
189188 'wikilog-information' => 'Wikilog Information',
@@ -235,7 +234,7 @@
236235 'wikilog-newtalk-summary' => 'automatisch erzeugt durch Wikilog',
237236 'wikilog-feed-title' => '{{SITENAME}} - $1 [$2]', # $1 = title, $2 = content language
238237 'wikilog-feed-description' => 'Lese die neuesten Beiträge in diesem Feed.',
239 - 'wikilog-title-item-full' => '$1 - $2', # 1 = article title, $2 wikilog title
 238+ 'wikilog-title-item-full' => '$1 - $2', # $1 = article title, $2 wikilog title
240239 'wikilog-error-msg' => 'Wikilog: $1',
241240 'wikilog-error-title' => 'Wikilog Fehler',
242241 'wikilog-invalid-param' => 'Ungültiger Parameter: $1.',
@@ -294,7 +293,6 @@
295294 'right-wl-postcomment' => 'Postar comentários em artigos wikilog',
296295 'right-wl-moderation' => 'Moderação de comentários de artigos wikilog',
297296 'wikilog' => 'Wikilogs',
298 - 'wikilog-specialwikilog' => 'Wikilog',
299297 'wikilog-log-pagename' => 'Registro de ações wikilog',
300298 'wikilog-log-pagetext' => 'Abaixo está uma lista das ações wikilog.',
301299 'wikilog-log-cmt-approve' => 'aprovou o comentário [[$1]]',
@@ -357,8 +355,8 @@
358356 'wikilog-newtalk-summary' => 'criado automaticamente pelo wikilog',
359357 'wikilog-feed-title' => '{{SITENAME}} - $1 [$2]', # $1 = title, $2 = content language
360358 'wikilog-feed-description' => 'Leia as postagens mais recentes neste feed.',
361 - 'wikilog-title-item-full' => '$1 - $2', # 1 = article title, $2 wikilog title
362 - 'wikilog-title-comments' => 'Comentários - $1', # 1 = article title
 359+ 'wikilog-title-item-full' => '$1 - $2', # $1 = article title, $2 wikilog title
 360+ 'wikilog-title-comments' => 'Comentários - $1', # $1 = article title
363361 'wikilog-error-msg' => 'Wikilog: $1',
364362 'wikilog-invalid-param' => 'Parâmetro inválido: $1.',
365363 'wikilog-invalid-author' => 'Autor inválido: $1.',

Follow-up revisions

RevisionCommit summaryAuthorDate
r58354Follow-up r58353: Use $wgExtensionAliasesFiles for special page aliasessiebrand07:27, 30 October 2009

Comments

#Comment by Juliano (talk | contribs)   02:43, 30 October 2009

This probably demands some update to /trunk/extensions/Translate/groups/mediawiki-defines.txt, but I'm not familiar with that file.

#Comment by Siebrand (talk | contribs)   14:19, 30 October 2009

No need to take care of that. We try to let 'you guys' develop, and 'us guys' will take care of the L10n related issues. You'll hear from us if you're writing code with bad i18n... ;)

Status & tagging log