r21321 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21320‎ | r21321 | r21322 >
Date:11:59, 17 April 2007
Author:raymond
Status:old
Tags:
Comment:
* (bug 8925) Preserve canonical (english) desc types
Modified paths:
  • /trunk/extensions/ImageMap/ImageMap.i18n.php (modified) (history)
  • /trunk/extensions/ImageMap/ImageMap_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ImageMap/ImageMap_body.php
@@ -40,6 +40,9 @@
4141 $lineNum = 0;
4242 $output = '';
4343 $links = array();
 44+
 45+ # Define canonical desc types to allow i18n of 'imagemap_desc_types'
 46+ $descTypesCanonical = 'top-right, bottom-right, bottom-left, top-left, none';
4447 $descType = self::BOTTOM_RIGHT;
4548 $defaultLinkAttribs = false;
4649 $realmap = true;
@@ -96,10 +99,18 @@
97100 $cmd = strtok( $line, " \t" );
98101 if ( $cmd == 'desc' ) {
99102 $typesText = wfMsgForContent( 'imagemap_desc_types' );
 103+ if ( $descTypesCanonical != $typesText ) {
 104+ // i18n desc types exists
 105+ $typesText = $descTypesCanonical . ', ' . $typesText;
 106+ }
100107 $types = array_map( 'trim', explode( ',', $typesText ) );
101108 $type = trim( strtok( '' ) );
102109 $descType = array_search( $type, $types );
103 - if ( $descType === false ) {
 110+ if ( $descType > 4 ) {
 111+ // A localized descType is used. Subtract 5 to reach the canonical desc type.
 112+ $descType = $descType - 5;
 113+ }
 114+ if ( $descType === false || $descType < 0 ) { // <0? In theory never, but paranoia...
104115 return self::error( 'imagemap_invalid_desc', $typesText );
105116 }
106117 continue;
Index: trunk/extensions/ImageMap/ImageMap.i18n.php
@@ -18,7 +18,7 @@
1919 'default, rect, circle or poly',
2020 'imagemap_no_areas' => '&lt;imagemap&gt;: at least one area specification must be given',
2121 'imagemap_invalid_coord' => '&lt;imagemap&gt;: invalid coordinate at line $1, must be a number',
22 -'imagemap_invalid_desc' => '&lt;imagemap&gt;: invalid desc specification, must be one of: $1',
 22+'imagemap_invalid_desc' => '&lt;imagemap&gt;: invalid desc specification, must be one of: <tt>$1</tt>',
2323 'imagemap_description' => 'About this image',
2424 # Note to translators: keep the same order
2525 'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
@@ -35,10 +35,10 @@
3636 '<tt>default, rect, circle</tt> oder <tt>poly</tt>',
3737 'imagemap_no_areas' => '&lt;imagemap&gt;-Fehler: Es muss mindestens ein Gebiet definiert werden',
3838 'imagemap_invalid_coord' => '&lt;imagemap&gt;-Fehler: Ungültige Koordinate in Zeile $1: es sind nur Zahlen erlaubt',
39 -'imagemap_invalid_desc' => '&lt;imagemap&gt;-Fehler: Ungültiger „desc“-Parameter, möglich sind: $1',
 39+'imagemap_invalid_desc' => '&lt;imagemap&gt;-Fehler: Ungültiger „desc“-Parameter, möglich sind: <tt>$1</tt>',
4040 'imagemap_description' => 'Über dieses Bild',
4141 # Note to translators: keep the same order
42 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
 42+'imagemap_desc_types' => 'oben rechts, unten rechts, unten links, oben links, keine',
4343 ),
4444
4545 /* French */
@@ -54,8 +54,6 @@
5555 'imagemap_invalid_coord' => '&lt;imagemap&gt; : coordonnée invalide à la ligne $1, doit être un nombre',
5656 'imagemap_invalid_desc' => '&lt;imagemap&gt; : paramètre « desc » invalide, les paramètres possibles sont : $1',
5757 'imagemap_description' => 'À propos de cette image',
58 -# Note to translators: keep the same order
59 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
6058 ),
6159
6260
@@ -72,8 +70,6 @@
7371 'imagemap_invalid_coord' => '&lt;imagemap&gt;: קוארדינאטה שגויה בשורה $1, היא חייבת להיות מספר',
7472 'imagemap_invalid_desc' => '&lt;imagemap&gt;: הגדרת פרמטר desc שגויה, צריך להיות אחד מהבאים: $1',
7573 'imagemap_description' => 'אודות התמונה',
76 -# Note to translators: keep the same order
77 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
7874 ),
7975
8076 /* Indonesian (Ivan Lanin) */
@@ -89,8 +85,6 @@
9086 'imagemap_invalid_coord' => '&lt;imagemap&gt;: koordinat tidak sah pada baris ke $1, haruslah berupa angka',
9187 'imagemap_invalid_desc' => '&lt;imagemap&gt;: spesifikasi desc tidak sah, harus salah satu dari: $1',
9288 'imagemap_description' => 'Tentang gambar ini',
93 -# Note to translators: keep the same order
94 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
9589 ),
9690
9791 /* Italian (AnyFile, fixed typos by BrokenArrow) */
@@ -105,10 +99,6 @@
106100 'imagemap_invalid_coord' => '&lt;imagemap&gt;: coordinata non valida nella riga $1, deve essere un numero',
107101 'imagemap_invalid_desc' => '&lt;imagemap&gt;: Valore non valido per il parametro desc, deve essere uno dei seguenti: $1',
108102 'imagemap_description' => 'Informazioni sull\'immagine',
109 -# Note to translators: keep the same order
110 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
111 -#Since, as far I know, the alignment indicator are kept in English in the
112 -# image inclusion syntax, I kept them in English here too.
113103 ),
114104
115105 /* Kazakh default (AlefZet) */
@@ -124,8 +114,6 @@
125115 'imagemap_invalid_coord' => '&lt;imagemap&gt;: $1 жолында жарамсыз координата, сан болуы қажет',
126116 'imagemap_invalid_desc' => '&lt;imagemap&gt;: жарамсыз сипаттама маманданымы, мынаның біреуі болуы қажет: $1',
127117 'imagemap_description' => 'Бұл сурет туралы',
128 -# Note to translators: keep the same order
129 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
130118 ),
131119
132120 /* Kazakh Cyrillic (AlefZet) */
@@ -141,8 +129,6 @@
142130 'imagemap_invalid_coord' => '&lt;imagemap&gt;: $1 жолында жарамсыз координата, сан болуы қажет',
143131 'imagemap_invalid_desc' => '&lt;imagemap&gt;: жарамсыз сипаттама маманданымы, мынаның біреуі болуы қажет: $1',
144132 'imagemap_description' => 'Бұл сурет туралы',
145 -# Note to translators: keep the same order
146 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
147133 ),
148134
149135 /* Kazakh Latin (AlefZet) */
@@ -158,8 +144,6 @@
159145 'imagemap_invalid_coord' => '&lt;imagemap&gt;: $1 jolında jaramsız koordïnata, san bolwı qajet',
160146 'imagemap_invalid_desc' => '&lt;imagemap&gt;: jaramsız sïpattama mamandanımı, mınanıñ birewi bolwı qajet: $1',
161147 'imagemap_description' => 'Bul swret twralı',
162 -# Note to translators: keep the same order
163 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
164148 ),
165149
166150 /* Kazakh Arabic (AlefZet) */
@@ -175,8 +159,6 @@
176160 'imagemap_invalid_coord' => '&lt;imagemap&gt;: $1 جولىندا جارامسىز كوورديناتا, سان بولۋى قاجەت',
177161 'imagemap_invalid_desc' => '&lt;imagemap&gt;: جارامسىز سيپاتتاما ماماندانىمى, مىنانىڭ بٴىرەۋٴى بولۋى قاجەت: $1',
178162 'imagemap_description' => 'بۇل سۋرەت تۋرالى',
179 -# Note to translators: keep the same order
180 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
181163 ),
182164
183165 /* nld / Dutch (Siebrand Mazeland) */
@@ -209,8 +191,6 @@
210192 'imagemap_invalid_coord' => '&lt;imagemap&gt;: neplatná súradnica na riadku $1, musí to byť číslo',
211193 'imagemap_invalid_desc' => '&lt;imagemap&gt;: neplatný popis, musí byť jedno z nasledovných: $1',
212194 'imagemap_description' => 'O tomto obrázku',
213 -# Note to translators: keep the same order
214 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
215195 ),
216196
217197 /* Chinese (China) (Shinjiman) */
@@ -226,8 +206,6 @@
227207 'imagemap_invalid_coord' => '&lt;imagemap&gt;: 在第$1行中有不正确的座标,它必须是一个数字',
228208 'imagemap_invalid_desc' => '&lt;imagemap&gt;: 不正确的 desc 参数,必须是以下的其中之一: $1',
229209 'imagemap_description' => '关于这幅图像',
230 -# Note to translators: keep the same order
231 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
232210 ),
233211
234212 /* Chinese (Hong Kong) (Shinjiman) */
@@ -243,8 +221,6 @@
244222 'imagemap_invalid_coord' => '&lt;imagemap&gt;: 在第$1行中有不正確的座標,它必須是一個數字',
245223 'imagemap_invalid_desc' => '&lt;imagemap&gt;: 不正確的 desc 參數,必須是以下的其中之一: $1',
246224 'imagemap_description' => '關於這幅圖像',
247 -# Note to translators: keep the same order
248 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
249225 ),
250226
251227 /* Chinese (Singapore) (Shinjiman) */
@@ -260,8 +236,6 @@
261237 'imagemap_invalid_coord' => '&lt;imagemap&gt;: 在第$1行中有不正确的座标,它必须是一个数字',
262238 'imagemap_invalid_desc' => '&lt;imagemap&gt;: 不正确的 desc 参数,必须是以下的其中之一: $1',
263239 'imagemap_description' => '关于这幅图像',
264 -# Note to translators: keep the same order
265 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
266240 ),
267241
268242 /* Chinese (Taiwan) (Shinjiman) */
@@ -277,8 +251,6 @@
278252 'imagemap_invalid_coord' => '&lt;imagemap&gt;: 在第$1行中有不正確的座標,它必須是一個數字',
279253 'imagemap_invalid_desc' => '&lt;imagemap&gt;: 不正確的 desc 參數,必須是以下的其中之一: $1',
280254 'imagemap_description' => '關於這幅圖像',
281 -# Note to translators: keep the same order
282 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
283255 ),
284256
285257 /* Cantonese (Shinjiman) */
@@ -294,8 +266,6 @@
295267 'imagemap_invalid_coord' => '&lt;imagemap&gt;: 響第$1行度有唔正確嘅座標,佢一定係一個數字',
296268 'imagemap_invalid_desc' => '&lt;imagemap&gt;: 唔正確嘅 desc 參數,一定係要以下嘅其中之一: $1',
297269 'imagemap_description' => '關於呢幅圖像',
298 -# Note to translators: keep the same order
299 -'imagemap_desc_types' => 'top-right, bottom-right, bottom-left, top-left, none',
300270 ),
301271 );
302272 }