Index: trunk/extensions/Translate/FFS.php |
— | — | @@ -526,9 +526,7 @@ |
527 | 527 | $array = array(); |
528 | 528 | foreach ( $messages as $key => $value ) { |
529 | 529 | $plurals = $this->unflattenPlural( $key, $value ); |
530 | | - if ( $plurals === false ) { |
531 | | - $plurals = array( $key => $value ); |
532 | | - } |
| 530 | + if ( $plurals === false ) continue; |
533 | 531 | |
534 | 532 | foreach ( $plurals as $key => $value ) { |
535 | 533 | |
— | — | @@ -567,8 +565,12 @@ |
568 | 566 | return false; |
569 | 567 | } |
570 | 568 | |
| 569 | + /** |
| 570 | + * Override this. Return false to skip processing this value. Otherwise |
| 571 | + * return array with keys and values. |
| 572 | + */ |
571 | 573 | protected function unflattenPlural( $key, $value ) { |
572 | | - return false; |
| 574 | + return array( $key => $value ); |
573 | 575 | } |
574 | 576 | |
575 | 577 | } |
— | — | @@ -618,7 +620,7 @@ |
619 | 621 | */ |
620 | 622 | protected function unflattenPlural( $key, $message ) { |
621 | 623 | // Quick escape |
622 | | - if ( strpos( $message, '{{PLURAL' ) === false ) return false; |
| 624 | + if ( strpos( $message, '{{PLURAL' ) === false ) return array( $key => $message ); |
623 | 625 | |
624 | 626 | // Replace all variables with placeholders. Possible source of bugs |
625 | 627 | // if other characters that given below are used. |
— | — | @@ -676,6 +678,11 @@ |
677 | 679 | $value = str_replace( array_keys( $placeholders ), array_values( $placeholders ), $value ); |
678 | 680 | } |
679 | 681 | |
| 682 | + if ( !isset($alts["$key.other"]) ) { |
| 683 | + wfWarn( "Other not set for key $key" ); |
| 684 | + return false; |
| 685 | + } |
| 686 | + |
680 | 687 | return $alts; |
681 | 688 | } |
682 | 689 | |