Index: trunk/phase3/maintenance/language/rebuildLanguage.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | $messages = $messages['all']; |
26 | 26 | |
27 | 27 | # Rewrite messages array |
28 | | - $messagesText = writeMessagesArray( $messages ); |
| 28 | + $messagesText = writeMessagesArray( $messages, $code == 'en' ); |
29 | 29 | |
30 | 30 | # Write to the file |
31 | 31 | if ( $write ) { |
Index: trunk/phase3/maintenance/language/writeMessagesArray.inc |
— | — | @@ -7,15 +7,17 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | require_once( 'messages.inc' ); |
| 11 | +require_once( 'messageTypes.inc' ); |
11 | 12 | |
12 | 13 | /** |
13 | 14 | * Write a messages array as a PHP text. |
14 | 15 | * |
15 | 16 | * @param $messages The messages array. |
| 17 | + * @param $ignoredComments Show comments about ignored and optional messages? (For English.) |
16 | 18 | * |
17 | 19 | * @return The PHP text. |
18 | 20 | */ |
19 | | -function writeMessagesArray( $messages ) { |
| 21 | +function writeMessagesArray( $messages, $ignoredComments = false ) { |
20 | 22 | global $wgMessageStrucutre, $wgBlockComments, $wgMessageComments; |
21 | 23 | |
22 | 24 | # Sort messages to blocks |
— | — | @@ -39,9 +41,9 @@ |
40 | 42 | } |
41 | 43 | |
42 | 44 | # Write the block |
43 | | - $messagesText .= writeMessagesBlock( $block, $wgBlockComments[$block], $messages ); |
| 45 | + $messagesText .= writeMessagesBlock( $block, $wgBlockComments[$block], $messages, $ignoredComments ); |
44 | 46 | } |
45 | | - $messagesText .= writeMessagesBlock( 'unknown', 'Unknown messages', $sortedMessages['unknown'] ); |
| 47 | + $messagesText .= writeMessagesBlock( 'unknown', 'Unknown messages', $sortedMessages['unknown'], $ignoredComments ); |
46 | 48 | $messagesText .= ");\n"; |
47 | 49 | |
48 | 50 | return $messagesText; |
— | — | @@ -53,11 +55,13 @@ |
54 | 56 | * @param $name The block name. |
55 | 57 | * @param $comment The block comment. |
56 | 58 | * @param $messages The block messages. |
| 59 | + * @param $ignoredComments Show comments about ignored and optional messages? (For English.) |
57 | 60 | * |
58 | 61 | * @return The block, formatted in PHP. |
59 | 62 | */ |
60 | | -function writeMessagesBlock( $name, $comment, $messages ) { |
| 63 | +function writeMessagesBlock( $name, $comment, $messages, $ignoredComments ) { |
61 | 64 | global $wgMessageComments; |
| 65 | + global $wgIgnoredMessages, $wgOptionalMessages; |
62 | 66 | $blockText = ''; |
63 | 67 | |
64 | 68 | # Skip the block if it includes no messages |
— | — | @@ -107,7 +111,24 @@ |
108 | 112 | # Comma |
109 | 113 | $blockText .= ','; |
110 | 114 | |
111 | | - if ( array_key_exists( $key, $wgMessageComments ) ) { |
| 115 | + $ignoredComment = "don't translate or duplicate this message to other languages"; |
| 116 | + $optionalComment = "only translate this message to other languages if you have to change it"; |
| 117 | + $showIgnoredOrOptionalComment = in_array( $key, $wgIgnoredMessages ) || in_array( $key, $wgOptionalMessages ); |
| 118 | + if ( $ignoredComments ) { |
| 119 | + if ( array_key_exists( $key, $wgMessageComments ) ) { |
| 120 | + $blockText .= ' # ' . $wgMessageComments[$key]; |
| 121 | + if ( $showIgnoredOrOptionalComment ) { |
| 122 | + $blockText .= '; '; |
| 123 | + } |
| 124 | + } elseif ( $showIgnoredOrOptionalComment ) { |
| 125 | + $blockText .= ' # '; |
| 126 | + } |
| 127 | + if ( in_array( $key, $wgIgnoredMessages ) ) { |
| 128 | + $blockText .= $ignoredComment; |
| 129 | + } elseif ( in_array( $key, $wgOptionalMessages ) ) { |
| 130 | + $blockText .= $optionalComment; |
| 131 | + } |
| 132 | + } elseif ( array_key_exists( $key, $wgMessageComments ) ) { |
112 | 133 | $blockText .= ' # ' . $wgMessageComments[$key]; |
113 | 134 | } |
114 | 135 | |