Index: trunk/extensions/Translate/groups/Pywikipedia/Pywikipedia.yaml |
— | — | @@ -3,6 +3,11 @@ |
4 | 4 | namespace: NS_PYWIKIPEDIA |
5 | 5 | class: FileBasedMessageGroup |
6 | 6 | description: "{{int:translate-group-desc-pywikipedia}}" |
| 7 | + |
| 8 | + CHECKER: |
| 9 | + class: MessageChecker |
| 10 | + checks: |
| 11 | + - pythonInterpolationCheck |
7 | 12 | --- |
8 | 13 | BASIC: |
9 | 14 | id: out-pywikipedia-0-all |
Index: trunk/extensions/Translate/MessageChecks.php |
— | — | @@ -264,6 +264,17 @@ |
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
| 268 | + * Checks for missing and unknown python string interpolation operators in |
| 269 | + * translations. |
| 270 | + * @param $messages \mixed Iterable list of TMessage objects. |
| 271 | + * @param $code \string Language code |
| 272 | + * @param $warnings \array Array where warnings are appended to. |
| 273 | + */ |
| 274 | + protected function pythonInterpolationCheck( $messages, $code, &$warnings ) { |
| 275 | + return $this->parameterCheck( $messages, $code, $warnings, '/\%\([a-zA-Z0-9]*?\)[diouxXeEfFgGcrs]/U' ); |
| 276 | + } |
| 277 | + |
| 278 | + /** |
268 | 279 | * Checks if the translation has even number of opening and closing |
269 | 280 | * parentheses. {, [ and ( are checked. |
270 | 281 | * @param $messages \mixed Iterable list of TMessage objects. |