Index: trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_SMWDoc.php |
— | — | @@ -15,6 +15,15 @@ |
16 | 16 | class SMWSMWDoc extends ParserHook { |
17 | 17 | |
18 | 18 | /** |
| 19 | + * Field to store the value of the language parameter. |
| 20 | + * |
| 21 | + * @since 1.6.1 |
| 22 | + * |
| 23 | + * @var string |
| 24 | + */ |
| 25 | + protected $language; |
| 26 | + |
| 27 | + /** |
19 | 28 | * No LSB in pre-5.3 PHP *sigh*. |
20 | 29 | * This is to be refactored as soon as php >=5.3 becomes acceptable. |
21 | 30 | */ |
— | — | @@ -57,8 +66,12 @@ |
58 | 67 | |
59 | 68 | $params['format'] = new Parameter( 'format' ); |
60 | 69 | $params['format']->addCriteria( new CriterionInArray( array_keys( $GLOBALS['smwgResultFormats'] ) ) ); |
61 | | - $params['format']->setDescription( wfMsg( 'smw-smwdoc-par-format' ) ); |
| 70 | + $params['format']->setMessage( 'smw-smwdoc-par-format' ); |
62 | 71 | |
| 72 | + $params['language'] = new Parameter( 'language' ); |
| 73 | + $params['language']->setDefault( $GLOBALS['wgLanguageCode'] ); |
| 74 | + $params['language']->setMessage( 'smw-smwdoc-par-language' ); |
| 75 | + |
63 | 76 | return $params; |
64 | 77 | } |
65 | 78 | |
— | — | @@ -71,7 +84,7 @@ |
72 | 85 | * @return array |
73 | 86 | */ |
74 | 87 | protected function getDefaultParameters( $type ) { |
75 | | - return array( 'format' ); |
| 88 | + return array( 'format', 'language' ); |
76 | 89 | } |
77 | 90 | |
78 | 91 | /** |
— | — | @@ -85,6 +98,8 @@ |
86 | 99 | * @return string |
87 | 100 | */ |
88 | 101 | public function render( array $parameters ) { |
| 102 | + $this->language = $parameters['language']; |
| 103 | + |
89 | 104 | $params = $this->getFormatParameters( $parameters['format'] ); |
90 | 105 | |
91 | 106 | return $this->getParameterTable( $params ); |
— | — | @@ -110,11 +125,11 @@ |
111 | 126 | |
112 | 127 | if ( count( $tableRows ) > 0 ) { |
113 | 128 | $tableRows = array_merge( array( |
114 | | - '!' . wfMsg( 'validator-describe-header-parameter' ) ."\n" . |
115 | | - '!' . wfMsg( 'validator-describe-header-aliases' ) ."\n" . |
116 | | - '!' . wfMsg( 'validator-describe-header-type' ) ."\n" . |
117 | | - '!' . wfMsg( 'validator-describe-header-default' ) ."\n" . |
118 | | - '!' . wfMsg( 'validator-describe-header-description' ) |
| 129 | + '!' . $this->msg( 'validator-describe-header-parameter' ) ."\n" . |
| 130 | + '!' . $this->msg( 'validator-describe-header-aliases' ) ."\n" . |
| 131 | + '!' . $this->msg( 'validator-describe-header-type' ) ."\n" . |
| 132 | + '!' . $this->msg( 'validator-describe-header-default' ) ."\n" . |
| 133 | + '!' . $this->msg( 'validator-describe-header-description' ) |
119 | 134 | ), $tableRows ); |
120 | 135 | |
121 | 136 | $table = implode( "\n|-\n", $tableRows ); |
— | — | @@ -141,12 +156,18 @@ |
142 | 157 | $aliases = $parameter->getAliases(); |
143 | 158 | $aliases = count( $aliases ) > 0 ? implode( ', ', $aliases ) : '-'; |
144 | 159 | |
145 | | - $description = $parameter->getDescription(); |
146 | | - if ( $description === false ) $description = '-'; |
| 160 | + $description = $parameter->getMessage(); |
| 161 | + if ( $description === false ) { |
| 162 | + $description = $parameter->getDescription(); |
| 163 | + if ( $description === false ) $description = '-'; |
| 164 | + } |
| 165 | + else { |
| 166 | + $description = $this->msg( $description ); |
| 167 | + } |
147 | 168 | |
148 | 169 | $type = $parameter->getTypeMessage(); |
149 | 170 | |
150 | | - $default = $parameter->isRequired() ? "''" . wfMsg( 'validator-describe-required' ) . "''" : $parameter->getDefault(); |
| 171 | + $default = $parameter->isRequired() ? "''" . $this->msg( 'validator-describe-required' ) . "''" : $parameter->getDefault(); |
151 | 172 | if ( is_array( $default ) ) { |
152 | 173 | $default = implode( ', ', $default ); |
153 | 174 | } |
— | — | @@ -154,7 +175,7 @@ |
155 | 176 | $default = $default ? 'yes' : 'no'; |
156 | 177 | } |
157 | 178 | |
158 | | - if ( $default === '' ) $default = "''" . wfMsg( 'validator-describe-empty' ) . "''"; |
| 179 | + if ( $default === '' ) $default = "''" . $this->msg( 'validator-describe-empty' ) . "''"; |
159 | 180 | |
160 | 181 | return <<<EOT |
161 | 182 | | {$parameter->getName()} |
— | — | @@ -175,12 +196,28 @@ |
176 | 197 | } |
177 | 198 | |
178 | 199 | /** |
179 | | - * @see ParserHook::getDescription() |
| 200 | + * @see ParserHook::getMessage() |
180 | 201 | * |
181 | | - * @since 1.6 |
| 202 | + * @since 1.6.1 |
182 | 203 | */ |
183 | | - public function getDescription() { |
184 | | - return wfMsg( 'smw-smwdoc-description' ); |
185 | | - } |
| 204 | + public function getMessage() { |
| 205 | + return 'smw-smwdoc-description'; |
| 206 | + } |
186 | 207 | |
| 208 | + /** |
| 209 | + * Message function that takes into account the language parameter. |
| 210 | + * |
| 211 | + * @since 1.6.1 |
| 212 | + * |
| 213 | + * @param string $key |
| 214 | + * @param array $args |
| 215 | + * |
| 216 | + * @return string |
| 217 | + */ |
| 218 | + protected function msg( $key ) { |
| 219 | + $args = func_get_args(); |
| 220 | + $key = array_shift( $args ); |
| 221 | + return wfMsgReal( $key, $args, true, $this->language ); |
| 222 | + } |
| 223 | + |
187 | 224 | } |
\ No newline at end of file |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | * @ingroup SMW |
16 | 16 | */ |
17 | 17 | |
18 | | -define( 'SMW_VERSION', '1.6-light' ); |
| 18 | +define( 'SMW_VERSION', '1.6.1 alpha-light' ); |
19 | 19 | |
20 | 20 | require_once( 'SMW_GlobalFunctions.php' ); |
21 | 21 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | // The SMW version number. |
12 | | -define( 'SMW_VERSION', '1.6' ); |
| 12 | +define( 'SMW_VERSION', '1.6.1 alpha' ); |
13 | 13 | |
14 | 14 | // A flag used to indicate SMW defines a semantic extension type for extension crdits. |
15 | 15 | define( 'SEMANTIC_EXTENSION_TYPE', true ); |