Index: trunk/extensions/ArrayExtension/ArrayExtension.php |
— | — | @@ -53,11 +53,11 @@ |
54 | 54 | 'version' => ArrayExtension::VERSION |
55 | 55 | ); |
56 | 56 | |
57 | | -$wgExtensionMessagesFiles['ArrayExtension'] = dirname( __FILE__ ) . '/ArrayExtension.i18n.php'; |
| 57 | +$dir = dirname( __FILE__ ); |
58 | 58 | |
59 | | -$wgHooks['LanguageGetMagic'][] = 'efArrayExtensionLanguageGetMagic'; |
| 59 | +$wgExtensionMessagesFiles['ArrayExtension'] = $dir . '/ArrayExtension.i18n.php'; |
| 60 | +$wgExtensionMessagesFiles['ArrayExtensionMagic'] = $dir . '/ArrayExtension.i18n.magic.php'; |
60 | 61 | |
61 | | - |
62 | 62 | /** |
63 | 63 | * named arrays - an array has a list of values, and could be set to a SET |
64 | 64 | */ |
— | — | @@ -778,13 +778,3 @@ |
779 | 779 | |
780 | 780 | return true; |
781 | 781 | } |
782 | | - |
783 | | -function efArrayExtensionLanguageGetMagic( &$magicWords, $langCode ) { |
784 | | - require_once( dirname( __FILE__ ) . '/ArrayExtension.i18n.magic.php' ); |
785 | | - |
786 | | - foreach ( efArrayExtensionWords( $langCode ) as $word => $trans ) { |
787 | | - $magicWords[$word] = $trans; |
788 | | - } |
789 | | - |
790 | | - return true; |
791 | | -} |
Index: trunk/extensions/ArrayExtension/ArrayExtension.i18n.magic.php |
— | — | @@ -9,43 +9,25 @@ |
10 | 10 | * @licence MIT License |
11 | 11 | */ |
12 | 12 | |
13 | | -/** |
14 | | - * Get translated magic words, if available |
15 | | - * |
16 | | - * @param string $lang Language code |
17 | | - * |
18 | | - * @return array |
19 | | - */ |
20 | | -function efArrayExtensionWords( $lang ) { |
21 | | - $words = array(); |
| 13 | +$magicWords = array(); |
22 | 14 | |
23 | | - /** |
24 | | - * English |
25 | | - */ |
26 | | - $words['en'] = array( |
27 | | - 'arraydefine' => array( 0, 'arraydefine' ), |
| 15 | +$magicWords['en'] = array( |
| 16 | + 'arraydefine' => array( 0, 'arraydefine' ), |
28 | 17 | |
29 | | - 'arrayprint' => array( 0, 'arrayprint' ), |
30 | | - 'arraysize' => array( 0, 'arraysize' ), |
31 | | - 'arrayindex' => array( 0, 'arrayindex' ), |
32 | | - 'arraysearch' => array( 0, 'arraysearch' ), |
| 18 | + 'arrayprint' => array( 0, 'arrayprint' ), |
| 19 | + 'arraysize' => array( 0, 'arraysize' ), |
| 20 | + 'arrayindex' => array( 0, 'arrayindex' ), |
| 21 | + 'arraysearch' => array( 0, 'arraysearch' ), |
33 | 22 | |
34 | | - 'arrayunique' => array( 0, 'arrayunique' ), |
35 | | - 'arraysort' => array( 0, 'arraysort' ), |
36 | | - 'arrayreset' => array( 0, 'arrayreset' ), |
| 23 | + 'arrayunique' => array( 0, 'arrayunique' ), |
| 24 | + 'arraysort' => array( 0, 'arraysort' ), |
| 25 | + 'arrayreset' => array( 0, 'arrayreset' ), |
37 | 26 | |
38 | | - 'arraymerge' => array( 0, 'arraymerge' ), |
39 | | - 'arrayslice' => array( 0, 'arrayslice' ), |
| 27 | + 'arraymerge' => array( 0, 'arraymerge' ), |
| 28 | + 'arrayslice' => array( 0, 'arrayslice' ), |
40 | 29 | |
41 | | - 'arrayunion' => array( 0, 'arrayunion' ), |
42 | | - 'arrayintersect' => array( 0, 'arrayintersect' ), |
43 | | - 'arraydiff' => array( 0, 'arraydiff' ), |
44 | | - 'arraysearcharray' => array( 0, 'arraysearcharray' ), |
45 | | - ); |
46 | | - |
47 | | - # English is used as a fallback, and the English synonyms are |
48 | | - # used if a translation has not been provided for a given word |
49 | | - return ( $lang == 'en' || !isset( $words[$lang] ) ) |
50 | | - ? $words['en'] |
51 | | - : array_merge( $words['en'], $words[$lang] ); |
52 | | -} |
| 30 | + 'arrayunion' => array( 0, 'arrayunion' ), |
| 31 | + 'arrayintersect' => array( 0, 'arrayintersect' ), |
| 32 | + 'arraydiff' => array( 0, 'arraydiff' ), |
| 33 | + 'arraysearcharray' => array( 0, 'arraysearcharray' ), |
| 34 | +); |