Index: trunk/extensions/ParserFunctions/ParserFunctions.i18n.magic.php |
— | — | @@ -1,111 +1,96 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +$magicWords = array(); |
| 5 | + |
4 | 6 | /** |
5 | | - * Get translated magic words, if available |
6 | | - * |
7 | | - * @param string $lang Language code |
8 | | - * @return array |
| 7 | + * English |
9 | 8 | */ |
10 | | -function efParserFunctionsWords( $lang ) { |
11 | | - $words = array(); |
| 9 | + 'expr' => array( 0, 'expr' ), |
| 10 | + 'if' => array( 0, 'if' ), |
| 11 | + 'ifeq' => array( 0, 'ifeq' ), |
| 12 | + 'ifexpr' => array( 0, 'ifexpr' ), |
| 13 | + 'iferror' => array( 0, 'iferror' ), |
| 14 | + 'switch' => array( 0, 'switch' ), |
| 15 | + 'default' => array( 0, '#default' ), |
| 16 | + 'ifexist' => array( 0, 'ifexist' ), |
| 17 | + 'time' => array( 0, 'time' ), |
| 18 | + 'timel' => array( 0, 'timel' ), |
| 19 | + 'rel2abs' => array( 0, 'rel2abs' ), |
| 20 | + 'titleparts' => array( 0, 'titleparts' ), |
| 21 | + 'len' => array( 0, 'len' ), |
| 22 | + 'pos' => array( 0, 'pos' ), |
| 23 | + 'rpos' => array( 0, 'rpos' ), |
| 24 | + 'sub' => array( 0, 'sub' ), |
| 25 | + 'count' => array( 0, 'count' ), |
| 26 | + 'replace' => array( 0, 'replace' ), |
| 27 | + 'explode' => array( 0, 'explode' ), |
| 28 | +); |
12 | 29 | |
13 | | - /** |
14 | | - * English |
15 | | - */ |
16 | | - $words['en'] = array( |
17 | | - 'expr' => array( 0, 'expr' ), |
18 | | - 'if' => array( 0, 'if' ), |
19 | | - 'ifeq' => array( 0, 'ifeq' ), |
20 | | - 'ifexpr' => array( 0, 'ifexpr' ), |
21 | | - 'iferror' => array( 0, 'iferror' ), |
22 | | - 'switch' => array( 0, 'switch' ), |
23 | | - 'default' => array( 0, '#default' ), |
24 | | - 'ifexist' => array( 0, 'ifexist' ), |
25 | | - 'time' => array( 0, 'time' ), |
26 | | - 'timel' => array( 0, 'timel' ), |
27 | | - 'rel2abs' => array( 0, 'rel2abs' ), |
28 | | - 'titleparts' => array( 0, 'titleparts' ), |
29 | | - 'len' => array( 0, 'len' ), |
30 | | - 'pos' => array( 0, 'pos' ), |
31 | | - 'rpos' => array( 0, 'rpos' ), |
32 | | - 'sub' => array( 0, 'sub' ), |
33 | | - 'count' => array( 0, 'count' ), |
34 | | - 'replace' => array( 0, 'replace' ), |
35 | | - 'explode' => array( 0, 'explode' ), |
36 | | - ); |
| 30 | +/** |
| 31 | + * Farsi-Persian |
| 32 | + */ |
| 33 | +$magicWords['fa'] = array( |
| 34 | + 'expr' => array( 0, 'حساب', 'expr' ), |
| 35 | + 'if' => array( 0, 'اگر', 'if' ), |
| 36 | + 'ifeq' => array( 0, 'اگرمساوی', 'ifeq' ), |
| 37 | + 'ifexpr' => array( 0, 'اگرحساب', 'ifexpr' ), |
| 38 | + 'iferror' => array( 0, 'اگرخطا', 'iferror' ), |
| 39 | + 'switch' => array( 0, 'گزینه', 'switch' ), |
| 40 | + 'default' => array( 0, '#پیشفرض', '#default' ), |
| 41 | + 'ifexist' => array( 0, 'اگرموجود', 'ifexist' ), |
| 42 | + 'time' => array( 0, 'زمان', 'time' ), |
| 43 | + 'timel' => array( 0, 'زمانبلند', 'timel' ), |
| 44 | + 'rel2abs' => array( 0, 'نسبیبهمطلق', 'rel2abs' ), |
| 45 | + 'titleparts' => array( 0, 'پارهعنوان', 'titleparts' ), |
| 46 | +); |
37 | 47 | |
38 | | - /** |
39 | | - * Farsi-Persian |
40 | | - */ |
41 | | - $words['fa'] = array( |
42 | | - 'expr' => array( 0, 'حساب', 'expr' ), |
43 | | - 'if' => array( 0, 'اگر', 'if' ), |
44 | | - 'ifeq' => array( 0, 'اگرمساوی', 'ifeq' ), |
45 | | - 'ifexpr' => array( 0, 'اگرحساب', 'ifexpr' ), |
46 | | - 'iferror' => array( 0, 'اگرخطا', 'iferror' ), |
47 | | - 'switch' => array( 0, 'گزینه', 'switch' ), |
48 | | - 'default' => array( 0, '#پیشفرض', '#default' ), |
49 | | - 'ifexist' => array( 0, 'اگرموجود', 'ifexist' ), |
50 | | - 'time' => array( 0, 'زمان', 'time' ), |
51 | | - 'timel' => array( 0, 'زمانبلند', 'timel' ), |
52 | | - 'rel2abs' => array( 0, 'نسبیبهمطلق', 'rel2abs' ), |
53 | | - 'titleparts' => array( 0, 'پارهعنوان', 'titleparts' ), |
54 | | - ); |
| 48 | +/** |
| 49 | + * Hebrew |
| 50 | + */ |
| 51 | +$magicWords['he'] = array( |
| 52 | + 'expr' => array( 0, 'חשב', 'expr' ), |
| 53 | + 'if' => array( 0, 'תנאי', 'if' ), |
| 54 | + 'ifeq' => array( 0, 'שווה', 'ifeq' ), |
| 55 | + 'ifexpr' => array( 0, 'חשב תנאי', 'ifexpr' ), |
| 56 | + 'iferror' => array( 0, 'תנאי שגיאה', 'iferror' ), |
| 57 | + 'switch' => array( 0, 'בחר', 'switch' ), |
| 58 | + 'default' => array( 0, '#ברירת מחדל', '#default' ), |
| 59 | + 'ifexist' => array( 0, 'קיים', 'ifexist' ), |
| 60 | + 'time' => array( 0, 'זמן', 'time' ), |
| 61 | + 'timel' => array( 0, 'זמןמ', 'timel' ), |
| 62 | + 'rel2abs' => array( 0, 'יחסי למוחלט', 'rel2abs' ), |
| 63 | + 'titleparts' => array( 0, 'חלק בכותרת', 'titleparts' ), |
| 64 | +); |
55 | 65 | |
56 | | - /** |
57 | | - * Hebrew |
58 | | - */ |
59 | | - $words['he'] = array( |
60 | | - 'expr' => array( 0, 'חשב', 'expr' ), |
61 | | - 'if' => array( 0, 'תנאי', 'if' ), |
62 | | - 'ifeq' => array( 0, 'שווה', 'ifeq' ), |
63 | | - 'ifexpr' => array( 0, 'חשב תנאי', 'ifexpr' ), |
64 | | - 'iferror' => array( 0, 'תנאי שגיאה', 'iferror' ), |
65 | | - 'switch' => array( 0, 'בחר', 'switch' ), |
66 | | - 'default' => array( 0, '#ברירת מחדל', '#default' ), |
67 | | - 'ifexist' => array( 0, 'קיים', 'ifexist' ), |
68 | | - 'time' => array( 0, 'זמן', 'time' ), |
69 | | - 'timel' => array( 0, 'זמןמ', 'timel' ), |
70 | | - 'rel2abs' => array( 0, 'יחסי למוחלט', 'rel2abs' ), |
71 | | - 'titleparts' => array( 0, 'חלק בכותרת', 'titleparts' ), |
72 | | - ); |
| 66 | +/** |
| 67 | + * Indonesian |
| 68 | + */ |
| 69 | +$magicWords['id'] = array( |
| 70 | + 'expr' => array( 0, 'hitung', 'expr' ), |
| 71 | + 'if' => array( 0, 'jika', 'if' ), |
| 72 | + 'ifeq' => array( 0, 'jikasama', 'ifeq' ), |
| 73 | + 'ifexpr' => array( 0, 'jikahitung', 'ifexpr' ), |
| 74 | + 'iferror' => array( 0, 'jikasalah', 'iferror' ), |
| 75 | + 'switch' => array( 0, 'pilih', 'switch' ), |
| 76 | + 'default' => array( 0, '#baku', '#default' ), |
| 77 | + 'ifexist' => array( 0, 'jikaada', 'ifexist' ), |
| 78 | + 'time' => array( 0, 'waktu', 'time' ), |
| 79 | + 'timel' => array( 0, 'waktu1', 'timel' ), |
| 80 | + 'rel2abs' => array( 0, 'rel2abs' ), |
| 81 | + 'titleparts' => array( 0, 'bagianjudul', 'titleparts' ), |
| 82 | +); |
73 | 83 | |
74 | | - /** |
75 | | - * Indonesian |
76 | | - */ |
77 | | - $words['id'] = array( |
78 | | - 'expr' => array( 0, 'hitung', 'expr' ), |
79 | | - 'if' => array( 0, 'jika', 'if' ), |
80 | | - 'ifeq' => array( 0, 'jikasama', 'ifeq' ), |
81 | | - 'ifexpr' => array( 0, 'jikahitung', 'ifexpr' ), |
82 | | - 'iferror' => array( 0, 'jikasalah', 'iferror' ), |
83 | | - 'switch' => array( 0, 'pilih', 'switch' ), |
84 | | - 'default' => array( 0, '#baku', '#default' ), |
85 | | - 'ifexist' => array( 0, 'jikaada', 'ifexist' ), |
86 | | - 'time' => array( 0, 'waktu', 'time' ), |
87 | | - 'timel' => array( 0, 'waktu1', 'timel' ), |
88 | | - 'rel2abs' => array( 0, 'rel2abs' ), |
89 | | - 'titleparts' => array( 0, 'bagianjudul', 'titleparts' ), |
90 | | - ); |
91 | | - |
92 | | - /** |
93 | | - * Yiddish |
94 | | - */ |
95 | | - $words['yi'] = array( |
96 | | - 'expr' => array( 0, 'רעכן', 'expr' ), |
97 | | - 'if' => array( 0, 'תנאי', 'if' ), |
98 | | - 'ifeq' => array( 0, 'גלייך', 'ifeq' ), |
99 | | - 'ifexpr' => array( 0, 'אויברעכן', 'ifexpr' ), |
100 | | - 'switch' => array( 0, 'קלייב', 'switch' ), |
101 | | - 'default' => array( 0, '#גרונט', '#default' ), |
102 | | - 'ifexist' => array( 0, 'עקזיסט', 'ifexist' ), |
103 | | - 'time' => array( 0, 'צייט', 'time' ), |
104 | | - 'timel' => array( 0, 'צייטל', 'timel' ), |
105 | | - ); |
106 | | - |
107 | | - # English is used as a fallback, and the English synonyms are |
108 | | - # used if a translation has not been provided for a given word |
109 | | - return ( $lang == 'en' || !isset( $words[$lang] ) ) |
110 | | - ? $words['en'] |
111 | | - : array_merge( $words['en'], $words[$lang] ); |
112 | | -} |
| 84 | +/** |
| 85 | + * Yiddish |
| 86 | + */ |
| 87 | +$magicWords['yi'] = array( |
| 88 | + 'expr' => array( 0, 'רעכן', 'expr' ), |
| 89 | + 'if' => array( 0, 'תנאי', 'if' ), |
| 90 | + 'ifeq' => array( 0, 'גלייך', 'ifeq' ), |
| 91 | + 'ifexpr' => array( 0, 'אויברעכן', 'ifexpr' ), |
| 92 | + 'switch' => array( 0, 'קלייב', 'switch' ), |
| 93 | + 'default' => array( 0, '#גרונט', '#default' ), |
| 94 | + 'ifexist' => array( 0, 'עקזיסט', 'ifexist' ), |
| 95 | + 'time' => array( 0, 'צייט', 'time' ), |
| 96 | + 'timel' => array( 0, 'צייטל', 'timel' ), |
| 97 | +); |
Index: trunk/extensions/ParserFunctions/ParserFunctions.i18n.php |
— | — | @@ -5,6 +5,8 @@ |
6 | 6 | * @addtogroup Extensions |
7 | 7 | */ |
8 | 8 | |
| 9 | +require_once( dirname(__FILE__) . '/ParserFunctions.i18n.magic.php' ); |
| 10 | + |
9 | 11 | $messages = array(); |
10 | 12 | |
11 | 13 | $messages['en'] = array( |
Index: trunk/extensions/ParserFunctions/ParserFunctions.php |
— | — | @@ -30,13 +30,12 @@ |
31 | 31 | */ |
32 | 32 | $wgPFEnableStringFunctions = false; |
33 | 33 | |
34 | | - |
35 | 34 | /** REGISTRATION */ |
36 | 35 | $wgExtensionFunctions[] = 'wfSetupParserFunctions'; |
37 | 36 | $wgExtensionCredits['parserhook'][] = array( |
38 | 37 | 'path' => __FILE__, |
39 | 38 | 'name' => 'ParserFunctions', |
40 | | - 'version' => '1.2.0', |
| 39 | + 'version' => '1.3.0', |
41 | 40 | 'url' => 'http://www.mediawiki.org/wiki/Extension:ParserFunctions', |
42 | 41 | 'author' => array('Tim Starling', 'Robert Rohde', 'Ross McClure', 'Juraj Simlovic'), |
43 | 42 | 'description' => 'Enhance parser with logical functions', |
— | — | @@ -45,11 +44,9 @@ |
46 | 45 | |
47 | 46 | $wgAutoloadClasses['ExtParserFunctions'] = dirname(__FILE__).'/ParserFunctions_body.php'; |
48 | 47 | $wgExtensionMessagesFiles['ParserFunctions'] = dirname(__FILE__) . '/ParserFunctions.i18n.php'; |
49 | | -$wgHooks['LanguageGetMagic'][] = 'wfParserFunctionsLanguageGetMagic'; |
50 | 48 | |
51 | 49 | $wgParserTestFiles[] = dirname( __FILE__ ) . "/funcsParserTests.txt"; |
52 | 50 | |
53 | | - |
54 | 51 | function wfSetupParserFunctions() { |
55 | 52 | global $wgParser, $wgPFHookStub, $wgHooks; |
56 | 53 | |
— | — | @@ -68,13 +65,6 @@ |
69 | 66 | $wgHooks['ParserClearState'][] = array( &$wgPFHookStub, 'clearState' ); |
70 | 67 | } |
71 | 68 | |
72 | | -function wfParserFunctionsLanguageGetMagic( &$magicWords, $langCode ) { |
73 | | - require_once( dirname( __FILE__ ) . '/ParserFunctions.i18n.magic.php' ); |
74 | | - foreach( efParserFunctionsWords( $langCode ) as $word => $trans ) |
75 | | - $magicWords[$word] = $trans; |
76 | | - return true; |
77 | | -} |
78 | | - |
79 | 69 | /** |
80 | 70 | * Stub class to defer loading of the bulk of the code until a parser function is |
81 | 71 | * actually used. |
Index: trunk/extensions/Translate/groups/mediawiki-defines.txt |
— | — | @@ -670,6 +670,7 @@ |
671 | 671 | |
672 | 672 | Parser Functions |
673 | 673 | descmsg = pfunc_desc |
| 674 | +magicfile = ParserFunctions/ParserFunctions.i18n.magic.php |
674 | 675 | |
675 | 676 | Patroller |
676 | 677 | aliasfile = Patroller/Patroller.alias.php |