r29953 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29952‎ | r29953 | r29954 >
Date:18:53, 19 January 2008
Author:siebrand
Status:old
Tags:
Comment:
* merge multiple message files into one and move i18n up one directory level
* use wfLoadExtensionMessages
* add bumped version in extension credits
* remove EOL whitespace, update CHANGELOG
* update Translate extension
Modified paths:
  • /trunk/extensions/SelectCategory/CHANGELOG (modified) (history)
  • /trunk/extensions/SelectCategory/SelectCategory.i18n.php (added) (history)
  • /trunk/extensions/SelectCategory/SelectCategory.i18n.php (added) (history)
  • /trunk/extensions/SelectCategory/SelectCategory.php (modified) (history)
  • /trunk/extensions/SelectCategory/SelectCategoryFunctions.php (modified) (history)
  • /trunk/extensions/SelectCategory/i18n (deleted) (history)
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SelectCategory/SelectCategory.i18n.php
@@ -0,0 +1,212 @@
 2+<?php
 3+/**
 4+ * Internationalisation file for extension SelectCategory.
 5+ *
 6+ * @addtogroup Extensions
 7+ * @author Leon Weber <leon.weber@leonweber.de> & Manuel Schneider <manuel.schneider@wikimedia.ch>
 8+ * @copyright © 2006 by Leon Weber & Manuel Schneider
 9+ * @licence GNU General Public Licence 2.0 or later
 10+ */
 11+
 12+$messages = array();
 13+
 14+/** English
 15+ * @author Leon Weber <leon.weber@leonweber.de>
 16+ * @author Manuel Schneider <manuel.schneider@wikimedia.ch>
 17+ */
 18+$messages['en'] = array(
 19+ 'selectcategory-title' => 'Select categories',
 20+ 'selectcategory-subtitle' => 'Shift-mouse to select multiple contiguous entries, Ctrl-mouse to select non-contiguous entries.',
 21+);
 22+
 23+/** Arabic (العربية)
 24+ * @author Meno25
 25+ */
 26+$messages['ar'] = array(
 27+ 'selectcategory-title' => 'اختر التصنيفات',
 28+ 'selectcategory-subtitle' => 'Shift-mouse لاختيار مدخلات متوافقة متعددة، Ctrl-mouse لاختيار مدخلات غير متوافقة.',
 29+);
 30+
 31+/** Bikol Central (Bikol Central)
 32+ * @author Filipinayzd
 33+ */
 34+$messages['bcl'] = array(
 35+ 'selectcategory-title' => 'Magpilì nin mga kategorya',
 36+);
 37+
 38+/** Bulgarian (Български)
 39+ * @author Spiritia
 40+ */
 41+$messages['bg'] = array(
 42+ 'selectcategory-title' => 'Избор на категории',
 43+ 'selectcategory-subtitle' => 'Shift + ляв бутон на мишката за избор на множество последователни записи, Ctrl + ляв бутон на мишката за избор на непоследователни записи.',
 44+);
 45+
 46+/** German (Deutsch)
 47+ * @author Manuel Schneider <manuel.schneider@wikimedia.ch>
 48+ */
 49+$messages['de'] = array(
 50+ 'selectcategory-title' => 'Kategorien auswählen',
 51+ 'selectcategory-subtitle' => 'Shift-Maus um mehrere nachfolgende Einträge zu (de-)selektieren, Strg-Maus um einzelne Einträge zu (de-)selektieren.',
 52+);
 53+
 54+/** Greek (Ελληνικά)
 55+ * @author Consta
 56+ */
 57+$messages['el'] = array(
 58+ 'selectcategory-title' => 'Επέλεξε κατηγορίες',
 59+);
 60+
 61+/** French (Français)
 62+ * @author Marius Engler <marius.engler@coop.ch>
 63+ * @author Sherbrooke
 64+ */
 65+$messages['fr'] = array(
 66+ 'selectcategory-title' => 'Choix de catégories',
 67+ 'selectcategory-subtitle' => 'Maj+click afin de (dé)sélectionner plusieurs catégories d’affilée, Ctrl+click afin de (dé)sélectionner des catégories individuellement.',
 68+);
 69+
 70+/** Galician (Galego)
 71+ * @author Xosé
 72+ */
 73+$messages['gl'] = array(
 74+ 'selectcategory-title' => 'Seleccionar categorías',
 75+ 'selectcategory-subtitle' => 'Faga clic co botón de maiúsculas e o rato para seleccionar varias entradas contiguas. Co botón Ctrl e o rato para seleccionar entradas non contiguas.',
 76+);
 77+
 78+/** Swiss German (Alemannisch)
 79+ * @author Manuel Schneider <manuel.schneider@wikimedia.ch>
 80+ */
 81+$messages['gsw'] = array(
 82+ 'selectcategory-title' => 'Kategori ussueche',
 83+ 'selectcategory-subtitle' => 'Gross-Muus go verschiedeni Iiträg hintrenander go uswähle, Strg-Muus go einzelni Iiträg go uswähle',
 84+);
 85+
 86+/** Upper Sorbian (Hornjoserbsce)
 87+ * @author Michawiki
 88+ */
 89+$messages['hsb'] = array(
 90+ 'selectcategory-title' => 'Kategorije wubrać',
 91+ 'selectcategory-subtitle' => 'Umschalt-Myš, zo bychu so wjacore susodne zapiski wubrali, Strg-myš, zo bychu so njesusodne zapiski wubrali.',
 92+);
 93+
 94+/** Indonesian (Bahasa Indonesia)
 95+ * @author Ivan Lanin <ivanlanin@gmail.com>
 96+ */
 97+$messages['id'] = array(
 98+ 'selectcategory-title' => 'Pilih kategori',
 99+ 'selectcategory-subtitle' => 'Shift-mouse untuk memilih entri yang berurutan, Ctrl-mouse untuk memilih entri yang tidak berurutan.',
 100+);
 101+
 102+/** Italian (Italiano)
 103+ * @author Marius Engler <marius.engler@coop.ch>
 104+ * @author BrokenArrow
 105+ */
 106+$messages['it'] = array(
 107+ 'selectcategory-title' => 'Selezionare le categorie',
 108+ 'selectcategory-subtitle' => 'Fare clic con il mouse tenendo premuto MAIUSC per selezionare più voci adiacenti o CTRL per selezionare più voci non adiacenti.',
 109+);
 110+
 111+/** Luxembourgish (Lëtzebuergesch)
 112+ * @author Robby
 113+ */
 114+$messages['lb'] = array(
 115+ 'selectcategory-title' => 'Kategorie wielen',
 116+ 'selectcategory-subtitle' => 'Shift + Maus fir méi Rubriken hannereneen unzewielen, Ctrl + Maus fir eenzel Rubriken unzewielen',
 117+);
 118+
 119+/** Dutch (Nederlands)
 120+ * @author Siebrand
 121+ */
 122+$messages['nl'] = array(
 123+ 'selectcategory-title' => 'Selecteer categorieën',
 124+ 'selectcategory-subtitle' => 'Shiftklik om meerdere opeenvolgende categorieën te selecteren, Ctrlklik om niet-openvolgende categorieën te selecteren.',
 125+);
 126+
 127+/** Norwegian (‪Norsk (bokmål)‬)
 128+ * @author Jon Harald Søby
 129+ */
 130+$messages['no'] = array(
 131+ 'selectcategory-title' => 'Velg kategorier',
 132+ 'selectcategory-subtitle' => 'Shift+klikk for å velge flere sammenhengende alternativer, Ctrl+klikk for å velge ikke-sammenhengende alternativer.',
 133+);
 134+
 135+/** Occitan (Occitan)
 136+ * @author Cedric31
 137+ */
 138+$messages['oc'] = array(
 139+ 'selectcategory-title' => 'Causida de categorias',
 140+ 'selectcategory-subtitle' => "Maj+click pr'amor de (de)seleccionar mantuna categoria d’arrèu, Ctrl+click pr'amor de (de)seleccionar de categorias individualament.",
 141+);
 142+
 143+/** Polish (Polski)
 144+ * @author Derbeth
 145+ */
 146+$messages['pl'] = array(
 147+ 'selectcategory-title' => 'Wybór kategorii',
 148+ 'selectcategory-subtitle' => 'Shift+przycisk myszy wybiera wiele sąsiednich elementów, Ctrl+przycisk myszy wybiera elementy, które nie są koło siebie',
 149+);
 150+
 151+/** Piemontèis (Piemontèis)
 152+ * @author Bèrto 'd Sèra
 153+ */
 154+$messages['pms'] = array(
 155+ 'selectcategory-title' => 'Selession për categorìe',
 156+ 'selectcategory-subtitle' => "Ch'a dòvra sò rat con la ciav dlë Shift sgnacà për sërne ëd categorìe ch'as ven-o l'un-a dapress a l'àotra, ò pura con ën sgmacand la ciav Ctrl për pieje un-a pr'un-a.",
 157+);
 158+
 159+/** Portuguese (Português)
 160+ * @author Malafaya
 161+ */
 162+$messages['t'] = array(
 163+ 'selectcategory-title' => 'Seleccionar categorias',
 164+ 'selectcategory-subtitle' => 'Shift-clique para seleccionar múltiplas entradas contíguas, Ctrl-clique para seleccionar entradas não-contíguas.',
 165+);
 166+
 167+/** Slovak (Slovenčina)
 168+ * @author Helix84
 169+ */
 170+$messages['sk'] = array(
 171+ 'selectcategory-title' => 'Vybrať kategórie',
 172+ 'selectcategory-subtitle' => 'Shift+kliknutie označí súvislú skupinu položiek, ctrl+kliknutie označí jednotlivé nesúvislé položky.',
 173+);
 174+
 175+/** Seeltersk (Seeltersk)
 176+ * @author Pyt
 177+ */
 178+$messages['stq'] = array(
 179+ 'selectcategory-title' => 'Kategorien uutwääle',
 180+ 'selectcategory-subtitle' => 'Shift-Muus uum moorere ätterfoulgjende Iendraage tou (de-)selektierjen, Strg-Muus uum eenpelde Iendraage tou (de-)selektierjen.',
 181+);
 182+
 183+/** Yue (粵語)
 184+ * @author Shinjiman
 185+ */
 186+$messages['yue'] = array(
 187+ 'selectcategory-title' => '選擇分類',
 188+ 'selectcategory-subtitle' => '撳住Shift掣再用個mouse去揀連續嘅項目,撳住Ctrl掣再用個mouse去揀非連續嘅項目。',
 189+);
 190+
 191+/** Simplified Chinese (‪中文(简体)‬)
 192+ * @author Shinjiman
 193+ */
 194+$messages['zh-hans'] = array(
 195+ 'selectcategory-title' => '选择分类',
 196+ 'selectcategory-subtitle' => '按着Shift键再以鼠标选取连续的项目,按着Ctrl键再以鼠标选取非连续的项目。',
 197+);
 198+
 199+/** Traditional Chinese (‪中文(繁體)‬)
 200+ * @author Shinjiman
 201+ */
 202+$messages['zh-hant'] = array(
 203+ 'selectcategory-title' => '選擇分類',
 204+ 'selectcategory-subtitle' => '按著Shift鍵再以滑鼠選取連續的項目,按著Ctrl鍵再以滑鼠選取非連續的項目。',
 205+);
 206+
 207+$messages['de-formal'] = $messages['de'];
 208+$messages['zh'] = $messages['zh-hans'];
 209+$messages['zh-cn'] = $messages['zh-hans'];
 210+$messages['zh-hk'] = $messages['zh-hant'];
 211+$messages['zh-sg'] = $messages['zh-hans'];
 212+$messages['zh-tw'] = $messages['zh-hant'];
 213+$messages['zh-yue'] = $messages['yue'];
Property changes on: trunk/extensions/SelectCategory/SelectCategory.i18n.php
___________________________________________________________________
Added: svn:eol-style
1214 + native
Added: svn:executable
2215 + *
Index: trunk/extensions/SelectCategory/SelectCategory.php
@@ -59,18 +59,22 @@
6060 if( !isset( $wgSelectCategoryEnableSubpages ) ) $wgSelectCategoryEnableSubpages = true;
6161
6262 ## Register extension setup hook and credits:
63 -$wgExtensionFunctions[] = 'fnSelectCategory';
6463 $wgExtensionCredits['parserhook'][] = array(
6564 'name' => 'SelectCategory',
 65+ 'version' => '0.6',
6666 'author' => 'Leon Weber & Manuel Schneider',
6767 'url' => 'http://www.mediawiki.org/wiki/Extension:SelectCategory',
6868 'description' => 'Allows the user to select from existing categories when editing a page'
6969 );
7070
 71+$dir = dirname(__FILE__) . '/';
 72+$wgExtensionMessagesFiles['SelectCategory'] = $dir . 'SelectCategory.i18n.php';
 73+$wgExtensionFunctions[] = 'fnSelectCategory';
 74+
7175 ## Set Hook:
7276 function fnSelectCategory() {
7377 global $wgHooks;
74 -
 78+
7579 ## Showing the boxes
7680 # Hook when starting editing:
7781 $wgHooks['EditPage::showEditForm:initial'][] = array( 'fnSelectCategoryShowHook', false );
@@ -86,8 +90,6 @@
8791 ## Infrastructure
8892 # Hook our own CSS:
8993 $wgHooks['OutputPageParserOutput'][] = 'fnSelectCategoryOutputHook';
90 - # Hook up local messages:
91 - $wgHooks['LoadAllMessages'][] = 'fnSelectCategoryMessageHook';
9294 }
9395
9496 ## Load the file containing the hook functions:
Index: trunk/extensions/SelectCategory/CHANGELOG
@@ -1,3 +1,6 @@
 2+* v0.6 - 2008-01-19
 3+ - using wfLoadExtensionMessages now, all messages in one file
 4+
25 * v0.5 - 2007-10-12
36 - fixed problem with additional newline at sectionedits
47 - preserve category sortkeys
Index: trunk/extensions/SelectCategory/SelectCategoryFunctions.php
@@ -23,7 +23,7 @@
2424 # Get all categories from wiki:
2525 $m_allCats = fnSelectCategoryGetAllCategories();
2626 # Load system messages:
27 - fnSelectCategoryMessageHook();
 27+ wfLoadExtensionMessages( 'SelectCategory' );
2828 # Get the right member variables, depending on if we're on an upload form or not:
2929 if( !$m_isUpload ) {
3030 # Extract all categorylinks from page:
@@ -36,7 +36,7 @@
3737 } else {
3838 # No need to get categories:
3939 $m_pageCats = array();
40 -
 40+
4141 # Place output at the right place:
4242 $m_place = 'uploadFormTextAfterSummary';
4343 # Print the part of the table including the localised title for the select box:
@@ -69,8 +69,8 @@
7070 $m_pageObj->$m_place .= wfMsg( 'selectcategory-subtitle' ) . "<br/>\n";
7171 $m_pageObj->$m_place .= "<!-- SelectCategory end -->\n";
7272
73 - }
74 -
 73+ }
 74+
7575 # Return true to let the rest work:
7676 return true;
7777 }
@@ -127,27 +127,7 @@
128128 'href' => $wgScriptPath . '/extensions/SelectCategory/SelectCategory.css'
129129 )
130130 );
131 -
132 - # Be nice:
133 - return true;
134 -}
135131
136 -## Entry point for the hook for our localised messages:
137 -function fnSelectCategoryMessageHook() {
138 - global $wgLang;
139 - global $wgMessageCache;
140 -
141 - # Initialize array of all messages:
142 - $messages=array();
143 - # Load default messages (english):
144 - include( 'i18n/SelectCategory.i18n.php' );
145 - # Load localised messages:
146 - if( file_exists( dirname( __FILE__ ) . '/i18n/SelectCategory.i18n.' . $wgLang->getCode() . '.php' ) ) { // avoid warnings
147 - include( 'i18n/SelectCategory.i18n.' . $wgLang->getCode() . '.php' );
148 - }
149 - # Put messages into message cache:
150 - $wgMessageCache->addMessages( $messages );
151 -
152132 # Be nice:
153133 return true;
154134 }
@@ -171,12 +151,12 @@
172152 # Get table names to access them in SQL query:
173153 $m_tblCatLink = $m_dbObj->tableName( 'categorylinks' );
174154 $m_tblPage = $m_dbObj->tableName( 'page' );
175 -
 155+
176156 # Automagically detect root categories:
177157 $m_sql = " SELECT tmpSelectCat1.cl_to AS title
178 - FROM $m_tblCatLink AS tmpSelectCat1
 158+ FROM $m_tblCatLink AS tmpSelectCat1
179159 LEFT JOIN $m_tblPage AS tmpSelectCatPage ON (tmpSelectCat1.cl_to = tmpSelectCatPage.page_title AND tmpSelectCatPage.page_namespace = 14)
180 - LEFT JOIN $m_tblCatLink AS tmpSelectCat2 ON tmpSelectCatPage.page_id = tmpSelectCat2.cl_from
 160+ LEFT JOIN $m_tblCatLink AS tmpSelectCat2 ON tmpSelectCatPage.page_id = tmpSelectCat2.cl_from
181161 WHERE tmpSelectCat2.cl_from IS NULL GROUP BY tmpSelectCat1.cl_to";
182162 # Run the query:
183163 $m_res = $m_dbObj->query( $m_sql, __METHOD__ );
@@ -184,11 +164,11 @@
185165 while ( $m_row = $m_dbObj->fetchRow( $m_res ) ) {
186166 $m_allCats += array( $m_row['title'] => 0 );
187167 $m_allCats += fnSelectCategoryGetChildren( $m_row['title'] );
188 - }
 168+ }
189169 # Free result:
190170 $m_dbObj->freeResult( $m_res );
191171 }
192 -
 172+
193173 # Afterwards return the array to the caller:
194174 return $m_allCats;
195175 }
@@ -196,17 +176,17 @@
197177 function fnSelectCategoryGetChildren( $m_root, $m_prefix = 1 ) {
198178 # Initialize return value:
199179 $m_allCats = array();
200 -
 180+
201181 # Get a database object:
202182 $m_dbObj =& wfGetDB( DB_SLAVE );
203183 # Get table names to access them in SQL query:
204184 $m_tblCatLink = $m_dbObj->tableName( 'categorylinks' );
205185 $m_tblPage = $m_dbObj->tableName( 'page' );
206 -
 186+
207187 # The normal query to get all children of a given root category:
208188 $m_sql = " SELECT tmpSelectCatPage.page_title AS title
209 - FROM $m_tblCatLink AS tmpSelectCat
210 - LEFT JOIN $m_tblPage AS tmpSelectCatPage ON tmpSelectCat.cl_from = tmpSelectCatPage.page_id
 189+ FROM $m_tblCatLink AS tmpSelectCat
 190+ LEFT JOIN $m_tblPage AS tmpSelectCatPage ON tmpSelectCat.cl_from = tmpSelectCatPage.page_id
211191 WHERE tmpSelectCat.cl_to LIKE '$m_root' AND tmpSelectCatPage.page_namespace = 14";
212192 # Run the query:
213193 $m_res = $m_dbObj->query( $m_sql, __METHOD__ );
@@ -215,10 +195,10 @@
216196 # Add current entry to array:
217197 $m_allCats += array( $m_row['title'] => $m_prefix );
218198 $m_allCats += fnSelectCategoryGetChildren( $m_row['title'], $m_prefix + 1 );
219 - }
 199+ }
220200 # Free result:
221201 $m_dbObj->freeResult( $m_res );
222 -
 202+
223203 # Afterwards return the array to the upper recursion level:
224204 return $m_allCats;
225205 }
@@ -238,7 +218,7 @@
239219 }
240220
241221 global $wgContLang;
242 -
 222+
243223 # Get page contents:
244224 $m_pageText = $m_pageObj->textbox1;
245225 # Get localised namespace string:
@@ -262,7 +242,7 @@
263243 }
264244 # Place the cleaned text into the text box:
265245 $m_pageObj->textbox1 = trim( $m_cleanText );
266 -
 246+
267247 # Return the list of categories as an array:
268248 return $m_catLinks;
269249 }
Index: trunk/extensions/Translate/MessageGroups.php
@@ -1642,17 +1642,12 @@
16431643 protected $messageFile = 'ScanSet/ScanSet.i18n.php';
16441644 }
16451645
1646 -class SelectCategoryExtensionGroup extends MultipleFileMessageGroup {
1647 - protected $fileExporter = null;
 1646+class SelectCategoryExtensionGroup extends ExtensionMessageGroup {
16481647 protected $label = 'Select Category';
16491648 protected $id = 'ext-selectcategory';
16501649
16511650 protected $arrName = 'messages';
16521651 protected $messageFile = 'SelectCategory/i18n/SelectCategory.i18n.php';
1653 - protected $filePattern = 'SelectCategory/i18n/SelectCategory.i18n.$CODE.php';
1654 -
1655 - protected $exportStart = '$messages = array(';
1656 - protected $exportEnd = ');';
16571652 }
16581653
16591654 class SemanticDrilldownMessageGroup extends ExtensionMessageGroup {

Status & tagging log